Search code examples
jcaopen-liberty

OpenLiberty JCA resource adapter and shared librabries - how?


Is it possible to deploy a JCA resource adapter (rar) that references a shared library, inside the OpenLiberty server? What is the server.xml configuration snippet for this? I looked at the JCA docs for Liberty and found nothing on the topic... My guess is something like this, but not sure:

<library id="mySharedLib">
        <fileset dir="${server.config.dir}/odb" includes="*.jar" />
</library>
...
<resourceAdapter id="myrar" location="${server.config.dir}/jca/my.rar">
        <properties.myrar conf="${server.output.dir}/jca/odb-server.xml"/>
        <classloader commonLibraryRef="mySharedLib"/>
</resourceAdapter>

Solution

  • Here's link to the schema for resourceAdapter which shows you can use classloader with a commonLibraryRef as you described. Something like the following:

    <library id="MyLib">
        <fileset dir="/some/dir" includes="sharedlib.jar"/>
    </library>
    
    <resourceAdapter id="AdapterForMe" location="${server.config.dir}/connectors/RA.rar">
        <classloader commonLibraryRef="MyLib"/>
    </resourceAdapter>