I wanted to understand parent-last loading in an application JBoss application server. We have a legacy application deployed in JBoss 4.2.1 GA. For which we are trying the parent-last loading.
I am referring to the this link. I wanted to learn a parent last loading. So had created simple maven jar package application with maven-jar-plugin and configuration -> addDefaultImplementationEntries = true. I have created 2 jar versions 1.0.0 and 1.0.1 from the same jar creation maven application. The jar has single class TestClass and a simple String return method that returns the version of the jar the class is loaded from. what I wanted to experience the use of java2ClassLoadingCompliance. I have packaged the version 1.0.0 jar in the server/deploy/MyApplication/WEB-INF/lib (My web application is a simple servlet application that calls the method of the class thus printing the version number from which jar it was called from.) and version 1.0.1 jar in server/lib.
Note : Logically it does not make sense to use an older version of jar in application and overriding it with the newer version present in server lib, but just wanted to experience the class loading.
I have tried the following
- Without any jboss-web.xml in the meta-inf folder.
- I tried introduction jboss-we.xml in META-INF and doing the same with java2ClassLoadingCompliance = false.
- With java2ClassLoadingCompliance = true.
All the time class from the application lib would get loaded by the application.
My jboss-web.xml looks like reference
<jboss-web>
<class-loading java2ClassLoadingCompliance="true">
<loader-repository>
com.example:archive=JBossClassLoadingTestServlet-0.0.1-SNAPSHOT.ear
<loader-repository-config>java2ParentDelegation=true</loader-repository-config>
</loader-repository>
</class-loading>
</jboss-web>
Can someone help me understanding parent-last configuration in JBoss? What is the mistake I am doing here that always class from application lib gets loaded?