0

We have a situation where a Liberty application accesses a custom resource adapter through a JNDI lookup to a connection factory, defined in the server.xml. The combination of the connectionFactory, resourceAdapter, and enterpriseApplication nodes in the server.xml appears to make it impossible to bundle the rar inside the ear and push an ear as a single entity without major app refactoring, which is a non-starter.

I see two options for getting around this right now:

  1. Push the rar/ear combo as a bundled server package, or
  2. Modify the Liberty buildpack to pull in the rar at push time, generating the expected nodes in the server.xml

Am I missing a third option?

Thanks, Tom

1 Answers1

1

The third option would be to embed the RAR in your app, but I didn't understand your comment about why that would require extensive app refactoring. In theory, the app shouldn't change, just the config... See the IBM Knowledge Center topic http://www-01.ibm.com/support/knowledgecenter/SSEQTP_8.5.5/com.ibm.websphere.wlp.doc/ae/twlp_jca_config_resadapters.html?lang=en for details on configuring a connection factory for use with an embedded resource adapter. For the standalone resource adapter, I assume you had something like this in server.xml:

<connectionFactory jndiName="eis/NAME" type="javax.resource.cci.ConnectionFactory">
    <properties.rarName dataStoreName="name" hostName="otherName"/>
</connectionFactory>
<resourceAdapter id="rarName" location="rarName.rar"/>

when you embed the rar in the ear, as you noted, that resourceAdapter node goes away and instead you would use something like this:

<application location="C:/applications/app1.ear"/>
<connectionFactory jndiName="eis/NAME” type='javax.resource.cci.ConnectionFactory’>
    <properties.app1.rarName dataStoreName="name" hostName="otherName"/>
</connectionFactory>

Note that for an embedded resource adapter, the properties element must now also include the application name (in this case “app1”) in the name of the element. As indicated in the Knowledge Center topic, if you wanted to override the default name of the resource adapter, you could instead do:

<application location="C:/applications/app1.ear”>
    <resourceAdapter id=“rarName" alias="MyEmbeddedRA"/>
</application>
<connectionFactory jndiName="eis/NAME" type="javax.resource.cci.ConnectionFactory">
    <properties.app1.MyEmbeddedRA dataStoreName="name" hostName="otherName"/>
</connectionFactory>
F Rowe
  • 2,042
  • 1
  • 11
  • 12