JBoss module exclusion for slf4j not working when depending on another deployment in JBoss EAP 6

Solution Verified - Updated -

Issue

  • Suppose there exists a web application my.war and a resource adapter my.rar. The web application my.war declares a module dependency on my.rar and also excludes the various logging modules. When testing the web application, the exclusions do not seem to work correctly and the application is not using the slf4j and other logging jars that are packaged in the war. The jboss-deployment-structure.xml looks like:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
    <deployment>
        <exclusions>
            <module name="org.apache.log4j" />
            <module name="org.slf4j" />
            <module name="org.slf4j.ext" />
            <module name="org.slf4j.impl" />
            <module name="org.slf4j.jcl-over-slf4j" />
            <module name="org.apache.commons.logging" />
            <module name="org.jboss.logging"/>
            <module name="org.jboss.logging.jul-to-slf4j-stub"/>
            <module name="org.jboss.logmanager"/>
            <module name="org.jboss.log4j.logmanager"/>
        </exclusions>
        <dependencies>
             <module name="deployment.my.rar"/>
        </dependencies>
    </deployment>
</jboss-deployment-structure>
  • The custom log4j/SLF4J context doesn't work when depending on another deployment via jboss-deployment-structure.xml.

Environment

JBoss Enterprise Application Platform (EAP) 6.0.1

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content