How to disable classloader isolation in JBoss EAP 6 ?

Solution Verified - Updated -

Environment

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

Issue

  • We have a problem regarding a badly constructed 3rd party vendor application and the classloading mechanism in EAP 6.1.

  • We have a requirement of running the same WAR-application multiple times in the same JBoss instance (the WAR files will have very small differences, and be renamed differently). The problem lies in a vast amount of 3rd party jars which the vendor has put in the WAR file. Running the WAR multiple times will have the consequences of taking up a large amount of disk, slowing down the deployment process, and using more memory.

  • We would like to pull out the 3rd party jars and place them in a module. In order to reach methods with package-level scope in the 3rd party classes, the vendor has created their own classes with the same package-structure as the 3rd party jars but placed these in their own jars.

  • When trying to pulling out the 3rd party in a module in JBoss, these classes are loaded in their own classloader, whereas the vendors classes are loaded in the WAR-containers class loader. These can’t see/use each other – and nothing works.

  • Are there any ways we can force an application and a module to use the same classloader in JBoss ?

Resolution

  • Modules in EAP 6 delegate dependencies to its peers and not to parents.
  • Hence, the application classloader and the module classloader will the different.
  • There is no way you an tweak the behaviour to include a common classloader for both the application and the dependent module.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments