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.
I have the jndi.properties file as below in the server/all/conf directory:
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.
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?
Joined: Sep 30, 2010
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..
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.