-
1. Re: Problem setting InitialContext
fly2moon2 Jan 14, 2005 8:50 AM (in response to fly2moon2)Hi,
I've tried setting jndi.properties. But then it still comes up with the following ClassNotFoundException. Pls help!
Exception in thread "main" javax.naming.NoInitialContextException: Cannot instan
tiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lan
g.ClassNotFoundException: org.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.(Unknown Source)
at com.gc.client.TestClient.main(TestClient.java:35)
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 -
2. Re: Problem setting InitialContext
frito Jan 14, 2005 8:52 AM (in response to fly2moon2)You shouldn't skip the theory before implementing the book examples ;-)
The InitialContext needs some information about the naming service implementation used:java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory java.naming.provider.url=jnp://localhost:1099 java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
Set these properties as system properties or pass a Properties object as parameter when creating a new InitialContext(Properties). -
3. Re: Problem setting InitialContext
darranl Jan 14, 2005 9:31 AM (in response to fly2moon2)Your latest error is saying that the class specified can not be found so your jndi.properties file is being read.
Try changing your classpath, remove the jar 'server\default\lib\jboss-j2ee.jar' and add the jar 'client\jbossall-client.jar'