What is the trick for making jboss-client.jar available to the WAR applications in JBoss EAP 6

1k views Asked by At

In JBoss EAP 6.1, there is a file

JBOSS/bin/client/jboss-client.jar

It contains all the client classes needed by web applications. However, when we install a WAR file, it is not seeing these classes available to it.

To work around this, we have been including a copy of this JAR in the war files WEB-INF/lib folder. These copies are a waste, but more importantly it means we have to have a different WAR file for every app server we want to install into.

Is there a trick to allow the applications in the WAR files to load and use the classes from this library where it is, without having to copy it into the WEB-INF/lib folder of the application? Alternately, is there a place we can copy this jar so that it would be available to all WAR applications?

2

There are 2 answers

1
AgilePro On BEST ANSWER

The solution was to place a file named jboss-deployment-structure.xml in the WEB-INF folder. The contents of that file was:

<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
  <deployment>
    <!-- Excluding conflicting JBoss-6 Implicit Modules so that jars bundled within war file is used. -->
    <exclusions>
        <module name="org.apache.log4j" />
        <module name="org.apache.commons.logging" />
    </exclusions>
    <!-- Defining additional dependencies for JMS usage in model API -->
    <dependencies>
        <module name="org.jboss.remote-naming" />
        <module name="org.hornetq" />
    </dependencies>
  </deployment>
</jboss-deployment-structure>

This allowed us to use the JMS classes from JBoss without having a copy of the client library included with the application being installed. It seems that some time ago, a programmer ported the application to JBoss, and ran into a problem which was "solved" (hacked) by putting the client library in, but this is a far better solution.

3
nelvadas On