4

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...

CoolBeans
  • 20,654
  • 10
  • 86
  • 101
Ravi Parmar
  • 1,392
  • 5
  • 24
  • 46

2 Answers2

4

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.

CoolBeans
  • 20,654
  • 10
  • 86
  • 101
  • Adding other modules in exclusion and dependencies works, I wonder why it doesn't work for org.apache.httpcomponents. I want to avoid changes to Jboss. Is there a work around to avoid changes to Jboss? – Vinayak Dornala Mar 22 '18 at 19:24
  • Make sure you are on the latest version of EAP 6.4.z (ie. 6.4.19). – CoolBeans Mar 23 '18 at 19:29
  • Hi @CoolBeans, We don't have option to upgrade Jboss. We are using EAP 6.4.0 – Vinayak Dornala Mar 28 '18 at 19:55
  • @VinayakDornala I am not sure what you mean. You can always apply the latest cumulative patch via the patch cli command or from management console. You have two options - 1) manually change the resteasy-jaxrs module xml file or 2) upgrade to the latest 6.4.19 version (this bug was addressed in 6.4.8 build if I recall correctly so 6.4.19 will include the fix). – CoolBeans Mar 29 '18 at 15:33
  • Thanks @CoolBeans, Using CLI is one option to apply the patch. I wonder why adding in jboss-deployment-structure.xml doesn't work? Which is much easier solution. Also I had similar issue for other module (IMS connector) which got resolved by just updating jboss-deployment-structure.xml – Vinayak Dornala Mar 31 '18 at 04:46
1

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

CoolBeans
  • 20,654
  • 10
  • 86
  • 101
Vinayak Dornala
  • 1,609
  • 1
  • 21
  • 27