4
votes

We have recently migrated from jboss 6.1 eap to 6.4 eap, but facing problem of class loading.

In my project lib We need to use apache httpcore 4.4.1, but apache httpcore 4.3.3 is included in 6.4. This previously wasn't a problem when we were using jboss 6.1 because the resteasy-jaxrs module.xml did not export httpcore library.

Now with jboss 6.4 we are getting exception :

Caused by: java.lang.NoSuchMethodError: org.apache.http.util.Asserts.check(ZLjava/lang/String;Ljava/lang/Object;)V

Its because runtime my project is using jar available from jboss and which does not having this method with required signature.

Now I want to force my application to not to use jboss jar and use jar available from web-inf/lib folder.

I have try to exclude this via jboss-deployment-structure.xml but somehow it is not working and still it is using jar from jboss only.

below is snap from the jboss-deployment-structure.xml file.

<deployment>
        <exclusions>
            <module name="org.apache.httpcomponents" />
        </exclusions>

         <dependencies>
             module name="org.apache.httpcomponents" />
        </dependencies>
</deployment>

Can someone please help me on this what is missing here or is there any alternative for this...

2

2 Answers

4
votes

Since you are using JBoss EAP, you can apply the CP07 patch for EAP 6.4 (so your version would be JBoss EAP 6.4.7) where this issue has been addressed. I would highly recommend applying the CP07 patch.

Alternatively, you can set <module name="org.apache.httpcomponents" export="false"/> in the $JBOSS_MODULES\org\jboss\resteasy\resteasy-jaxrs\main\module.xml.

However, I would recommend applying the patch as the recommended solution. This way you will not modify the configuration that is shipped with the product.

1
votes

To resolve the issue we can take one of the below approach.

  1. Change $JBOSS_MODULES\org\jboss\resteasy\resteasy-jaxrs\main\module.xml as suggested by CoolBeans.

  2. You can use below option if you have no control(or not authorized) to update the Jboss server configuration.

Add below xml configuration in your jboss-deployment-structure.xml file

enter image description here

<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
    <deployment>
        <exclude-subsystems>
            <subsystem name="resteasy"/>
            <subsystem name="jaxrs"/>
        </exclude-subsystems>
        <!-- Exclusions allow you to prevent the server from automatically adding 
            some dependencies -->
        <exclusions>


            <module name="javax.ws.rs.api"/>
            <module name="org.jboss.as.jaxrs"/>
            <module name="org.jboss.resteasy.resteasy-atom-provider" />
            <module name="org.jboss.resteasy.resteasy-cdi" />
            <module name="org.jboss.resteasy.resteasy-jaxrs" />
            <module name="org.jboss.resteasy.resteasy-jaxb-provider" />
            <module name="org.jboss.resteasy.resteasy-jackson-provider" />
            <module name="org.jboss.resteasy.resteasy-jackson2-provider" />
            <module name="org.jboss.resteasy.resteasy-jsapi" />
            <module name="org.jboss.resteasy.resteasy-multipart-provider" />
            <module name="org.jboss.resteasy.async-http-servlet-30" />
            <module name="org.jboss.resteasy.resteasy-hibernatevalidator-provider" />
            <module name="org.jboss.resteasy.resteasy-jettison-provider" />
            <module name="org.jboss.resteasy.resteasy-spring" />
            <module name="org.jboss.resteasy.resteasy-yaml-provider" />


        </exclusions>
        <dependencies>


        </dependencies>
    </deployment>
</jboss-deployment-structure>

This worked for me, Hope this will work for other