我有一个实现 Serializable 的实体类,但我在客户端收到此错误:
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
当我执行 SomeService serv = (SomeService)ctx.lookup("java:global/MyProject/SomeServiceImpl");
Entity 类是否应该在服务器和客户端中都在同一个包中? 现在Entity类在Client App的包(dir)和服务端SomeService接口(interface)所在的包(dir)中。
最佳答案
我向服务接口(interface)添加了 @Remote
注释,错误消失了。
关于java - GlassFish 3.1 中客户端的 ctx.lookup() 时出现 CommunicationException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5896276/