directory-api mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pierre-Arnaud Marcelot ...@marcelot.net>
Subject Re: [LDAP-API] LdapNetworkConnection ClassNotFoundException
Date Mon, 26 Nov 2012 18:03:57 GMT
On 26 nov. 2012, at 18:59, Kiran Ayyagari <kayyagari@apache.org> wrote:

> hmm this is weird, generally we have some issues with loading schema
> resources due to the classloader issues
> but never an issue with the classes in particular.
> 
> Can you try placing API jars in ext/lib folder of tomct (or whichever app
> server you are using) and try?

+1.

With scope set to "runtime" in your dependency, the library won't be integrated in the war
but needs to be available in the libs folder of your application server. 

Regards,
Pierre-Arnaud

> On Mon, Nov 26, 2012 at 11:22 PM, Paulo Oliveira <paulo.nascimento@ua.pt>wrote:
> 
>> 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
>> 
> 
> 
> 
> -- 
> Kiran Ayyagari
> http://keydap.com


Mime
View raw message