1 Reply Latest reply on Oct 17, 2017 6:57 AM by Jochen Buchholz

    Cannot deploy a message driven bean that  connect to an inbound resource adapter

    Jochen Buchholz Newbie

      After big deployment problems with my current resource adapter (RA) project at work, I started a simple inbound resource adapter example project on github and run in the same problems. The simple RA acts as a tcp server and could be connected with telnet on a special port. The typed messages should be sended to a MDB. So far so good, in short - the deployment and the resource adapter works, but I cant deploy an MDB in a second project to receive the messages. The inbound RA listen at the tcp port and I cand send messages vie telnet to it. But when I try to deploy a MDB in an ear archive I got the following error:

       

      2017-10-06 14:39:35,152 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) WFLYSRV0027: Starting deployment of "ra-ear.ear" (runtime-name: "ra-ear.ear")
      2017-10-06 14:39:35,182 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-6) WFLYSRV0207: Starting subdeployment (runtime-name: "ra-user-web-0.0.1-SNAPSHOT.war")
      2017-10-06 14:39:35,182 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) WFLYSRV0207: Starting subdeployment (runtime-name: "ra-user-ejb-0.0.1-SNAPSHOT.jar")
      2017-10-06 14:39:35,351 WARN  [org.jboss.modules] (MSC service thread 1-7) Failed to define class de.bitc.ejb.InboundEventHandler in Module "deployment.ra-ear.ear.ra-user-ejb-0.0.1-SNAPSHOT.jar:main" from Service Module Loader: java.lang.NoClassDefFoundError: Failed to link de/bitc/ejb/InboundEventHandler (Module "deployment.ra-ear.ear.ra-user-ejb-0.0.1-SNAPSHOT.jar:main" from Service Module Loader): de/bitc/jca/inflow/TcpMessageListener
              at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
              at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
              at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
              at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
              at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:446)
              at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:274)
              at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:78)
              at org.jboss.modules.Module.loadModuleClass(Module.java:606)
              at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
              at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)
              at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)
              at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)
              at java.lang.Class.forName0(Native Method)
              at java.lang.Class.forName(Class.java:348)
              at org.jboss.as.ee.utils.ClassLoadingUtils.loadClass(ClassLoadingUtils.java:21)
              at org.jboss.as.ee.utils.ClassLoadingUtils.loadClass(ClassLoadingUtils.java:14)
              at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:84)
              at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:76)
              at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:147)
              at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
              at java.lang.Thread.run(Thread.java:748)
      
      2017-10-06 14:39:35,351 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC000001: Failed to start service jboss.deployment.subunit."ra-ear.ear"."ra-user-ejb-0.0.1-SNAPSHOT.jar".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.subunit."ra-ear.ear"."ra-user-ejb-0.0.1-SNAPSHOT.jar".POST_MODULE: WFLYSRV0153: Failed to process phase POST_MODULE of subdeployment "ra-user-ejb-0.0.1-SNAPSHOT.jar" of deployment "ra-ear.ear"
              at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:154)
              at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
              at java.lang.Thread.run(Thread.java:748)
      Caused by: java.lang.NoClassDefFoundError: Failed to link de/bitc/ejb/InboundEventHandler (Module "deployment.ra-ear.ear.ra-user-ejb-0.0.1-SNAPSHOT.jar:main" from Service Module Loader): de/bitc/jca/inflow/TcpMessageListener
              at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
              at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
              at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
              at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
              at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:446)
              at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:274)
              at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:78)
              at org.jboss.modules.Module.loadModuleClass(Module.java:606)
              at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
              at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)
              at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)
              at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)
              at java.lang.Class.forName0(Native Method)
              at java.lang.Class.forName(Class.java:348)
              at org.jboss.as.ee.utils.ClassLoadingUtils.loadClass(ClassLoadingUtils.java:21)
              at org.jboss.as.ee.utils.ClassLoadingUtils.loadClass(ClassLoadingUtils.java:14)
              at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:84)
              at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:76)
              at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:147)
              ... 5 more
      
      2017-10-06 14:39:35,364 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 17) WFLYCTL0013: Operation ("add") failed - address: ([("deployment" => "ra-ear.ear")]) - failure description: {
          "WFLYCTL0080: Failed services" => {"jboss.deployment.subunit.\"ra-ear.ear\".\"ra-user-ejb-0.0.1-SNAPSHOT.jar\".POST_MODULE" => "org.jboss.msc.service.StartException in service jboss.deployment.subunit.\"ra-ear.ear\".\"ra-user-ejb-0.0.1-SNAPSHOT.jar\".POST_MODULE: WFLYSRV0153: Failed to process phase POST_MODULE of subdeployment \"ra-user-ejb-0.0.1-SNAPSHOT.jar\" of deployment \"ra-ear.ear\"
          Caused by: java.lang.NoClassDefFoundError: Failed to link de/bitc/ejb/InboundEventHandler (Module \"deployment.ra-ear.ear.ra-user-ejb-0.0.1-SNAPSHOT.jar:main\" from Service Module Loader): de/bitc/jca/inflow/TcpMessageListener"},
          "WFLYCTL0412: Required services that are not installed:" => ["jboss.deployment.subunit.\"ra-ear.ear\".\"ra-user-ejb-0.0.1-SNAPSHOT.jar\".POST_MODULE"],
          "WFLYCTL0180: Services with missing/unavailable dependencies" => undefined
      }
      2017-10-06 14:39:35,365 ERROR [org.jboss.as.server] (management-handler-thread - 17) WFLYSRV0021: Deploy of deployment "ra-ear.ear" was rolled back with the following failure message: 
      {
          "WFLYCTL0080: Failed services" => {"jboss.deployment.subunit.\"ra-ear.ear\".\"ra-user-ejb-0.0.1-SNAPSHOT.jar\".POST_MODULE" => "org.jboss.msc.service.StartException in service jboss.deployment.subunit.\"ra-ear.ear\".\"ra-user-ejb-0.0.1-SNAPSHOT.jar\".POST_MODULE: WFLYSRV0153: Failed to process phase POST_MODULE of subdeployment \"ra-user-ejb-0.0.1-SNAPSHOT.jar\" of deployment \"ra-ear.ear\"
          Caused by: java.lang.NoClassDefFoundError: Failed to link de/bitc/ejb/InboundEventHandler (Module \"deployment.ra-ear.ear.ra-user-ejb-0.0.1-SNAPSHOT.jar:main\" from Service Module Loader): de/bitc/jca/inflow/TcpMessageListener"},
          "WFLYCTL0412: Required services that are not installed:" => ["jboss.deployment.subunit.\"ra-ear.ear\".\"ra-user-ejb-0.0.1-SNAPSHOT.jar\".POST_MODULE"],
          "WFLYCTL0180: Services with missing/unavailable dependencies" => undefined
      }
      

      I use the standallone-full.xml config in wildfly 10.1.0 and tried so much things. I changed to change the scope of the RA from provided to compile, to put the RA archive into the ejb package, but then I got

       

      [ERROR] Caused by: java.lang.IllegalStateException: WFLYEJB0383: No message listener of type de.bitc.jca.inflow.TcpMessageListener found in resource adapter tcp-eis.rar"},
        "WFLYCTL0412: Required services that are not installed:" => ["jboss.deployment.subunit.\"ra-ear.ear\".\"ra-user-ejb-0.0.1-SNAPSHOT.jar \".component.InboundEventHandler.CREATE"],
        "WFLYCTL0180: Services with missing/unavailable dependencies" => undefined}}}
      

      The problem is the TcpMessageListener interface in the RA, that the MDB implements. I putted the TcpMessageListener into the ra.xml and also into the @Activation annotation in the ActivationSpec. I don't know whats wrong. Here is the configuration of the deployed resource adapter in the jboss_cli:

      /subsystem=resource-adapters/resource-adapter=tcp-eis.rar:read-resource(recursive=true)
      {
          "outcome" => "success",
          "result" => {
              "archive" => "tcp-eis.rar",
              "beanvalidationgroups" => undefined,
              "bootstrap-context" => undefined,
              "config-properties" => undefined,
              "module" => undefined,
              "statistics-enabled" => false,
              "transaction-support" => "XATransaction",
              "wm-security" => false,
              "wm-security-default-groups" => undefined,
              "wm-security-default-principal" => undefined,
              "wm-security-domain" => "other",
              "wm-security-mapping-groups" => undefined,
              "wm-security-mapping-required" => false,
              "wm-security-mapping-users" => undefined,
              "admin-objects" => undefined,
              "connection-definitions" => undefined
          }
      }
      
      

      I described all steps of deployment and how I generated parts of the resource adapter with the Ironjackamar codegenerator in the README.md on the frontpage of the above linked github project. Also how to build, the structure and the deployment. Should I need to define a queue ore something. are there are adittional definitions with jndi? I found only descriptions of jndi definitions for outbound resource adapter, but nothing for inbound. Thanks in advance.

        • 1. Re: Cannot deploy a message driven bean that  connect to an inbound resource adapter
          Jochen Buchholz Newbie

          The inbound resource adapter runs now embedded in a ear archive as subdeployment. Its available via the upper github link with install instructions.

           

          The problem was a dependency in the ear archive to the resource adapter jar. This was also the reason to get the same error when I deploy the resource adapter inside the ear. If the resource adapter is deployed as a subdeploment module in the ear, the ear archive only needs a dependency to the rar archive and not to the embedded jar. The NoClassDefFoundException changed to a ClassNotFoundException. The cause was a wrong deployment order of the subdeloyments, the ear archive was deployed before the rar. So I got a ClassNotFoundException. I solve this by putting the rar module definition before the ejb module and add a jboss-deployment-structure descriptor, to define that the ejb subdeploment depends on the rar deployment in the ear archive.

          <?xml version="1.0" encoding="UTF-8"?>  
          <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">  
              <ear-subdeployments-isolated>false</ear-subdeployments-isolated>  
              <sub-deployment name="ra-user-ejb.jar">  
                  <dependencies>  
                      <module name="deployment.ra-ear.ear.tcp-eis.rar"  export="true" />  
                  </dependencies>  
              </sub-deployment>  
          </jboss-deployment-structure>
          

           

          After the first run, I cleaned up the project and this anwer my biggest questions about inbound resource adapter:

          • The ra.xml descriptor is not needed, the @Connector annotation in the RA class is enough.
          • There is no additional configuration in WF10 needed. No queues, standallone-full.xml modification or jndi stuff. A simple deploy with the wildfly-maven-plugin works.
          • The now working resource adapter is not showing up as resource adapter in WF10. This confuses me and make my research very difficult.
          • The jboss-ejb3.xml descriptor is not needed. The @ResourceAdapter(value="ra-ear.ear#tcp-eis.rar") is enough. Take care, this is a jboss annotation, not an ee7. So you not find any resources in case of eg. websphere or tomee.

          Hope this helps others