I have a certain piece of code in the contextInitialized method of a ServletContextListener. When I deploy my app on JBOSS, it gives me a NoClassDefFoundError. If I change the code in the contextInitialized method to run 10 seconds after the context is initialized, it runs fine.
So, I suppose not all classes get loaded when the context is initialized. Is that correct? What I can do to fix this?