CommunicationException, while the ctx.lookup () client in GlassFish 3.1

I have one entity class that implements Serializable, and I got this error on the 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} [java.rmi.MarshalException root exception: CORBA BAD_PARAM 1398079494 Possible; the nested exception is: java.io.NotSerializableException: ---------- BEGIN on the server side of the trace ---------- org.omg.CORBA.BAD_PARAM: WARNING: IOP00100006: class com. sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate is not Serializable vmcid: SUN minor code: 6 completed: Possible

when I do SomeService serv = (SomeService)ctx.lookup("java:global/MyProject/SomeServiceImpl");

Should the Entity class be in the same package both on the server and on the client? Now the Entity class is in the package (dir) of the client application and in the package (dir), where the SomeService interface is on the server.

+4
source share
2 answers

I added the @Remote annotation to the service interface and error.

+7
source

I tried the following and everything is working fine.

When creating an InitialContext like:

 Properties props = new Properties(); props.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.enterprise.naming.SerialInitContextFactory"); props.setProperty("org.omg.CORBA.ORBInitialHost", "localhost"); props.setProperty("org.omg.CORBA.ORBInitialPort", "3700"); InitialContext ctx = new InitialContext(props); 

And later

 myBeanService = (MyBeanService) ctx.lookup("java:global/AppName/MyBeanService"); 

This exception shows, but if I just call like this:

 myBeanService = (MyBeanService) new InitialContext().lookup("java:global/AppName/MyBeanService"); 

No problems. The problem is the JNDI properties.

-1
source