Hello,
I am trying to realise a simple "Hello Word" EJB 3.
The client running into the EJB container( in fact the same glassfish server) run nice. But the standallone version of this client (in pure Java SE) refused to run !
My EJB source code deployed on the glassfish v3 server:
package MyEJB;
import javax.ejb.Remote;
@Remote public interface MyEJBRemote {
String sayHello();
}
package MyEJB;
import javax.ejb.Stateless;
@Stateless(name="MyEJBBean", mappedName="MyEJBBean")
public class MyEJBBean implements MyEJBRemote {
public String sayHello() {return "Hello !!!";}
}
And the source code of the standallone client run on the same PC (but not into glassfish) :
package testmyfirstejb;
import java.io.FileInputStream;
import java.util.Properties;
import javax.naming.InitialContext;
import MyEJB.MyEJBRemote;
public class Main {
public static void main(String[] args) throws Exception {
Properties props = new Properties();
props.load(new FileInputStream("jndi.properties"));
InitialContext ctx = new InitialContext(props);
MyEJBRemote testEJB = (MyEJBRemote) ctx.lookup("MyEJBBean");
System.out.println(testEJB.sayHello());
}
}
With the jndi.properties file :
java.naming.factory.initial = com.sun.enterprise.naming.SerialInitContextFactory
java.naming.factory.url.pkgs = com.sun.enterprise.naming
java.naming.factory.state = com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl
#optional. Defaults to localhost. Only needed if web server is running #on a different host than the appserver org.omg.CORBA.ORBInitialHost = localhost
#optional. Defaults to 3700. Only needed if target orb port is not 3700.
#org.omg.CORBA.ORBInitialPort = 3700
When I run my client the exeception occur :
Exception in thread "main" javax.naming.CommunicationException: Can't find SerialContextProvider [Root exception is org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 208 completed: Maybe] at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:164) at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:409) at javax.naming.InitialContext.lookup(InitialContext.java:392) at testmyfirstejb.Main.main(Main.java:14)
Caused by: org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 208 completed: Maybe at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectionAbort(ORBUtilSystemException.java:2862) at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectionAbort(ORBUtilSystemException.java:2880) at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.doOptimizedReadStrategy(SocketOrChannelConnectionImpl.java:1788) at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.doWork(SocketOrChannelConnectionImpl.java:1263) at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:555)
Caused by: org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 211 completed: No at com.sun.corba.ee.impl.logging.ORBUtilSystemException.ioexceptionWhenReadingConnection(ORBUtilSystemException.java:2946) at com.sun.corba.ee.impl.logging.ORBUtilSystemException.ioexceptionWhenReadingConnection(ORBUtilSystemException.java:2965) at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.nonBlockingRead(SocketOrChannelConnectionImpl.java:2000) at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.doOptimizedReadStrategy(SocketOrChannelConnectionImpl.java:1713) ... 2 more
Caused by: java.io.IOException: End-of-stream at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.nonBlockingRead(SocketOrChannelConnectionImpl.java:1989) ... 3 more
Java Result: 1
Please help me.
S.ALONSO