Search code examples
springmessage-driven-bean

Wrong Spring AppContext found in EAR


I have an EAR with multiple MDBs in it. Each MDB jar has its own application context. When a message arrives I can see from the logging that the appropriate MDB initialises, but it obtains the application context from different MDB!

I thought each EJB should have it's own classloader. It seems it doesn't. How can I enforce each MDB to load its own app context?

I am using WebSphere 7.

My project structure is:

META-INF/
META-INF/MANIFEST.MF
topicreader-ejb-mdb01.jar
topicreader-ejb-mdb02.jar
lib/
lib/3rdpartylib01.jar
lib/3rdpartylib02.jar
... etc

The content of the mdb jars is:

applicationContext.xml
com/mycompany/ ... (classes)
META-INF/ejb-jar.xml
META-INF/MANIFEST.MF

Solution

  • In WAS you can change the classloader order for the WARs!!, I hope you can do the same for the jars. Normaly the class loader order it is "parent first". Try "Parent Last".