When trying to run my applet, the following appears in my java console:
javax.naming.NoInitialContextException: Cannot instantiate class:
javax.naming.spi.InitialContextFactory. Root exception
is java.lang.ClassNotFoundException:
javax/naming/spi/InitialContextFactory
However, in my code I have
import javax.naming.*;
import javax.naming.directory.*;
import javax.naming.directory.InitialDirContext;
import javax.naming.directory.DirContext;
import javax.naming.spi.InitialContextFactory;
[snip]
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,"javax.naming.spi.InitialContext
Factory");
env.put(Context.PROVIDER_URL,"ldap://entrust.wisdom.siac.com:389");
DirContext ctx = new InitialDirContext(env);
and the class in question is in the jar file I have, with the directory
structure intact. Any ideas what I'm doing wrong?
Thanks.
--
Daniel Alex Finkelstein
New Technologies
Securities Industry Automation Corporation
http://www.siac.com
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
This property's value should be "com.sun.jndi.ldap.LdapCtxFactory",
and the corresponding JAR files must be in the browser's classpath
(download the LDAP service provider for JNDI).
>import javax.naming.directory.InitialDirContext;
>import javax.naming.directory.DirContext;
>import javax.naming.spi.InitialContextFactory;
You can omit these lines.
Scott Seligman
Java Software Engineering
Sun Microsystems
Done.
> Scott Seligman
> Java Software Engineering
> Sun Microsystems
>
I added an import line
import javax.naming.ldap.*;
And the java console now reports:
javax.naming.NoInitialContextException: Cannot instantiate class:
com.sun.jndi.ldap.LdapCtxFactory. Root exception is
java.lang.ClassNotFoundException: com/sun/jndi/ldap/LdapCtxFactory
The class is in the correct directory structure in the jar.