JBoss exclude httpclient

1k Views Asked by At

We're using JBoss 6.4.5 GA and are using RestEasy. JBoss comes with an httpclient version httpclient-4.3.6.redhat-1.jar. I need a later Version (4.5.x) for another dependency. I'm deploying an ear file containing a single war file into the jboss Container. Unfortunately the globally installed jboss version of httpclient gets loaded, not the one inside the war file.

Structure:

ear
-war
--WEB-INF
---lib # contains the newer Version of httpclient
---classes
--META-INF
-META-INF
--jboss-deployment-structure.xml

The jboss-deployment-structure.xml looks as follows:

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
    <deployment>
        <dependencies>
            <system export="true">
                <paths>
                    <path name="com/sun/org/apache/xerces/internal/dom" />
                </paths>
            </system>
        </dependencies>
        <exclusions>
            <module name="org.apache.httpcomponents" slot="main" />
        </exclusions>
    </deployment>


    <sub-deployment name="mywar-2.68.0-SNAPSHOT.war">
        <dependencies>
            <module name="org.jboss.xnio" />
        </dependencies>
        <exclusions>
            <module name="org.apache.httpcomponents" slot="main" />

        </exclusions>
    </sub-deployment>

</jboss-deployment-structure>

Unfortunately still the old Version of the httpclient gets loaded. How can I shadow the globally provided jar?

1

There are 1 best solutions below

0
On

Add org.jboss.resteasy.resteasy-jaxrs to the exclusions as well. Latter module has a dependency on org.apache.httpcomponents and will pull it into the deployment.