views:

123

answers:

1

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?

Edit: Almost two months later, I still haven't found a real answer to this question. Asking around, all I got were those two helpful suggestions: "Use Maven properties and filtering", and "Don't include the RAR within the EAR." I strongly suspect that currently there is no way to handle this properly in JBoss. So I'll give up on it and just accept the only answer I got here.

+1  A: 

are you using maven to build? If so, you can set a maven property that names the ear file and use that name to set values in resources files using a placeholder

e.g xxx

then use

${ear.name}.ear#thirdparty-1.0.rar

just make sure you set the resources that will have the placeholders

something like this:

<build>
<resources>
  <resource>
    <directory>src/main/resources</directory>
    <filtering>true</filtering>
  </resource>
</resources>

allkenang
Thanks for your answer! I must admit that in the meantime, I cross-posted this here: http://community.jboss.org/message/529160 The most useful answer I got so far was quite similar to what you are suggesting. I am using maven, and I have settled for using resource filtering. But it still doesn't feel quite right, more like a work-around.
cg
Accepted the only answer I got here now. See my edits above.
cg