Meaningless Drivel is fun!*
The moose likes JBoss/WildFly and the fly likes ClassNotFoundException for org.jnp.interfaces.NamingContextFactory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "ClassNotFoundException for org.jnp.interfaces.NamingContextFactory" Watch "ClassNotFoundException for org.jnp.interfaces.NamingContextFactory" New topic
Author

ClassNotFoundException for org.jnp.interfaces.NamingContextFactory

Ananth Vasudevan
Ranch Hand

Joined: Sep 30, 2010
Posts: 30
Hi All,

I'm sure this question has been asked before. I looked up some of the solutions provided and it didn't work for me yet.
I'm running JBoss 5.1 GA with JDK 1.6 on Linux. My application tries to ctrate an InitialContext() look up the JNDI name for some EJB's and fails with the exception as below:

I added the jbossall-client.jar to the manifest file class-path section of the jar file that contains the code to look up JNDI names. This jar is bundled inside an EAR file.




Stack Trace:




I have the jndi.properties file as below in the server/all/conf directory:




What am I missing?
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5779
    
    7

I added the jbossall-client.jar to the manifest file class-path section of the jar file that contains the code to look up JNDI names.

I don't think that this will work. The jbossall-client.jar file is a reference-only file. That is, all it contains is a list of references to the other JAR files in the client directory. Thus you could use it in the classpath, but not in a manifest. You will have to add the individual JARs that you need in your manifest, if that is waht you really want to do. The JBoss Tattletale tool can help you locate all the JARs on which your app depends.


JBoss In Action
Ananth Vasudevan
Ranch Hand

Joined: Sep 30, 2010
Posts: 30
Hi Peter,

I tried adding jnp-client.jar to the classpath. I believe it has the class org.jnp.interfaces.NamingContextFactory. Still it didn't make any difference.

Anything else, I should try?

Thanks,
Ananth
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5779
    
    7

You will need more than that, which is why I suggested using JBoss Tattletale. Otherwise you will have to track down one missing class error after the other. But hey, I did the same before Tattletale, so it is doable.

Still it didn't make any difference.

Are you sure you are getting the exact same CNFE?
Ananth Vasudevan
Ranch Hand

Joined: Sep 30, 2010
Posts: 30
Hi,

Yes, I'm getting the same exception, when looking up and creating InitialContext.
I used tattletale and saw the results.
The depends section shows the following classes (in addition to other classes that it depends on). I'm pasting only the relevant;
javax.naming.Context, javax.naming.InitialContext, javax.naming.NameNotFoundException, javax.naming.NamingException

javax.naming.* classes are present in the rt.jar (<JRE>/lib) and org.jnp.interfaces.NamingContextFactory is present in jnp-client.jar.

As the CNFE Exception points to the NamingContextFactory, I added Class-Path. Still didn't work. I saw that jnpserver.jar also has
org.jnp.interfaces.*. I tried adding Class-Path to that (after removing the class path for jnp-client). still didn't work.
Any other pointers are appreciated..
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5779
    
    7

Instead of adding things to the class-path in the manifest, let's first try to get things running by adding jars to the -cp on the command line. Also, post the full command line you are using. Once we have the command line with -cp working, we'll look at updating the manifest.
anandraj tadkal
Ranch Hand

Joined: Feb 22, 2011
Posts: 98

Try something like below.

java -cp "\jboss-5.1.0.GA\client\jboss-client.jar" TestClient

Cheers,
Anandraj
http://weblogic-wonders.com


Regards,
Anandraj
http://weblogic-wonders.com
Follow us on facebook:
https://www.facebook.com/weblogicwonders
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ClassNotFoundException for org.jnp.interfaces.NamingContextFactory
 
Similar Threads
Please help me to run a client
Problem running ejb client
Can't find SerialContextProvider - SOS!!!
how to test my ejb in jboss
error while running sample EJB client