6 Replies Latest reply on Mar 1, 2010 11:50 AM by C G

    How to reference an embedded JCA resource adapater

    C G Newbie

      For our current J2EE project based on JBoss, we need to interface with a remote system using message driven beans and a JCA resource adapter provided as a RAR file by a third party. I would like to package and deploy the entire project as an EAR file to our JBoss server. Most notably, the RAR file should be embedded within the EAR file and not be deployed globally.

      All of this is working fine so far, but I'm not particularly happy with the way the RAR file is referenced. The jboss.xml packaged with the MDB for example, currently looks like this:

       

      <jboss>
        
      <enterprise-beans>
           
      <message-driven>
              
      <ejb-name>testBean1</ejb-name>
              
      <resource-adapter-name>test1.ear#thirdparty-1.0.rar</resource-adapter-name>
           
      </message-driven>
        
      </enterprise-beans>
      </jboss>

      While this is generally working fine, it will break when the EAR file is renamed to "test2.ear". Is there a way to reference the embedded RAR file without hard-coding the containing archive's name?

       

      Thanks in advance!

       

        • 1. Re: How to reference an embedded JCA resource adapater
          Vicky Kak Master

          cgrf wrote:

           

          Is there a way to reference the embedded RAR file without hard-coding the containing archive's name?

           

          Thanks in advance!

           

          You should package the RAR seperately and not include it in the EAR, what is the reason that you want to have it in the EAR?

          AFAIK there is not way to refer to the RAR directly when it is a part of the EAR.

          • 2. Re: How to reference an embedded JCA resource adapater
            C G Newbie

            Thanks for your answer. One reason for including the RAR in the EAR would be not having to deploy it separately. I would like the whole application and it's dependencies to be included in the EAR. Another reason is encapsulation: when included within the EAR file, the adapter is not accessible to other applications on the same server. Also, multiple instances of my application could easily "bring along" their own configuration of the adapter.

            • 3. Re: How to reference an embedded JCA resource adapater
              Vicky Kak Master

              cgrf wrote:

              Another reason is encapsulation: when included within the EAR file, the adapter is not accessible to other applications on the same server. Also, multiple instances of my application could easily "bring along" their own configuration of the adapter.

              Well I understand that you have scoped EAR, so what you could do here is have multiple EAR's like plainear.ear and rarear.ear. Both of these ear's should be isolated and share the same CL, this can be controlled via the jboss-app.xml in EAR. The loader-repository entry in the plainear.ear/META-INF/jboss-app.xml and rarear.ear/META-INF/jboss-app.xml should have similar entry.

              You can give it a try and let us know if that sorts the issue.

              1 of 1 people found this helpful
              • 4. Re: How to reference an embedded JCA resource adapater
                C G Newbie

                vickyk wrote:

                 

                Well I understand that you have scoped EAR, so what you could do here is have multiple EAR's like plainear.ear and rarear.ear. Both of these ear's should be isolated and share the same CL, this can be controlled via the jboss-app.xml in EAR. The loader-repository entry in the plainear.ear/META-INF/jboss-app.xml and rarear.ear/META-INF/jboss-app.xml should have similar entry.

                You can give it a try and let us know if that sorts the issue.

                 

                Unfortunately, this did not really solve the issue for me. My main objective was to bundle the RAR file inside the EAR without having to hard-code the EAR's name anywhere. I still wasn't able to achieve this, although it might well be me still doing it wrong. Anyway, we now opted to deploy the RAR seprately after all. Thanks again for you support!

                • 5. Re: How to reference an embedded JCA resource adapater
                  Shane McEneaney Newbie

                  Hi C G,

                   

                  I too have a RAR contained inside an EAR. We build using maven 2 and use a variable property to define the name of the EAR and RAR. In our case the version number changes all of the time. Ant has similar capabilities to include property values that are filtered/replaced at build time.

                   

                  See jboss.xml snippet below.

                   

                  <jboss>

                     <enterprise-beans>

                        <message-driven>

                           <ejb-name>SampleOneMDB</ejb-name>

                           <resource-adapter-name>my-system-${project.version}.ear#my-rar-${project.version}.rar</resource-adapter-name>

                        </message-driven>

                        <message-driven>

                           <ejb-name>SampleTwoMDB</ejb-name>

                           <resource-adapter-name>my-system-${project.version}.ear#my-rar-${project.version}.rar</resource-adapter-name>

                        </message-driven>

                        <message-driven>

                           <ejb-name>SampleOThreeMDB</ejb-name>

                           <resource-adapter-name>my-system-${project.version}.ear#my-rar-${project.version}.rar</resource-adapter-name>

                        </message-driven>

                     </enterprise-beans>

                  </jboss>

                   

                   

                  1 of 1 people found this helpful
                  • 6. Re: How to reference an embedded JCA resource adapater
                    C G Newbie

                    Hi Shane,

                     

                    Thanks for that useful hint. Actually, I'm using maven on this project, too. I've been mostly using ant before, so I knew I could do that with ant. Somehow, it just didn't come to my mind to look for this feature in maven.

                     

                    As I mentioned before, I'm no longer planning to package the RAR file for this project. But still, I'm wondering if there is a way to make a "relative" reference to the contained RAR file. It would seem like a very natural thing to me, but I'm beginning to suspect that it cannot currently be done in JBoss.

                     

                    Best,

                    Christian