Hi,
I want to get the stateless bean using JNDI lookup. I use Netbeans 7.0.1 and Glassfish 3.1. I create the
EJB module and then I deploy it. The log from glassfish:
INFO: Portable JNDI names for EJB NewSessionBean1 : [
java:global/EJBModule2/NewSessionBean1!test.NewSessionBean1, java:global/EJBModule2/NewSessionBean1]
INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
INFO: EJBModule2 was successfully deployed in 103 milliseconds.
My bean class:
Then, I create the client class in the same EJB module and I perform the lookup:
and I get the following exception:
Exception in
thread "main" 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 test.__EJB31_Generated__NewSessionBean1__Intf____Bean__ is not Serializable vmcid: SUN minor code: 6 completed: Maybe
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
In the book EJB3.1 by Rubinger and Burke there was no mention about that the Bean must be serializable.
Anyway, I change the class:
And this time I get the error:
Exception in thread "main" 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.RemoteException: CORBA DATA_CONVERSION 1398079489 No; nested exception is:
org.omg.CORBA.DATA_CONVERSION: ----------BEGIN server-side stack trace----------
org.omg.CORBA.DATA_CONVERSION: WARNING: IOP02400001: Character does not map to negotiated transmission code set vmcid: SUN minor code: 1 completed: No
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
I hane no idea about this problem.
EJB is so weird!