Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NoInitialContextException

 
Mathias Andrae
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using IBM Websphere as AppServer and Visual Age for Java for coding and deploying.
I have got a client application which runs correctly in the environment of Visual Age.
But when I start the client with Webstart I got that exception:
javax.naming.NoInitialContextException: Cannot instantiate class: com.ibm.ejb.ns.jndiCNInitialContextFactory...
Whats the problem? Is my classpath wrong?
And where are the missing classes? The class com.ibm.ejb.ns.jndiCNInitialContextFactory is part of visual age. But how I have to configure a simple client-pc for this type of clients?
Please help...
Thanks,
Mathias
 
Mathias Andrae
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I solved that problem. I forgot the j2ee.jar in the classpath.
but now I got that Exception:
Exception in thread "main" java.lang.NoClassDefFoundError: com/ibm/rmi/iiop/ORB
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:509)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:246)
at java.net.URLClassLoader.access$100(URLClassLoader.java:54)
at java.net.URLClassLoader$1.run(URLClassLoader.java:193)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
at java.lang.ClassLoader.loadClass(ClassLoader.java:262)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:322)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:207)
at org.omg.CORBA.ORB.create_impl(ORB.java:306)
at org.omg.CORBA.ORB.init(ORB.java:345)
at com.ibm.CORBA.iiop.GlobalORBFactory.init(GlobalORBFactory.java:42)
at com.ibm.ejs.oa.EJSORBImpl.initializeORB(EJSORBImpl.java:196)
at com.ibm.ejs.oa.EJSClientORBImpl.<init>(EJSClientORBImpl.java:93)
at com.ibm.ejs.oa.EJSClientORBImpl.<init>(EJSClientORBImpl.java:65)
at com.ibm.ejs.oa.EJSClientORBImpl.<init>(EJSClientORBImpl.java:47)
at com.ibm.ejs.oa.EJSORB.init(EJSORB.java:343)
at com.ibm.ejs.ns.jndi.CNInitialContextFactory.initORB(CNInitialContextFactory.java:355)
at com.ibm.ejs.ns.jndi.CNInitialContextFactory.getInitialContext(CNInitialContextFactory.java:196)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
at javax.naming.InitialContext.init(InitialContext.java:219)
at javax.naming.InitialContext.<init>(InitialContext.java:195)
at effectivevaj.adv.ejb.session.HelloWorldClient.getInitialContext(HelloWorldClient.java:32)
at effectivevaj.adv.ejb.session.HelloWorldClient.main(HelloWorldClient.java:42)
Do you know where I find the missing class???
Is there any classpath on the server I have to set???
 
Ajit Malleri
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
It seems your client application is unable to get the required classes. Just check whether com/ibm/rmi/iiop/ORB package is in the classpath.

Originally posted by Mathias Andrae:
I solved that problem. I forgot the j2ee.jar in the classpath.
but now I got that Exception:
Exception in thread "main" java.lang.NoClassDefFoundError: com/ibm/rmi/iiop/ORB
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:509)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:246)
at java.net.URLClassLoader.access$100(URLClassLoader.java:54)
at java.net.URLClassLoader$1.run(URLClassLoader.java:193)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
at java.lang.ClassLoader.loadClass(ClassLoader.java:262)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:322)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:207)
at org.omg.CORBA.ORB.create_impl(ORB.java:306)
at org.omg.CORBA.ORB.init(ORB.java:345)
at com.ibm.CORBA.iiop.GlobalORBFactory.init(GlobalORBFactory.java:42)
at com.ibm.ejs.oa.EJSORBImpl.initializeORB(EJSORBImpl.java:196)
at com.ibm.ejs.oa.EJSClientORBImpl.<init>(EJSClientORBImpl.java:93)
at com.ibm.ejs.oa.EJSClientORBImpl.<init>(EJSClientORBImpl.java:65)
at com.ibm.ejs.oa.EJSClientORBImpl.<init>(EJSClientORBImpl.java:47)
at com.ibm.ejs.oa.EJSORB.init(EJSORB.java:343)
at com.ibm.ejs.ns.jndi.CNInitialContextFactory.initORB(CNInitialContextFactory.java:355)
at com.ibm.ejs.ns.jndi.CNInitialContextFactory.getInitialContext(CNInitialContextFactory.java:196)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
at javax.naming.InitialContext.init(InitialContext.java:219)
at javax.naming.InitialContext.<init>(InitialContext.java:195)
at effectivevaj.adv.ejb.session.HelloWorldClient.getInitialContext(HelloWorldClient.java:32)
at effectivevaj.adv.ejb.session.HelloWorldClient.main(HelloWorldClient.java:42)
Do you know where I find the missing class???
Is there any classpath on the server I have to set???
 
Mathias Andrae
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, that helped.
But now I got that problem:
javax.naming.NamingException: Error during resolve [Root exception is java.lang.NullPointerException]
The jndi-name is correct.
Can anybody help???
 
Malli Raman
Ranch Hand
Posts: 312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Please check out jndi name in the EJB properties
option (right click the ejb name)By Default for WAS3.5 the jndi name be in the following format
com/titan/ship/SHIP for SHIP Bean.
Regards,
M.S.Raman.
 
Mathias Andrae
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks, but thats not the problem.
The jndi-name is correct.
Is there any setting I forgot at the client.
Can anybody give me an overview of what is to do at the client to enable access to an ejb-server.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic