Jboss EAP 7 - How to exclude implicit modules from deployment (javax.jms)?

Dilip Raj Baral :

I didn't think I would end up here but after a lot of Google and StackOverflow searches here I'm.

This is my exact problem except that I can't afford to make code changes.

The WAR I'm trying to deploy includes a JMS library (i.e. javax.jms, which I cannot exclude form the WAR.) which is already loaded by Jboss EAP 7 by default. The path to jar is something like this jboss/modules/system/layers/base/javax/jms/api/ain/jboss-jms-api_2.0_spec-1.0.0.Final-redhat-1.jar. Because of this two different versions of the same classes loading I'm getting ClassCastException.

org.apache.activemq-ra.ActiveMQConnectionFactory cannot to be cast to javax.jms.ConnectionFactory

So, I want Jboss to NOT load javax.jms so that my application can use the JAR included with the WAR.

So, I was wondering if there was any way to exclude the module globally (for all WAR deployments).

Excluding it per deployment would work too. And I do realize it can be acheivd using jboss-deployment-structure.xml but I can't get it to work.

Here is what I tried:

<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure
        xmlns="urn:jboss:deployment-structure:1.2">
    <deployment>
        <exclude-subsystems>
            <subsystem name="javax" />
            <subsystem name="javax.jms" />
        </exclude-subsystems>
    </deployment>
</jboss-deployment-structure>

and

<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure
    xmlns="urn:jboss:deployment-structure:1.2">
    <deployment>
        <exclusions>
            <module name="javax" />
            <module name="javax.jms" />
            <module name="javax.jms.api" />
        </exclusions>
    </deployment>
</jboss-deployment-structure>

I placed the file in WEB-INF directory. It didn't work. It still loaded the JMS class from modules folder of Jboss EAP. So, how do I correctly do this?

Tair :

The correct jboss-deployment-structure.xml is here:

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
    <deployment>
        <exclude-subsystems>
            <subsystem name="messaging-activemq"></subsystem>
        </exclude-subsystems>
        <exclusions>
            <module name="javax.jms.api"></module>
        </exclusions>
    </deployment>
</jboss-deployment-structure>

This way you exclude both messaging subsystem and the JMS api.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=443660&siteId=1