4
votes

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.

2

2 Answers

7
votes

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

-1
votes

I tried the following and everything works Ok.

When creating InitialContext as:

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");

Shows that exception, but if I just call this way:

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

There is no problem. The problem are the JNDI properties.