[ 
https://issues.apache.org/jira/browse/DIRAPI-357?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17339743#comment-17339743
 ] 

Stefan Seelmann commented on DIRAPI-357:
----------------------------------------

[~patrickhub] Do you still have the problem? Can you provide steps to reproduce 
the problem?

I tested with the "JAX-RS WildFly bootable jar example" example 
(https://github.com/wildfly-extras/wildfly-jar-maven-plugin/tree/4.0.3.Final/examples/jaxrs)
 , added the "api-all" dependency and was able to sucessfully connect to an 
LDAP server, see diff below.

{noformat}
diff --git a/examples/jaxrs/pom.xml b/examples/jaxrs/pom.xml
index dc0573a..ebd5a3a 100644
--- a/examples/jaxrs/pom.xml
+++ b/examples/jaxrs/pom.xml
@@ -20,6 +20,11 @@
             <artifactId>jakarta.jakartaee-api</artifactId>
             <scope>provided</scope>
         </dependency>
+        <dependency>
+          <groupId>org.apache.directory.api</groupId>
+          <artifactId>api-all</artifactId>
+           <version>2.0.1</version>
+        </dependency>
     </dependencies>
 
     <build>
diff --git 
a/examples/jaxrs/src/main/java/org/wildfly/plugins/demo/jaxrs/HelloWorldEndpoint.java
 
b/examples/jaxrs/src/main/java/org/wildfly/plugins/demo/jaxrs/HelloWorldEndpoint.java
index fd97c46..7b5ef0f 100644
--- 
a/examples/jaxrs/src/main/java/org/wildfly/plugins/demo/jaxrs/HelloWorldEndpoint.java
+++ 
b/examples/jaxrs/src/main/java/org/wildfly/plugins/demo/jaxrs/HelloWorldEndpoint.java
@@ -5,13 +5,18 @@ import javax.ws.rs.Path;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.GET;
 import javax.ws.rs.Produces;
+import org.apache.directory.ldap.client.api.LdapConnection;
+import org.apache.directory.ldap.client.api.LdapNetworkConnection;
 
 
 @Path("/hello")
 public class HelloWorldEndpoint {
     @GET
     @Produces("text/plain")
-    public Response doGet() {
+    public Response doGet() throws Exception {
+        LdapConnection connection = new LdapNetworkConnection( "localhost", 
20389 );
+        connection.connect();
+        connection.bind( "cn=admin,dc=example,dc=org", "admin" );
         return Response.ok("Hello from WildFly bootable jar!").build();
     }
 }
{noformat}


> java.lang.NoClassDefFoundError: 
> org/apache/directory/ldap/client/api/LdapConnectionFactory
> ------------------------------------------------------------------------------------------
>
>                 Key: DIRAPI-357
>                 URL: https://issues.apache.org/jira/browse/DIRAPI-357
>             Project: Directory Client API
>          Issue Type: Bug
>    Affects Versions: 2.0.1
>         Environment: Java 11
>            Reporter: Patrick Hub
>            Priority: Blocker
>             Fix For: 2.0.2
>
>
> I am using Apache Ldap Client API to connect to remote OpenLDAP Server.
> I have add this dependency in my pom.xml file:
> <dependency><dependency>                           
>     <groupId>org.apache.directory.api</groupId>    
>      <artifactId>api-all</artifactId>    
>       <version>2.0.1</version>
> </dependency>
> But when I deploy the app as war file in wildfly Every work fine. I can 
> performed CRUD operations on OpenLDAP Server using Apache Ldap Client API.
> But when I try to deploy the app as jar file in wildfly, I get the following 
> error :
> Caused by: java.lang.NoClassDefFoundError: 
> org/apache/directory/ldap/client/api/LdapConnectionFactory
>  at java.base/java.lang.Class.getDeclaredFields0(Native Method)
>  at java.base/java.lang.Class.privateGetDeclaredFields(Class.java:3062)
>  at java.base/java.lang.Class.getDeclaredFields(Class.java:2249)
>  at 
> org.jboss.as.server@10.0.3.Final//org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:72)
>  at 
> org.jboss.as.server@10.0.3.Final//org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:70)
>  
> Please can someone help me ?
> Thank
>  
> But I have used 
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@directory.apache.org
For additional commands, e-mail: dev-h...@directory.apache.org

Reply via email to