How to configure classloading precedence of jars in EAP 6 ?

Solution Verified - Updated -

Issue

  • We have a war file which has two jars which contains different version of same class, so how to define the classloading precedence in between these jars?

  • For example we have test.war which depends on a A.jar file. test.war contains 2 jars in the WEB-INF/lib directory i.e A.jar and B.jar as follows:

test.war
|
WEB-INF/lib
   |
   +-A.jar
   | |
   | +-com/Example.class  (supposed to override B.jar's )
   |
   +-B.jar
     |
     +-com/Example.class 
  • We would like A.jar classes to Patch the B.jar. Here A.jar contains Example.class file that is supposed to overwrite one of its dependency B.jar's Example.class. But while deploying the test.war in EAP 6, JBoss is by default not overriding in the manner as mentioned above so is there any configurations (like the jboss-deployment-structure.xml) which can be done in order to override the B.jar source files with A.jar source files without changing contents of B.jar?

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 6.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.