-
1. Re: Classloading configuration for JBoss eap 6 excluding JBoss modules outside the war file
sfcoy Jun 18, 2013 10:59 PM (in response to neilharper)1 of 1 people found this helpfulWhich modules are you talking about exactly?
For historical reasons, jars in WEB-INF/lib directories already take precedence (in general) over other classes that may be made available by the application server.
-
2. Re: Classloading configuration for JBoss eap 6 excluding JBoss modules outside the war file
neilharper Jun 18, 2013 11:45 PM (in response to sfcoy)Thanks for the reply yes it would be nice if WEB-INF/lib did take precedence. However the new classloader in EAP 6 loads a bunch of JBoss classes first.
from https://docs.jboss.org/author/display/AS7/Class+Loading+in+AS7
In order of highest priority to lowest priority
- System Dependencies - These are dependencies that are added to the module automatically by the container, including the Java EE api's.
- User Dependencies - These are dependencies that are added through jboss-deployment-structure.xml or through the Dependencies: manifest entry.
- Local Resource - Class files packaged up inside the deployment itself, e.g. class files from WEB-INF/classes or WEB-INF/lib of a war.
- Inter deployment dependencies - These are dependencies on other deployments in an ear deployment. This can include classes in an ear's lib directory, or classes defined in other ejb jars.
For 1 specific example of a module, my code is using module org.slf4j v1.6.1 which it normaly (for other web servers) picks up from spring jar in my WEB-INF/lib/com.springsource.slf4j.api.jar
When running under jboss, it automatically loads v1.7.2 which turns out to have slightly different behaviour and crashes in one instance.
So I can exclude slf4j in the boss-deployment-structure.xml but I have a requirement to be able to specify this dependency outside the war like I can for other web servers like tomcat.
I am hoping that I have got something wrong here?
-
3. Re: Classloading configuration for JBoss eap 6 excluding JBoss modules outside the war file
sfcoy Jun 19, 2013 1:15 AM (in response to neilharper)You're right. slf4j seems to fall outside that "in general" bucket. Personally, I'm not sure if I like that or not.
Now, I'm interested in your statement:
{quote}Now I have a firm requirement that our web-server independent war file should not contain any configuration specific to the server which runs it.{quote}
I have personally worked on vendor independent JavaEE solutions for many years and they have always included vendor dependent deployment descriptors. It has been pretty much impossible to build non-trivial solutions without them.
For example, a webapp that runs on JBossAS, WebSphere and WebLogic would contain:
- web.xml (vendor independent)
- jboss-web.xml
- jboss-classloading.xml (sometimes on EAP5.x)
- weblogic.xml
- ibm-web-bnd.xml
- ibm-web-ext.xml
At the very least, this is the only way you can map vendor independent JNDI ENC names (java:comp/env/jdbc/myDataSource) to vendor dependent JNDI names.
So, I'm not sure that this requirement is achievable for any non-trivial application.