I have a class IntLdap in which I have the following code:
Hashtable env = new Hashtable();
env.put(Context.PROVIDER_URL, SERVER);
env.put(Context.INITIAL_CONTEXT_FACTORY, FACTORY);
ctx = new InitialDirContext(env);
The public static variable SERVER contains the URL and PORT of
our LDAP-server; the public static variable FACTORY equals
"com.sun.jndi.ldap.LdapCtxFactory"
When I use this class in a console application, everything
works fine. THERE ARE NO ERROR IN THE CLASS IntLdap!
When I use the same class in a Servlet, I get the following
exception:
[Root exception is java.lang.ClassNotFoundException:
com.sun.jndi.ldap.LdapCtxFactory]javax.naming.NoInitialContextException:
Cannot instantiate class: com.sun.jndi.ldap.LdapCtxFactory
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at javax.naming.NamingException.<init>(NamingException.java:121)
at
javax.naming.NoInitialContextException.<init>(NoInitialContextException.java:65)
at
javax.naming.spi.NamingManager.getDefaultInitialContextFactory(NamingManager.java:792)
at
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:837)
at
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:220)
at javax.naming.InitialContext.init(InitialContext.java:196)
at javax.naming.InitialContext.<init>(InitialContext.java:179)
at
javax.naming.directory.InitialDirContext.<init>(InitialDirContext.java:80)
at be.ac.rug.veiligheid.IntLdap.<init>(IntLdap.java:60)
at Test.doGet(Test.java:68)
at javax.servlet.http.HttpServlet.service(Compiled Code)
at javax.servlet.http.HttpServlet.service(Compiled Code)
at org.apache.jserv.JServConnection.run(Compiled Code)
at java.lang.Thread.run(Compiled Code)
Remark1: the classpath of JSERV is the same as
the classpath I use to run my console application
Remark2: just to be sure I set all the permission of
the jndi/ldap/providerutil classes to 777.
Why doesn't this work???
--
-------------------------------------------------------------------
Bruno Lowagie Academisch Rekencentrum Universiteit Gent
Tel : 09/264.48.14 e-mail : [EMAIL PROTECTED]
-------------------------------------------------------------------
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html