home=(ConverterHome)(objref);
是不对的,删除好了。
home =(ConverterHome)PortableRemoteObject.narrow(objref, ConverterHome.class);
好象并没有问题的,现在提示说narrow回来的东西转到ConverterHome时出错,是不是你的配置文件有问题?以下的是对的:
.......
Context initial = new InitialContext();
Object objref=null;
objref = initial.lookup("MyConverter"); ConverterHome home=null;home =(ConverterHome)PortableRemoteObject.narrow(objref, ConverterHome.class);
Converter currencyConverter = home.create();
.......不过如果你用的是weblogic等服务器,InitialContext的构造函数还应该传一个属性进去。
是不对的,删除好了。
home =(ConverterHome)PortableRemoteObject.narrow(objref, ConverterHome.class);
好象并没有问题的,现在提示说narrow回来的东西转到ConverterHome时出错,是不是你的配置文件有问题?以下的是对的:
.......
Context initial = new InitialContext();
Object objref=null;
objref = initial.lookup("MyConverter"); ConverterHome home=null;home =(ConverterHome)PortableRemoteObject.narrow(objref, ConverterHome.class);
Converter currencyConverter = home.create();
.......不过如果你用的是weblogic等服务器,InitialContext的构造函数还应该传一个属性进去。
解决方案 »
- 怎样给复选框赋初值
- 数据库登陆
- hibernate修改对象问题
- struts的小问题
- 有人用过ws-jdbc 吗,能否给个例子?
- 各位高手帮帮忙,画板上要写一个能够自由添加文字的程序,文字最好能移动的,最后还要保存,我该怎么做呢?最好有代码,谢谢啦(十万火急)
- java获取磁盘空间,怎么会打印-1,高手帮忙,Jconfig的下载地址谁能告诉我
- 百分求解决禁止浏览目录问题,能在tomcat4,5上运行,非常着急?
- IIS和TOMCAT5的整合问题
- 一个老问题,Cannot create iterator for this collection,谢谢
- EJB部署、发布,你知道吗?
- 关于struts架构的初级问题?
你的那个我试过啊 它提示
java.lang.ClassCastException
at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(Porta
bleRemoteObject.java:293)
at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:134)
at ConverterClient.main(ConverterClient.java:26)
错误,郁闷ing
哎,也不可以,提示:
Caught an unexpected exception!
javax.naming.NamingException: java:comp/env namespace is only available from wit
hin a J2EE component
at com.sun.enterprise.naming.java.javaURLContext.getComponentContext(jav
aURLContext.java:395)
at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.j
ava:51)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at ConverterClient.main(ConverterClient.java:13)
选<<support client choice>>, 然后redeploy
Caught an unexpected exception!
javax.naming.NamingException: java:comp/env namespace is only available from wit
hin a J2EE component
at com.sun.enterprise.naming.java.javaURLContext.getComponentContext(jav
aURLContext.java:395)
at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.j
ava:51)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at ConverterClient.main(ConverterClient.java:13)
选<<support client choice>>, 然后redeploy提示:
class com.sun.corba.ee.internal.iiop.CDRInputStream_1_0$1
interface ConverterHome
Caught an unexpected exception!
java.lang.ClassCastException
at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(Porta
bleRemoteObject.java:293)
at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:134)
at ConverterClient.main(ConverterClient.java:19)
而且你一个home 变量居然既是skeletch,又是homebean,我觉得有点糊涂。