Changing the default class loading mechanism of JBoss 4.2.* and WebLogic
Application servers use different class loading/delegation mechanisms. Therefore, we should understand them when deploying enterprise applications. In most cases, we need to override the default class loading behavior of application servers.
Suppose your web application wants to load classes from its own class loader first without delegating to parent. Then the following simple configurations will help you to override default delegation pattern in BEA WebLogic (version 8.* or 10) and JBOSS 4.2.*.
In WebLogic:
Set <prefer-web-inf-classes> to true in WEB-INF/weblogic.xml of your war.
Read WebLogic Server application classloading for more information.
In JBoss:
Set java2ParentDelegation to false in WEB-INF/jboss-web.xml as follows.
<loader-repository>
org.test:loader=archive-name
<loader-repository-config>
java2ParentDelegation=false
</loader-repository-config>
</loader-repository>
For more information about JBoss class loading, have a look at JBoss classloading configuration guide
Suppose your web application wants to load classes from its own class loader first without delegating to parent. Then the following simple configurations will help you to override default delegation pattern in BEA WebLogic (version 8.* or 10) and JBOSS 4.2.*.
In WebLogic:
Set <prefer-web-inf-classes> to true in WEB-INF/weblogic.xml of your war.
Read WebLogic Server application classloading for more information.
In JBoss:
Set java2ParentDelegation to false in WEB-INF/jboss-web.xml as follows.
org.test:loader=archive-name
<loader-repository-config>
</loader-repository-config>
</loader-repository>
For more information about JBoss class loading, have a look at JBoss classloading configuration guide
Comments
Using WebLogic 9 and above, you should avoid using the child-delegation class loading model. It's quite dangerous since it reverses the entire tree. It may lead to LinkageErrors.
You'd better use the FilteringClassLoader mechanism, as explained here :
http://m-button.blogspot.com/2008/08/how-to-use-weblogic-filteringclassloade.html
Regards,
Maxence.
http://blog.livedoor.jp/lljj332
http://shoes-puma.jugem.jp
http://poloshirts--myfashion.blogspot.com
http://blades.blogsome.com
http://gillettefusion.edublogs.org
http://gilletterazor.blog126.fc2.com
http://poloclothing.blogsome.com
http://venuschinawholesale.easyjournal.com
http://pumaspeedcat.blogharbor.com