Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #32550

EJB + Glassfish : remote client

X-Received by 10.107.156.80 with SMTP id f77mr16823103ioe.12.1441615266851; Mon, 07 Sep 2015 01:41:06 -0700 (PDT)
X-Received by 10.182.246.38 with SMTP id xt6mr69954obc.14.1441615266827; Mon, 07 Sep 2015 01:41:06 -0700 (PDT)
Path csiph.com!xmission!news.glorb.com!kq10no1727970igb.0!news-out.google.com!nt1ni3359igb.0!nntp.google.com!kq10no1727969igb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.java.programmer
Date Mon, 7 Sep 2015 01:41:06 -0700 (PDT)
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=2a02:1810:4f2b:6b00:f87a:4dac:a401:882c; posting-account=1fCSIgoAAAAFwv4JloHJOsyo4VvmOOI_
NNTP-Posting-Host 2a02:1810:4f2b:6b00:f87a:4dac:a401:882c
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <29af886b-e905-4be5-b25d-12d5ea4e547b@googlegroups.com> (permalink)
Subject EJB + Glassfish : remote client
From Benjamin <mampaey.benjamin@mampaeybvba.com>
Injection-Date Mon, 07 Sep 2015 08:41:06 +0000
Content-Type text/plain; charset=ISO-8859-1
Xref csiph.com comp.lang.java.programmer:32550

Show key headers only | View raw


Hi all,

I am experimenting with Java Enterprise Beans and Glassfish.
I created also a stand alone client...

It is all running perfectly in Netbeans, but when I try outside Netbeans, it is not working at all.
Also when I download the client-stubs in Glassfish it is not working.

I tried different things, also included different Glassfish jar-files, but nothing worked.
Can anyone help me?

I get following error:

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(NamingManager.java:674)
	at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:313)
	at javax.naming.InitialContext.init(InitialContext.java:244)
	at javax.naming.InitialContext.<init>(InitialContext.java:216)
	at jbizclient.functions.General.getBean(General.java:52)
	at jbizclient.functions.General.translateCpt(General.java:66)
	at jbizclient.core.Loader.<init>(Loader.java:19)
	at jbizclient.JBiz.main(JBiz.java:16)
Caused by: java.lang.ClassNotFoundException: com.sun.enterprise.naming.SerialInitContextFactory
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:348)
	at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:72)
	at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:61)
	at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:672)
	... 7 more
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(NamingManager.java:674)
	at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:313)
	at javax.naming.InitialContext.init(InitialContext.java:244)
	at javax.naming.InitialContext.<init>(InitialContext.java:216)
	at jbizclient.functions.General.getBean(General.java:52)
	at jbizclient.functions.General.translateCpt(General.java:66)
	at jbizclient.functions.General.translateCpt(General.java:91)
	at jbizclient.core.Loader.<init>(Loader.java:19)
	at jbizclient.JBiz.main(JBiz.java:16)
Caused by: java.lang.ClassNotFoundException: com.sun.enterprise.naming.SerialInitContextFactory
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:348)
	at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:72)
	at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:61)
	at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:672)
	... 8 more
Exception in thread "main" java.lang.NullPointerException
	at jbizclient.functions.General.translateCpt(General.java:79)
	at jbizclient.core.Loader.<init>(Loader.java:19)
	at jbizclient.JBiz.main(JBiz.java:16)



This is what I do:



jbiz.core.ComponentTranslationRemote cpttr = (jbiz.core.ComponentTranslationRemote)jbizclient.functions.General.getBean("jbiz.core.ComponentTranslationRemote"); 
String translation = cpttr.translate(parentName, componentName, lang, cpt.getText()); 



  public static Object getBean(String remoteBean) { 
        try { 
            Properties props = new Properties(); 
            props.setProperty("org.omg.CORBA.ORBInitialHost", "localhost"); 
            props.setProperty("org.omg.CORBA.ORBInitialPort", "3700"); 
            props.setProperty("java.naming.factory.initial","com.sun.enterprise.naming.SerialInitContextFactory"); 
            props.setProperty("java.naming.factory.url.pkgs","com.sun.enterprise.naming"); 
            props.setProperty("java.naming.factory.state","com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl"); 
            InitialContext ctx = new InitialContext(props); 
            return ctx.lookup(remoteBean); 
        } catch (NamingException e) { 
            e.printStackTrace(); 
        } 
        return null; 
    } 

Back to comp.lang.java.programmer | Previous | Next | Find similar | Unroll thread


Thread

EJB + Glassfish : remote client Benjamin <mampaey.benjamin@mampaeybvba.com> - 2015-09-07 01:41 -0700

csiph-web