Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ClassNotFoundException for org.jnp.interfaces.NamingContextFactory

 
Ananth Vasudevan
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ananth Vasudevan
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 98
Oracle Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try something like below.

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

Cheers,
Anandraj
http://weblogic-wonders.com
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic