I try to connect from a stand-alone swing client (running in a separate JVM on the client machine) to the Glassfish server.
I currently use the following settings from Netbeans and everything works just fine:
System.setProperty("java.naming.factory.initial", "com.sun.enterprise.naming.SerialInitContextFactory");
System.setProperty("java.naming.factory.url.pkgs", "com.sun.enterprise.naming");
System.setProperty("java.naming.factory.state", "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
System.setProperty("org.omg.CORBA.ORBInitialHost", "192.168.1.3");
System.setProperty("org.omg.CORBA.ORBInitialPort", "3700");
InitialContext context = new InitialContext();
But when I try to start the compiled client from the console by typing "java -jar client.jar" I get the following error:
D:\workspace\gf-client\dist>java -jar gf-client.jar
17.08.2012 11:07:38 ch.client.core.ServerContext getInitialContext SCHWERWIEGEND: Cannot instantiate class: com.sun.enterprise.naming.SerialInitContextFactory javax.naming.NoInitialContextException: Cannot instantiate class: com.sun.enterprise.naming.SerialInitContextFactory [Root exception is java.lang.ClassNotFoundException: com.sun.enterprise.naming.SerialInitContextFactory]
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.init(Unknown Source)
at javax.naming.InitialContext.<init>(Unknown Source)
at ch.lawsuite.core.ServerContext.getInitialContext(ServerContext.java:2 7)
at ch.client.core.remote.Facades.initialize(Facades.java:68)
at ch.client.core.Client.main(Client.java:57) Caused by: java.lang.ClassNotFoundException: com.sun.enterprise.naming.SerialIni tContextFactory
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source)
... 7 more Exception in thread "main" java.lang.NullPointerException
at ch.client.core.remote.Facades.initialize(Facades.java:69)
at ch.client.core.Client.main(Client.java:57)
Somebody any helpful idea?
- Does the JVM miss any libs? Which ones? (it works from netbeans and all dependent libs are packed to the compiled jar-file (at least I think so..))
- Are there alternative serial context factories for Glassfish ?
Many thanks for your help in advance!