I have an application that works well in JBoss 5.1.0. It consists of an ear, with a sub deployment war inside. This application depends on a custom JCA adapter I have created.
Reading through various articles I managed to get the JCA RAR file deployed by copying it in to /standalone/deployments/ along with the application, call it app.ear. Therefore:
Furthermore, I added a dependency in App.ear/META-INF/MANIFEST.MF as follow:
Then I used the CLI interface to add the JCA Resource Adapter to the standalone-full.xml configuration file. When JBoss 7.2.0 Alpha1 starts (standalone-full), I can see the JCA adapter loading and making itself available on java:/CustomJCA. Then the fun starts...
App.ear depends on a library, call it child.jar. However, CustomJCA.rar ALSO depends on this same child.jar file - it is a configuration file bootstrapping framework. So child.jar is bundled with CustomJCA.rar as /child.jar, i.e. it is in the root of the rar archive. CustomJCA.rar sees this child.jar and loads fine, as it is the first module to load. The problem is when App.ear now tries to reference child.jar, which has also been deployed to App.ear/lib/child.jar, JBoss ignores the App.ear/lib/child.jar file and loads the classes from CustomJCA.rar/child.jar. This is a big problem because one class in that child.jar performs a getClass().getResourceAsStream("/properties/file.xml") call, and that fails as /properties/file.xml is located under App.ear/lib/properties.jar/properties/file.xml, but the classloader is the one from CustomJCA.rar, and hence it cannot find this file.
How am I to resolve this?