1 Reply Latest reply on Aug 8, 2013 5:11 AM by jaikiran pai

    JBoss AS 7 Classloading Precedence between EAR/lib jar files

    Wes Strickland Newbie

      I have a situation where the customer would like to include two distinctly named jar files within the same EAR file's lib directory which contain duplicate classes (exact same package name and class name).  They have overriden some third party classes for customization.  In some cases, when deploying the EAR project within Eclipse, the classloader will find the desired class first and everything will be fine at runtime.  Other times, dropping the same EAR directly into the JBoss standalone/deployments directory and turning on verbose classloading debug, the classloader finds the original classes inside the other 3rd party jar first and this causes runtime exceptions since modifiers have changed from private to protected in the customized version of the class.

       

      I have read all about the modular class loading of AS 7 and how to exclude modules and the order or precedence/visibility between sub-deployments and that is all great.  My question, however, is if there is a way to provide the classloader with an exact ordered list of jar files within the same EAR/lib directory to force it to find the customized classes first in the custom jar versus the original same classes in the 3rd party jar so that we can consistently predict the classloader's behavior?

       

      Our customer wants to avoid the maintenance of pushing out new modules to each server install directory and wants to keep everything in the EAR.  They also don't want to incur the future maintenance overhead of removing the customized classes from future releases of the 3rd party jars and repackaging them.

       

      Any help would be greatly appreciated!

       

      Thanks!

      -Wes