I have a problem with an application client that I want to put in a self-contained JAR file, so it can be executed on any machine without having to install additional software or libraries.
What I get is this:
java.lang.Exception: javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]
at vodafonemalta.directory.client.DirectoryClient.sessionOpen(DirectoryClient.java:70)
at vodafonemalta.directory.client.DirectoryClient.main(DirectoryClient.java:178)
Caused by: javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:652)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
at javax.naming.InitialContext.init(InitialContext.java:219)
at javax.naming.InitialContext.(InitialContext.java:175)
at vodafonemalta.directory.client.DirectoryClient.sessionOpen(DirectoryClient.java:61)
... 1 more
This is the jndi.properties file, which I included in the 'Class-Path' field of the MANIFEST.MF file:
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.provider.url=jnp://phobos/
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
jnp.socketFactory=org.jnp.interfaces.TimedSocketFactory
jnp.timeout=0
jnp.sotimeout=0
These are the JBoss JAR files that I included in the application client's JAR file, and which are also included in the 'Class-Path' field of the manifest, as mentioned above:
jbossall-client.jar
jbossjmx-ant.jar
jnp-client.jar
log4j.jar
It seems to me that I have everything covered, yet it complains that it can't locate the NamingContextFactory class. Is it something obvious that I'm overlooking?
Thanks,
- Peter