14 Replies Latest reply on Jul 26, 2017 5:49 PM by rsoika

    Wildfly 10 - How to setup JCA connector to work with a Session EJB

    rsoika

      Hi I need some help how to setup a JCA connector in Wildfly 10.

      I try to implement a JCA connector for Hadoop. The deployment of the connector seems to be ok. I can see the connector in the web admin console and I used the following configuration in my standalone.xml:

       

              <subsystem xmlns="urn:jboss:domain:resource-adapters:4.0">
              <resource-adapters>
               <resource-adapter id="imixs.hadoop">
                   <archive>
                      imixs-archive-hadoop-jca-1.0.0-SNAPSHOT.rar
                   </archive>
                   <transaction-support>LocalTransaction</transaction-support>
                   <connection-definitions>
                       <connection-definition class-name="org.imixs.workflow.archive.hadoop.jca.spi.HadoopManagedConnection"
                                              jndi-name="java:/jca/HadoopFactory" enabled="true" use-java-context="false"
                                              pool-name="java:/jca/HadoopFactory">
                          
                       </connection-definition>
                       <connection-definition class-name="org.imixs.workflow.archive.hadoop.jca.spi.HadoopManagedConnection"
                                              jndi-name="java:/jca/HadoopFactory2" enabled="true" use-java-context="true"
                                              pool-name="HadoopFactory2">
                          
                       </connection-definition>
                   </connection-definitions>
               </resource-adapter>
          </resource-adapters>
           </subsystem>
      

       

      My problem is that I can't figure out how to inject the resource into my Stateless Session EJB.

       

      @Stateless
      @LocalBean
      @RunAs("org.imixs.ACCESSLEVEL.MANAGERACCESS")
      public class HadoopService {
      
      
        @Resource(mappedName = "jca/HadoopFactory")
        private DataSource dataSource;
      
      
        @Resource
        private SessionContext context;
      
      
        //....
      }
      

       

      During deployment I got the following exception:

       

      imixs-archive-office_1    | 09:21:20,732 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 1) WFLYSRV0010: Deployed "imixs-office-workflow-ear-3.0.5-SNAPSHOT.ear" (runtime-name : "imixs-office-workflow-ear-3.0.5-SNAPSHOT.ear")
      imixs-archive-office_1    | 09:21:20,734 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 1) WFLYCTL0183: Service status report
      imixs-archive-office_1    | WFLYCTL0184:    New missing/unsatisfied dependencies:
      imixs-archive-office_1    |       service jboss.naming.context.java.jca.HadoopFactory (missing) dependents: [service jboss.naming.context.java.comp.imixs-office-workflow."imixs-office-workflow-ejb-3.0.5-SNAPSHOT".HadoopService.env.jca.HadoopFactory] 
      

       

       

      To me it looks like I do something wrong with the JNDI names (which is one of the biggest mystery of Java EE)

      I tried also to setup  a  resource ref via the ejb-jar..xml file.

       

      <session>
        <ejb-name>HadoopService</ejb-name>
        <ejb-class>org.imixs.workflow.archive.hadoop.HadoopService</ejb-class>
        <session-type>Stateless</session-type>
      
        <resource-ref>
         <res-ref-name>jca/HadoopFactory</res-ref-name>
         <res-type>javax.resource.cci.ConnectionFactory</res-type>
         <res-auth>Container</res-auth>
         <res-sharing-scope>Shareable</res-sharing-scope>
         <mapped-name>java:/jca/HadoopFactory</mapped-name>
        </resource-ref>
        </session>
      

       

      But this all did not work.

      Can anybody help how to fit the things together? It seems to be impossible to find a example for Wildfly 10 and JCA

       

      Thanks for any help

        • 1. Re: Wildfly 10 - How to setup JCA connector to work with a Session EJB
          jaikiran

          @Resource(mappedName = "jca/HadoopFactory"

          private DataSource dataSource; 

           

          That should be:

           

          @Resource(lookup="java:/jca/HadoopFactory")
          private DataSource dataSource;
          

           

          P.S: You can use mappedName attribute too, but that's not a portable attribute, across application servers, whereas lookup attribute is. In WildFly though both lookup attribute and mappedName play the same role.

          • 2. Re: Wildfly 10 - How to setup JCA connector to work with a Session EJB
            rsoika

            Thanks for your fast reply. I tried this name 'java:/jca/HadoopFactory" several times. Maybe my implementation was wrong in another aspect :-/

            Now I found this Tutorial:

            http://www.mastertheboss.com/jboss-frameworks/ironjacamar/create-your-first-jca-connector-tutorial

             

            This tutorial don't need a rar.xml file and it seems to work. So I try now to implement it in this way. But JCA is really hard stuff because it's so little documented.

            • 3. Re: Wildfly 10 - How to setup JCA connector to work with a Session EJB
              jaikiran

              In your subsystem configuration you have:

               

              jndi-name="java:/jca/HadoopFactory" enabled="true" use-java-context="false" 

               

              Can you change that to use-java-context=true and try out the @Resource annotation that I suggested previously? If that doesn't work too, can you paste the entire exception stacktrace?

              • 4. Re: Wildfly 10 - How to setup JCA connector to work with a Session EJB
                rsoika

                I am now in phase where I am deeply frustrated.

                Since more than 2 days I try to install a Hello World JCA module

                 

                I have two scenarios for testing:

                 

                1)

                I deploy the rar file (without errors)

                then I try to link the rar to my WAR file

                I got the exception:

                 

                org.jboss.modules.ModuleNotFoundException: imixs-archive-hadoop-jca-1.0.0-SNAPSHOT.rar:main
                

                 

                "jboss-deployment-structure.xml" file located  in /WEB-INF/

                <jboss-deployment-structure>
                  <deployment>
                    <dependencies>
                      <module name="imixs-archive-hadoop-jca-1.0.0-SNAPSHOT.rar" />
                    </dependencies>
                  </deployment>
                </jboss-deployment-structure>
                

                 

                2)

                 

                In scenario 2 wildfly tells me that my service is missing:

                I deploy the rar file (without errors)

                I put the jca file (With my classes) directly into the EAR/lib directory, so my application is aware of the class files.

                But than I go error:

                 

                WFLYCTL0184:    New missing/unsatisfied dependencies:
                imixs-archive-office_1    |       service jboss.naming.context.java.eis.HelloWorld (missing) dependents: [service jboss.naming.context.java.module.imixs-office-workflow."imixs-office-workflow-web-3.0.5-SNAPSHOT".env."org.imixs.workflow.archive.hadoop.HadoopService".connectionFactory] 
                

                 

                 

                All this is a poke in the fog. Because I can't seem to check the status of the module.

                My jca module is from this tutorial: HelloWorld Resource Adapter tutorial

                 

                What I ask myself is: should not be the jca module deployed in wildfly like a Database module in the path /t/wildfly/modules/ with a modul.xml ?

                • 5. Re: Wildfly 10 - How to setup JCA connector to work with a Session EJB
                  rsoika

                  Hi jaikiran, yes I tried also the option use-java-context="true" 

                   

                  Maybe I did something completely wrong with my deployment. Like from the Tutorial HelloWorld Resource Adapter tutorial

                  it seems that a ra.xml file is not necessary. Is it sufficient to drop the rar file into the /standalone/deployments/ folder or to deploy it via the web-console? Or should I follow another approach to deploy a rar? Would It not do more sense to install a "module" in the wildfly/module path (like I can do with eclipse-link , or a Database Module ) ?

                   

                  The only other example I have is from Adam Bien

                  A Simple Transactional File JCA 1.5 Connector (4 Classes / 2 Reusable) : Adam Bien's Weblog

                  java_ee_patterns_and_best_practices/GenericJCA at master · dlee0113/java_ee_patterns_and_best_practices · GitHub

                   

                  He is using a ra.xml (which was my first approach) but the tutorial seems to be outdated, so I feared it is not compatible with wildfly 10

                  • 6. Re: Wildfly 10 - How to setup JCA connector to work with a Session EJB
                    rsoika
                    • 7. Re: Wildfly 10 - How to setup JCA connector to work with a Session EJB
                      rsoika

                      Just to illustrate more:

                      I have deployed a rar module named 'imixs-archive-hadoop-jca-1.0.0-SNAPSHOT.rar

                       

                      imixs-office_99(234).png

                       

                      And I try to make this module visible to my EAR/WAR module with a jboss-deployment-structure.xml file:

                      <jboss-deployment-structure>
                        <deployment>
                        <dependencies>
                        <module name="deployment.imixs-archive-hadoop-jca-1.0.0-SNAPSHOT.rar" />
                        </dependencies>
                        <resources>
                        <resource-root
                        path="deployment.imixs-archive-hadoop-jca-1.0.0-SNAPSHOT.rar" />
                        </resources>
                        </deployment>
                      </jboss-deployment-structure>
                      

                       

                      But this does not work. The classes, which are part of my rar module are not visible to my application.
                      I try to write a dummy-controller bean:

                       

                      package com.imixs.workflow.office.web;
                      
                      
                      import java.io.Serializable;
                      import java.util.logging.Logger;
                      import javax.enterprise.context.RequestScoped;
                      import javax.inject.Named;
                      
                      
                      import org.imixs.workflow.archive.hadoop.jca.HelloWorldConnectionFactory;
                      
                      
                      @Named
                      @RequestScoped
                      public class HaddopDummyController implements Serializable {
                        private HelloWorldConnectionFactory connectionFactory;
                        private static final long serialVersionUID = 1L;
                      
                      
                      
                        public String getStatus()  {
                        return " success";
                        }
                      }
                      

                       

                      But this s not work. Because of the member variable 'HelloWorldConnectionFactory' which is part of my rar the bean is not available.

                       

                      And as far as I understand mus construct a kind of dependency form my war module to the rar module?

                      When I package the rar module into my EAR things become much worther. So I believe package a rar module into a EAR is not allowed.....

                      • 8. Re: Wildfly 10 - How to setup JCA connector to work with a Session EJB
                        lafr

                        Some comments from my side: we are using a 3rd party resource adapter Maven Repository: net.java.xadisk » xadisk » 1.2.2  and also one build by our own.

                        A ra.xml file is not needed.

                         

                        Unfortunately I could not build your rar file.

                        [INFO] ------------------------------------------------------------------------
                        [INFO] BUILD FAILURE
                        [INFO] ------------------------------------------------------------------------
                        [INFO] Total time: 11.596 s
                        [INFO] Finished at: 2017-07-23T15:45:06+02:00
                        [INFO] Final Memory: 13M/168M
                        [INFO] ------------------------------------------------------------------------
                        [ERROR] Failed to execute goal on project imixs-archive-hadoop-jca: Could not resolve dependencies for project org.imixs.workflow:imixs-archive-hadoop-jca:jar:1.0.0-SNAPSHOT: The following artifacts could not be resolved: org.imixs.workflow:imixs-workflow-core:jar:4.1.4-SNAPSHOT, org.imixs.workflow:imixs-workflow-engine:jar:4.1.4-SNAPSHOT: Could not find artifact org.imixs.workflow:imixs-workflow-core:jar:4.1.4-SNAPSHOT -> [Help 1]
                        [ERROR]
                        
                        

                         

                        The last version of your jboss-deployment-structure looks quite good. Just remove the resources section. It is not necessary.

                         

                        JBoss / Wildfly WebConsole offers a JNDI-View to lookup the JNDI name of your module.

                        At least your sources contain a ironjacamar.xml file where you define a different jndi name. Try without this file first.

                         

                        And for the client app: don't use the ejb-jar.xml.

                        • 9. Re: Wildfly 10 - How to setup JCA connector to work with a Session EJB
                          rsoika

                          Thanks for your replies.

                          Ok I will pick it up again and try it again. The hint with the jndi-viewer is very valuable. I didn't know there was this feature.

                          I can see my resource:

                           

                          imixs-office_99(235).png

                           

                          No I will first fix my public imixs-archive-hadoop-jca module so you can build it.

                           

                          Why do you think I should not use the ejb-jar.xml? This file is very important for my target application because it consists of a many additional modules (imixs-workflow)

                          • 10. Re: Wildfly 10 - How to setup JCA connector to work with a Session EJB
                            rsoika

                            Ok now I also fixed my maven project setup

                             

                            imixs-archive/imixs-archive-hadoop-jca at master · imixs/imixs-archive · GitHub

                             

                            The build process is now working correctly.

                            When the .rar file is deployed than I can see the corresponding JNDI resource

                             

                            java:/jca/org.imixs.workflow.hadoop

                             

                            So I assume that the deployment issues of my rar module are now sorted out and I will now concentrate on connecting to this resource from a client.......

                            • 11. Re: Wildfly 10 - How to setup JCA connector to work with a Session EJB
                              rsoika

                              I finally succeeded to test the JCA Adapter successful with this simple WebServlet!

                               

                              imixs-archive/JCATestServlet.java at master · imixs/imixs-archive · GitHub

                               

                              This code runs when I deploy the test servlet it in a standalone web module with nothing else :-)

                              So I now know, that the rar module is ok.

                               

                              Next I tried to add the same servlet into my EAR/WAR Application. Deployment works, but when I call the Servlet I got the following

                              exception:

                               

                              imixs-archive-office_1    | 21:17:41,584 ERROR [io.undertow.request] (default task-12) UT005023: Exception handling request to /office/JCATest: javax.servlet.ServletException: UT010013: Could not instantiate org.imixs.test.JCATestServlet
                              imixs-archive-office_1    | at io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:247)
                              imixs-archive-office_1    | at io.undertow.servlet.core.ManagedServlet.getServlet(ManagedServlet.java:171)
                              imixs-archive-office_1    | at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:84)
                              imixs-archive-office_1    | at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
                              imixs-archive-office_1    | at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
                              imixs-archive-office_1    | at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
                              imixs-archive-office_1    | at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
                              imixs-archive-office_1    | at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
                              imixs-archive-office_1    | at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
                              imixs-archive-office_1    | at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
                              imixs-archive-office_1    | at io.undertow.security.handlers.AuthenticationConstraintHandler.handleRequest(AuthenticationConstraintHandler.java:53)
                              imixs-archive-office_1    | at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
                              imixs-archive-office_1    | at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
                              imixs-archive-office_1    | at io.undertow.servlet.handlers.security.ServletSecurityConstraintHandler.handleRequest(ServletSecurityConstraintHandler.java:59)
                              imixs-archive-office_1    | at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
                              imixs-archive-office_1    | at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
                              imixs-archive-office_1    | at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
                              imixs-archive-office_1    | at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
                              imixs-archive-office_1    | at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
                              imixs-archive-office_1    | at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
                              imixs-archive-office_1    | at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
                              imixs-archive-office_1    | at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
                              imixs-archive-office_1    | at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292)
                              imixs-archive-office_1    | at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)
                              imixs-archive-office_1    | at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)
                              imixs-archive-office_1    | at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
                              imixs-archive-office_1    | at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
                              imixs-archive-office_1    | at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
                              imixs-archive-office_1    | at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
                              imixs-archive-office_1    | at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
                              imixs-archive-office_1    | at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
                              imixs-archive-office_1    | at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
                              imixs-archive-office_1    | at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
                              imixs-archive-office_1    | at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
                              imixs-archive-office_1    | at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)
                              imixs-archive-office_1    | at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
                              imixs-archive-office_1    | at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104)
                              imixs-archive-office_1    | at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)
                              imixs-archive-office_1    | at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:805)
                              imixs-archive-office_1    | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
                              imixs-archive-office_1    | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
                              imixs-archive-office_1    | at java.lang.Thread.run(Thread.java:745)
                              imixs-archive-office_1    | Caused by: java.lang.IllegalStateException: WFLYEE0042: Failed to construct component instance
                              imixs-archive-office_1    | at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:163)
                              imixs-archive-office_1    | at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:134)
                              imixs-archive-office_1    | at org.jboss.as.ee.component.BasicComponent.createInstance(BasicComponent.java:88)
                              imixs-archive-office_1    | at org.jboss.as.ee.component.ComponentRegistry$ComponentManagedReferenceFactory.getReference(ComponentRegistry.java:149)
                              imixs-archive-office_1    | at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$6.createInstance(UndertowDeploymentInfoService.java:1379)
                              imixs-archive-office_1    | at io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:245)
                              imixs-archive-office_1    | ... 41 more
                              imixs-archive-office_1    | Caused by: java.lang.IllegalArgumentException: Can not set org.imixs.workflow.archive.hadoop.jca.HelloWorldConnectionFactory field org.imixs.test.JCATestServlet.connectionFactory to org.imixs.workflow.archive.hadoop.jca.HelloWorldConnectionFactoryImpl
                              imixs-archive-office_1    | at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167)
                              imixs-archive-office_1    | at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171)
                              imixs-archive-office_1    | at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:81)
                              imixs-archive-office_1    | at java.lang.reflect.Field.set(Field.java:764)
                              imixs-archive-office_1    | at org.jboss.as.ee.component.ManagedReferenceFieldInjectionInterceptorFactory$ManagedReferenceFieldInjectionInterceptor.processInvocation(ManagedReferenceFieldInjectionInterceptorFactory.java:106)
                              imixs-archive-office_1    | at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                              imixs-archive-office_1    | at org.jboss.as.ee.component.AroundConstructInterceptorFactory$1.processInvocation(AroundConstructInterceptorFactory.java:28)
                              imixs-archive-office_1    | at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                              imixs-archive-office_1    | at org.jboss.as.weld.injection.WeldInterceptorInjectionInterceptor.processInvocation(WeldInterceptorInjectionInterceptor.java:56)
                              imixs-archive-office_1    | at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                              imixs-archive-office_1    | at org.jboss.as.weld.injection.WeldInjectionContextInterceptor.processInvocation(WeldInjectionContextInterceptor.java:43)
                              imixs-archive-office_1    | at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                              imixs-archive-office_1    | at org.jboss.as.ee.concurrent.ConcurrentContextInterceptor.processInvocation(ConcurrentContextInterceptor.java:45)
                              imixs-archive-office_1    | at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                              imixs-archive-office_1    | at org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:64)
                              imixs-archive-office_1    | at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                              imixs-archive-office_1    | at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:356)
                              imixs-archive-office_1    | at org.jboss.invocation.PrivilegedWithCombinerInterceptor.processInvocation(PrivilegedWithCombinerInterceptor.java:80)
                              imixs-archive-office_1    | at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                              imixs-archive-office_1    | at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
                              imixs-archive-office_1    | at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:161)
                              imixs-archive-office_1    | ... 46 more
                              imixs-archive-office_1    | 
                              

                               

                              This is a surprising exception, can anybody give me a hint what this could mean?

                              But I think I am approaching now the crux of my problem..

                              • 12. Re: Wildfly 10 - How to setup JCA connector to work with a Session EJB
                                rsoika

                                It looks like the missing attribute export="true" was the problem in my jboss-deployment-structure.xml file (which is located in the /META-INF/ folder of my ear):

                                 

                                <jboss-deployment-structure>
                                  <ear-subdeployments-isolated>false</ear-subdeployments-isolated>
                                  <deployment>
                                  <dependencies>
                                  <module name="deployment.imixs-archive-hadoop-jca-1.0.0-SNAPSHOT.rar"  export="true"/>
                                  </dependencies>
                                  </deployment>
                                </jboss-deployment-structure>
                                

                                 

                                But I must see if this is really the right solution... it looks promising...

                                I found a discussion concerning the attribute here:

                                 

                                [AS7-3203] Document how to use jboss-deployment-structure.xml to add dependencies for all modules - JBoss Issue Tracker

                                Class Loading issue when deploying Ear file.

                                • 13. Re: Wildfly 10 - How to setup JCA connector to work with a Session EJB
                                  rsoika

                                  Finally I succeeded with my test deployment.  So I try now to answer my own question:

                                   

                                  1) Examples:

                                  I found two examples which helped me to get started.

                                   

                                  WildFly 10 JCA Tutorial:

                                  http://www.mastertheboss.com/jboss-frameworks/ironjacamar/create-your-first-jca-connector-tutorial

                                  This tutoral shows how to implement a JCA Adapter without the need for an ra.xml file and no additional configuration in the standalone.xml. The adapter is deployed with the help of the 'ironjacamar' wich is part of Wildfly.

                                   

                                  Adam Biens 'Connectorz':

                                  https://github.com/AdamBien/connectorz

                                  This is a generic example of how a JCA connector could work with transaction support. Also this example needs no ra.xml file. To deploy the adapter the standalone.xml file must provide a corresponding configuration section.

                                   

                                  <subsystem xmlns="urn:jboss:domain:resource-adapters:4.0">
                                   <resource-adapters>
                                       <resource-adapter id="imixs-archive-hadoop-genericjca-1.0.0-SNAPSHOT.rar">
                                              <archive>
                                                  imixs-archive-hadoop-genericjca-1.0.0-SNAPSHOT.rar
                                              </archive>
                                              <transaction-support>LocalTransaction</transaction-support>
                                              <connection-definitions>
                                                  <connection-definition class-name="org.connectorz.files.store.GenericManagedConnectionFactory" jndi-name="java:/jca/bucket" enabled="true" use-java-context="true" pool-name="Bucket" use-ccm="true">
                                                      <config-property name="rootDirectory">
                                                          ./store/
                                                      </config-property>
                                                      <pool>
                                                          <min-pool-size>0</min-pool-size>
                                                          <max-pool-size>10</max-pool-size>
                                                          <prefill>false</prefill>
                                                          <use-strict-min>false</use-strict-min>
                                                          <flush-strategy>FailingConnectionOnly</flush-strategy>
                                                      </pool>
                                                      <security>
                                                          <application/>
                                                      </security>
                                                  </connection-definition>
                                              </connection-definitions>
                                          </resource-adapter>
                                      </resource-adapters>
                                  </subsystem>
                                  

                                   

                                  The advantage here is that the adapter shows more internal business logic. Also the configuration via the standalone.xml is more flexible (even if it is more deployment work)

                                   

                                  2) Deployment

                                  A JCA Adapter can be deployed as any other artifact. But the .jar File must be renamed into '.rar'! This file extension indicates the module as an JCA adapter! Otherwise the adapter will not work.

                                   

                                  3) The JDNI Name

                                  To verify if the deployment is correct, the Wildfly JNDI-View can be used from the Wildfly Web console to lookup the JNDI name of the module. Only when the JNDI name is there you can start with your client code...

                                   

                                  4) The client implementation

                                  The client code (e.g a Web module or a Ear Bundle) must not include the JCA Adapter code! For Maven projects this means that the dependecy of the corresponding maven artifacts have to be marked with scope 'provided'. This is important to avoid class loading conflicts.

                                   

                                  The adapter can than be injected into a servlet or a EJB with the corresponding JNDI name

                                   

                                  @Resource(mappedName = "java:/jca/bucket")
                                   BucketStore bucketStore;
                                  

                                   

                                  To make the adapter visible to the client application a wildfly specific deployment descriptor named 'jboss-deployment-structure.xml' is necessary.

                                  This descriptor can be placed into the /WEB-INF/ folder for single Web modules or into the /META-INF/ root-folder for Ear bundles.

                                   

                                  <jboss-deployment-structure>
                                    <ear-subdeployments-isolated>false</ear-subdeployments-isolated>
                                    <deployment>
                                    <dependencies>
                                    <module name="deployment.my-jca-module.rar"  export="true"/>
                                    </dependencies>
                                    </deployment>
                                  </jboss-deployment-structure>
                                  

                                   

                                  The attribute 'export="true"' is only(!) necessary for Ear bundles. And it is mandatory for Ear bundles.

                                  The 'jboss-deployment-structure' did the same, as the Java EE containers did with all the Database, Mail or JMS adapters. It simply adds the code into the application classpath.

                                   

                                  The next weeks I will continue my work on my hadoop jca adapter:  https://github.com/imixs/imixs-archive/tree/master/imixs-archive-hadoop-jca

                                  There I will provide hopefully additional information about implementation and deployment.

                                  • 14. Re: Wildfly 10 - How to setup JCA connector to work with a Session EJB
                                    rsoika

                                    One final note to that topic concerning Transaction Handling:

                                     

                                    I recognized, that if my JCA Connector set the TransactionSupport to:

                                     

                                    transactionSupport = TransactionSupport.TransactionSupportLevel.LocalTransaction
                                    

                                     

                                    this leads to an exception if I use this JCA Connector together with JPA:

                                     

                                    ARJUNA012140: Adding multiple last resources is disallowed. Trying to add LastResourceRecord.....
                                    

                                     

                                    This issue has to do with the fact, that in case more than one JCA resource adapters are used in one transaction, the adapters should/must support XAResouces.

                                    I can't figure out how to implement a JCA resource adapter as a XAResource.

                                    But the Transaction Support was the only reason why I started this project. My initial goal was to have a JCA Hadoop Adapter  which can participate in a complex transaction (initiated by a JPA entity update) , so that this JCA adapter can remove changes from hadoop if a Exception / Rollback occurs.

                                     

                                    Now I see that JCA Resource adapters seem to be much more complex as I expected.

                                    If anyone has an simple(!) example how a JPA XAResource Adapter should look like, please add this information to this thread.

                                     

                                    ===
                                    Ralph