EJB exception while trying to start client

javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interf aces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: o rg.jnp.interfaces.NamingContextFactory] 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 Client_TestPortal.main(Client_TestPortal.java:54) Caused by: java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFac tory 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.ClassLoader.loadClassInternal(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) ... 5 more 
+4
source share
3 answers

This exception indicates that the InitialContext initialization failed for your Client_TestPortal application. Resaon is that it was not able to load the class org.jnp.interfaces.NamingContextFactory , which (I assume) is the default Java naming provider for your platform.

It looks like your required class JAR is missing from your classpath class. According to this findjar query, it can be one of the following:

 [LOCAL] jbossall-client.jar [LOCAL] jbossjmx-ant.jar [MAVEN2] jnpserver-3.2.3.jar [MAVEN2] jbossall-client-3.2.1.jar [MAVEN2] jbossall-client-3.2.3.jar [MAVEN2] jbossjmx-ant-3.2.3.jar [MAVEN2] jnp-client-3.2.1.jar [MAVEN2] jnp-client-4.0.2.jar 

... or something like that. Which (if any) of the above JARs is the most suitable, it is difficult to say.

+10
source

You did not provide sufficient information, such as the environment you are using, the application server, etc.

In any case, it looks like a JAR associated with JNDI, not in the classpath. If it is in place and still not working, then you may have missed the correct context information, so pass the JNDI information to the constuctor InitialContext.

+1
source

I had the same problem, but I found how to fix it. All you have to do is add the jbossall-client.jar library to your clients project and do it !!! You can find the file inside the client folder. e.g. jboss-6.1.0.Final_GPT \ client I used Jboss 6.1.0 You can also get help at this link https://community.oracle.com/thread/1157701?start=0

Hope this helps.

0
source

Source: https://habr.com/ru/post/1343119/


All Articles