We have an application which is packaged as an EAR and includes 1 WAR, 1 EJB.jar, META-INF with application.xml and jboss-app.xml and a lib directory with all the shared jars.
One jar contains the core of our application and includes a ServiceLocator through which we can get references to other resources (Spring, JMS).
The ServiceLocator is first called by the webapp and works fine. We also use JMS and one class from out core.jar sends a Message to JMS. On the other end there is an MDB listening which also uses the ServiceLocator to get resources. The problem is that when the MDb uses the SL it gets instantiated where we actually want the one already instantiated by the webapp.
This seems to be a Classloader-issue and i tried to follow the instructions stated by the ClassLoadingConfiguration (wiki). Non of it worked. I also tried setting the ear-deployer :true but this has a counteractive effect.
What do i need to do, (if at all possible) to get both (and later more) modules to use a shared ServiceLocator instantiated by either the ejb.jar or the web.war? (The ejbCreate() does not seem to get called when deploying an MDB on JBoss).
Hope someone can help because this is very time consuming.