directory-api mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paulo Oliveira <paulo.nascime...@ua.pt>
Subject [LDAP-API] LdapNetworkConnection ClassNotFoundException
Date Mon, 26 Nov 2012 17:52:18 GMT
Hello,

I am developing a Web Application with Maven+JavaEE, and needed to make some queries to an
LDAP server, I have found Apache LDAP API and seems to be the best library and work with LDAP
very well.

After creating the Maven project, and add the dependency for Apache LDAP API, added a JSP
and Servlet, when I run the application through a <form> in JSP, an exception is thrown
in the console of Tomcat.

Exception:
>java.lang.ClassNotFoundException: org.apache.directory.ldap.client.api.LdapNetworkConnection
>    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)
>    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
>    at org.ldap-project.OperationServlet.doPost(OperationServlet.java:41)
>    at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
>    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
>    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
>    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
>    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
>    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
>    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
>    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
>    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
>    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
>    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
>    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
>    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250)
>    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
>    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
>    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
>    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
>    at java.lang.Thread.run(Thread.java:722)

Maven pom.xml:
> ...
> <dependency>
>     <groupId>org.apache.directory.shared</groupId>
>     <artifactId>shared-all</artifactId>
>     <version>1.0.0-M12</version>
>     <scope>runtime</scope>
> </dependency>
> ...

HTML (JSP):
>    <form action="OperationServlet" method="post">
>        <table>
>            <tr>
>                <td>option: </td><td><input type="text" name="option"/></td>
>            </tr>
>            <tr>
>                <td colspan="2"><input type="submit"/></td>
>            </tr>
>        </table>
>    </form>

Java Code:
>    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {
>        // TODO Auto-generated method stub
>        LdapConnection connection = new LdapNetworkConnection("localhost", 636, true);
>        connection.close();
>
>        RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/login.jsp");
>        dispatcher.forward(request, response);
>    }
NOTE: Error occurs on line that it's "connection" variable is declared.

I have used the same code on a "offline" java project (again with Maven), and this exception
didn't occur in any instance of application. I suspect that problem could be on JavaEE.

Any suggestion to solve this problem?

Thank you in advance.
Regards,
Paulo Oliveira

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message