I have an java ee application that I am trying to convert from JBoss 4 to JBoss 7.1. I tryed JBoss 7 first but I had too many classloading problems. I suspect that my current problem is related to classloading also.
First let me describe the structure of my app. I have a ear that includes 3 wars and 1 jar with stateless sessions beans:
Each of those war have their own code but also share some classes. One of those classes looks like this:
public class AccessAuditListener implements HttpSessionAttributeListener
@EJB(name = "SeasionBean")
private SessionBean sessionBean;
public void attributeAdded(HttpSessionBindingEvent httpSessionBindingEvent)
// Do nothing
public void attributeRemoved(HttpSessionBindingEvent httpSessionBindingEvent)
public void attributeReplaced(HttpSessionBindingEvent httpSessionBindingEvent)
// Do nothing.
The problem I have is that the first war that gets deployed has its EJB named "SessionBean" properly injected but subsequent wars do not get any ejb reference injected. It is as if while wars would all have their own classloaders but that they would be linked in a way that common classes only get classloaded (and therefore EJB injected) once. In JBoss 4, there was this really useful configuration you could put in the jboss-web.xml (<class-loading java2ClassLoadingCompliance="false"/>) that made sure all wars were 100% isolated.
My question is how can I get the JBoss 4 behavior without getting into the really messy work of turning ear-subdeployments-isolated to true?
Is the AccessAuditListener declared in the web.xml of each WAR file?
Does the web.xml in each WAR file specify at least version 2.5?
At this point I'm not convinced this is a class loading issue, because each WAR should get it's own instance of the AccessAuditListener, irrespective of which class loader it comes from.