This little blogette covers a problem that arises when you try to deploy an EAR file on Weblogic’s web-server where the JEE components such as MDBs and EJB use the wrong Spring Application Context in the wrong place and at the wrong time.
When this error occurs you’ll get a NoClassDefFoundError exception that refers to a class that somewhere deep inside the call stack. This exception happens even though the EAR is correctly configured with all JARs present and classpaths correct.
This is caused by the use of Spring’s ClassPathXmlApplicationContext which loads an entire context for every EJB / MDB.
The fix is to use ContextSingletonBeanFactoryLocator and a beanrefContext.xml (though the xml file name is configurable), which loads the Application context once, sharing it between all EJB or MDB instances.