This page describes how to work with the JBoss 5.1 class loader. As we all might find out sooner of later the JBoss class loading functionality is not very well documented. The following is my attempt at it.
JBoss ships with numerous JAR files in its classpath.
- Commons Logging / Log4j
- Apache CXF
- Spring Framework 2.5.6.SECO1
This causes problems with application include their own versions in the “WEB-INF/lib” folder. JBoss offers the ability to load classes from parent class loader first or last.
The following tells jboss to load classes from parent last.
<classloading xmlns="urn:jboss:classloading:1.0" domain="yourDomain" parent-first="false"> </classloading>
If you are only running one application within the container, this is all you need to know about parent-first or parent-last option.
Drop the file into your WAR and try it out. You can verify if its working as expected by using a snoop.jsp page. The page contains a widgit towards the bottom where you can plugin your own class names and find out where its running from.