7 Replies Latest reply on Nov 4, 2013 3:14 PM by Sheeraz Junejo

    jBoss EAP 6.1 EAR not able to find classes in RAR

    Sheeraz Junejo Newbie

      I am working with jBoss EAP 6.1 and deployed my Resource Adapter by simply putting it under deployments. Tested by simply deployed my .war file with jboss-deployment-structure under WEB-INF to make it dependent on the resource adapter. Everything works OK as I am able to access the Connection classes (so far so good).

       

      Now I want to do the same for my EAR deployment where I have two EJB's which needs the same classes (Connection classes) from this RAR. I have added following jboss-deployment-structure.xml under .ear/META-INF;

       

      <?xml version="1.0" encoding="UTF-8"?>
      <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">
        <!-- 
        jBoss 7 specific file to add dependency on tocfT24ra-ra.rar 
        so that we can access the RA classes.
        Note: This will save us efforts to deploy Resource Adapter
        as <global-module>
        -->
        <ear-subdeployments-isolated>false</ear-subdeployments-isolated>
        <sub-deployment name="tocfOFSmessage-ejb.jar">
        <dependencies>
        <module name="deployment.tocfT24ra-ra.rar" />
        </dependencies>
        </sub-deployment>
        <sub-deployment name="delivery-ejb.jar">
        <dependencies>
        <module name="deployment.tocfT24ra-ra.rar" />
        </dependencies>
        </sub-deployment>
      </jboss-deployment-structure>
      

       

      But I am getting following exception when my EJB tries to access a connection from my resource adapter pool;

       

      23:29:02,806 ERROR [org.jboss.as.ejb3.invocation] (Thread-1 (HornetQ-client-global-threads-1755072257)) JBAS014134: EJB Invocation failed on component
       OFSMessageMDB for method public abstract void javax.jms.MessageListener.onMessage(javax.jms.Message): javax.ejb.EJBException: java.lang.RuntimeExcept
      ion: java.lang.NoClassDefFoundError: com/temenos/tocf/t24ra/T24ConnectionFactory
              at org.jboss.as.ejb3.tx.BMTInterceptor.handleException(BMTInterceptor.java:80) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
              at org.jboss.as.ejb3.tx.EjbBMTInterceptor.checkStatelessDone(EjbBMTInterceptor.java:92) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-re
      dhat-8]
              at org.jboss.as.ejb3.tx.EjbBMTInterceptor.handleInvocation(EjbBMTInterceptor.java:107) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-red
      hat-8]
              at org.jboss.as.ejb3.tx.BMTInterceptor.processInvocation(BMTInterceptor.java:56) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
      
      
              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-
      2]
              at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Fina
      

       

      Not sure if I have missed anything?

       

      Note: I have looked at this thread for reference How do I make RAR classes visible to separate EAR modules? JBoss 7.1.1.Final, IronJacamar 1.0.16.Final, JDK 6 but in my case I do not have any jboss-deployment-structure.xml inside .rar, is it mandatory?

       

      Thanks

        • 1. Re: jBoss EAP 6.1 EAR not able to find classes in RAR
          Philippe Marschall Expert

          I don't know why this isn't working but IMHO this is a specification violation. If you check the Java EE 6 Platform Specifiaction (JSR-316) it ways:

           

           

           

          EE.8.3.2 EJB Container Class Loading Requirements

          Components in the EJB container must have access to the following classes and resources.

           


           

           

          • The contents of all jar files included in any resource adapter archives (rar files) included in the same ear file.

           

          • The contents of all jar files included in each resource adapter archive (rar file) deployed separately to the application server, if that resource adapter is used to satisfy any resource references in the module.

           

           

           

          1 of 1 people found this helpful
          • 2. Re: jBoss EAP 6.1 EAR not able to find classes in RAR
            Sheeraz Junejo Newbie

            Thanks very Phillipe much for the clarification and lets see what is jboss guru's can come up with?

            • 3. Re: jBoss EAP 6.1 EAR not able to find classes in RAR
              Sheeraz Junejo Newbie

              Now I am facing another unusual problem i.e. when I deploy my ear with above jboss-deployment-structure.xml the connection definitions for Resource Adapter not getting bound. If I remove my ear and restart I can clearly see my JCA Connection Definitions are getting loaded and I can access them from my web app.

               

              Not sure whats going on...and why my ear deployment is causing my resource adapter connection definition to be failed....and also there no error in logs...I am lost ...

              • 4. Re: jBoss EAP 6.1 EAR not able to find classes in RAR
                Frank Langelage Master

                I do not use any jboss-deployment-structure.xml, neither in rar files nor in ear.

                While building the ear-file I add dependency to rar file like this:

                
                
                
                <ear earfile="${BIN}/${pre-stage.ear.name}" appxml="${etc.dir}/application.xml">               
                
                
                
                
                <fileset dir="${build.deploy.dir}" includes="ejb-entity.jar"/>
                
                
                
                <fileset dir="${build.deploy.dir}" includes="ejb-session-*.jar"/>
                
                
                
                <fileset dir="${build.deploy.dir}" includes="ws-*.war"/>
                
                
                
                <fileset dir="${build.deploy.dir}" includes="web.war"/>
                
                
                
                <fileset dir="${build.deploy.dir}" includes="lib/**"/>
                
                
                
                <fileset dir="${etc.dir}" includes="mbi_deploy.xml"/>
                
                
                
                <manifest>
                
                
                   
                <attribute name="Dependencies" value="deployment.controller.rar, deployment.filesystem.rar"/>
                
                
                
                </manifest>
                
                
                </ear>                                                                                         
                
                
                
                
                
                
                
                1 of 1 people found this helpful
                • 5. Re: jBoss EAP 6.1 EAR not able to find classes in RAR
                  Sheeraz Junejo Newbie

                  Thanks Frank, still the same, I have removed the jboss-deployment-structure.xml and now my deployment fails with ClassNotfoundException. My ear manifest looks like as follows;

                   

                  Manifest-Version: 1.0

                  Ant-Version: Apache Ant 1.9.0

                  Created-By: 1.7.0-b147 (Oracle Corporation)

                  Built-By: sjunejo

                   

                   

                  Name: TOCF-EE EAR

                  Specification-Title: TOCF-EE

                  Specification-Version: MAIN.latest-dev

                  Specification-Vendor:

                  Implementation-Title: TOCF-EE

                  Implementation-Version: MAIN.latest-dev

                  Implementation-Vendor:

                  Dependencies: deployment.tocfT24ra-ra.rar

                   

                  Is that OK? I am using ant <jar /> target to build my package which should be OK I guess

                  • 6. Re: jBoss EAP 6.1 EAR not able to find classes in RAR
                    Frank Langelage Master

                    Looks OK. This is mine (in dos mode):

                    Manifest-Version: 1.0^M                                       
                    Ant-Version: Apache Ant 1.9.2^M                               
                    Created-By: 1.7.0_25-b15 (Oracle Corporation)^M               

                    Dependencies: deployment.controller.rar, deployment.filesystem.rar^M

                    ^M                                                             

                    You also have a line break at the end, an empty line after Dependencies line?

                    Remember vague that this manifest file is or at least was somehow very sensitive about such things like line breaks, spaces at the end of the line, ...

                    Maybe you can put Dependencies at first position (after Created-By), before everything else including the empty line.

                    • 7. Re: jBoss EAP 6.1 EAR not able to find classes in RAR
                      Sheeraz Junejo Newbie

                      Adding Dependencies just after created-by: attribute worked. Thanks