I have been trying to understand how the class loaders work in JBOSS 5.1.0 GA (JDK6 distribution) with regards to resources.
I am testing with a resource file in META-INF/services of many consecutively numbered jars, strategically placed in the various jar folders, in order to determine in which order the jars are loaded. I am running JBOSS on windows and connecting using a remote debugger in Eclipse, in order to breakpoint each URL passed back. In conf/jboss-service.xml there are a number of entries; the common/lib, server/?/lib, and two additional entries to deal with our particular deployment (the addition of which seems misguided, but I don't think they cloud my question in any way). Am I correct in thinking these locations form part of the System Class Loader ? (SAR Test) When performing getResources(META-INF/services/my.resource.file) from a classloader of a class located within a SAR deployment, the search order is 1) the jars within the current SAR 2) the jars within other SARs within the same class loader domain 3) classpath entries defined in conf/jboss-service.xml but in a different sequence; server/?/lib (defined first) additional/lib (defined third) additional/lib/jdbc (defined fourth) common/lib (defined second) (WAR Test) When performing getResources(META-INF/services/my.resource.file) from a classloader of a class located within a WAR deployment, the search order is 1) some of the classpath entries defined in conf/jboss-service.xml and in a different sequence; additional/lib (defined third) common/lib (defined second) server/?/lib (defined first) 2) the jars within the current WAR 3) the jars within SARs within the same class loader domain 4) the last of the classpath entries defined in conf/jboss-service.xml additional/lib/jdbc (defined fourth) The order that the tests have produced is unexpected. Perhaps I'm missing something obvious. Nevertheless, if someone can help explain the behaviour I would appreciate it. The reason I am asking is that we are deploying many SARs and WARs, and multiple versions of some jars are unfortunately unavoidable. I want to be able to advise team members on the intricacies of the class loading so they are forewarned and can resolve any issues. I believe I understand the process of isolation using jboss-classloading.xml files and the hierarchy behaves as one would expect, but when I consider how say XML Parsers are typically located, knowing the behaviour of getResources is as important to understand. Any help gratefully received View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4266261#4266261 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4266261 _______________________________________________ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user