你的实体bean市local的,当然可以强制转换,而PortableRemoteObject是实现远程对象的转换,当然不可以了
解决方案 »
- el表达式如何判断时间大小
- myeclipse8.5中ssh整合需要jar包
- mysql触发器该如何写,都进来看看
- 菜鸟初飞,一段WEB SERIVCE代码调试出现问题,高手来看
- Hibernate下如何使用原生SQL语句(不只是查询)
- 关于structs使用动态方法调用
- 100分求jfreechart如何画平滑曲线
- validator验证框架
- Struts in Action第一个例子如何运行?(新手提问)
- struts中action错误,急(100分)
- 非高手莫进,我用JAVA+AXIS做了一个WEBSERVICE,用。NET应用程序访问成功,为什么用微软的htc控件访问返回就空值?
- 高分请教:大家帮我看看sqlsever2000和jb的连接问题?
you are wrong!
this.commBookHome=(CommBookHome)PortableRemoteObject.narrow(o,CommBookHome.class);
above is a standard invoke type,it is good.
why does the exception occured?
I think of that that ejb deployment package is not right, suggest the
author to check the package carefully!
account应该是由account.create(PRIMARYKEY);生成的. 另外你有没有定义它的jini你怎么lookup呢?
EJB是发布成功了,因为根据JNDI可以得到Object对象,但:
AccountHome home = (AccountHome)javax.rmi.PortableRemoteObject.narrow(obj,AccountHome.class);
就出错!!!
我弄了大半天没发现错误,实在气愤至极,干脆不弄了。换JBOSS试试,结果同样的代码却一切正常!
其实你的EJB是没有问题。可能是你的接口没有放好,再或者你的EJB容器根本就没有用。
我猜的……
You can also access EJB components from other EJB components throught their local interfaces rather than their remote interface.
没那么复杂。是java.lang.NoClassDefFoundError而不是ClassCastException.同意 snowglede(雪鹰) 的看法。