Moving from WebSphere to Oracle WebLogic, getting a ClassNotFoundException

springframeworkweblogic

I was given an "EAR" file and told to try to deploy it on an Oracle WebLogic server. I had successfully deployed it on a IBM WebSphere server. When I attempt to start it on WebLogic, however, I get the following error:

Could not load user defined listener:
org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException:
org.springframework.web.context.ContextLoaderListener
at
weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:296)
at
weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:269)
at
weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:56)
at
java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at
java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at
weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:177)
at
weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:37)
at

I've checked that spring.war is in WEB-INF/lib in the appropriate war files.

What am I missing?

Best Answer

If you want it to load libs from your WEB-INF/lib directory then you need to add something to your weblogic.xml file (this should be in WEB-INF).

<weblogic-web-app>
   <container-descriptor>
      <prefer-web-inf-classes>true</prefer-web-inf-classes>
   </container-descriptor>
</weblogic-web-app>

Hope that helps.