I have a JBoss server that has an ear file. My ear file has a war file. The war file has a jar file \"server-artifact.jar\". My server\'s service endpoint is in that jar. Th
I found a solution to my problem. After playing around for a while with the jboss-deployment-structure.xml and modules, i realized that it is not possible to make an external module use or extend classes of the ear/war. To achieve my goal, i had to make my jar file which is at an external location be loaded by the same class loader that loads the ear libraries. This can be achieved by adding a resource directly to the ear file as below(jboss-deployment-structure.xml):
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<ear-subdeployments-isolated>false</ear-subdeployments-isolated>
<deployment>
<dependencies>
<module name="org.jboss.as.jmx"/>
<module name="org.jboss.logmanager"/>
</dependencies>
<resources>
<resource-root path="../../../../../../../../../externalLib/externalLibrary-0.0.1-SNAPSHOT.jar" />
</resources>
</deployment>
<sub-deployment name="myservice.war">
</sub-deployment>
<sub-deployment name="admin.war">
</sub-deployment>
The resource-root path is relative to the ear file in the standalone/deployments folder. Adding the resource root as this way is equivalent to adding the library to the lib folder of the ear file. So, this ensures that my external library is also loaded as part of the the main classloader that loads the ear where all my framework libraries are.