GlassFish 3.1 中客户端的 ctx.lookup() 时出现 CommunicationException
我有一个实现可序列化的实体类,我在客户端上收到此错误:
javax.naming.CommunicationException: 通讯异常 SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.url.pkgs=com.sun.enterprise.naming, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl} [根异常是 java.rmi.MarshalException:CORBA BAD_PARAM 1398079494 也许;嵌套的 例外是: java.io.NotSerializedException: ----------开始服务器端堆栈跟踪---------- org.omg.CORBA.BAD_PARAM:警告: IOP00100006:类 com.sun.ejb.containers.EJBLocalObjectInitationHandlerDelegate vmcid 不可序列化:SUN 次要 代码:6 完成:也许
当我在做时 SomeService serv = (SomeService)ctx.lookup("java:global/MyProject/SomeServiceImpl");
实体类是否应该位于同一个包中服务器和客户端? 现在实体类位于客户端应用程序的包(dir)和服务器上SomeService接口所在的包(dir)中。
I have one entity class which implements Serializable and I got this error on client:
javax.naming.CommunicationException:
Communication exception for
SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory,
java.naming.factory.url.pkgs=com.sun.enterprise.naming,
java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl}
[Root exception is
java.rmi.MarshalException: CORBA
BAD_PARAM 1398079494 Maybe; nested
exception is:
java.io.NotSerializableException:
----------BEGIN server-side stack trace----------
org.omg.CORBA.BAD_PARAM: WARNING:
IOP00100006: Class
com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate
is not Serializable vmcid: SUN minor
code: 6 completed: Maybe
when I'm doing SomeService serv = (SomeService)ctx.lookup("java:global/MyProject/SomeServiceImpl");
Does Entity class should be in the same package both in server and in client?
Now Entity class is in the package (dir) of Client App and in the package (dir) where SomeService interface is on the server.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我向服务接口添加了 @Remote 注释,错误消失了。
I added
@Remote
annotation to service interface and error disapeared.我尝试了以下操作,一切正常。
创建InitialContext时为:
后来,
显示了该异常,但如果我只是这样调用:
没有问题。问题在于 JNDI 属性。
I tried the following and everything works Ok.
When creating InitialContext as:
And later,
Shows that exception, but if I just call this way:
There is no problem. The problem are the JNDI properties.