Debuging java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener in Eclipse, tomcat, maven

Thursday, January 28th, 2010

If you’re developing a spring-enabled web application using the combination of Eclipse, Tomcat and Maven. You might encounter the following error when you try to start tomcat within eclipse.

Error configuring application listener of class org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3773)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4337)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

You’ll need to configure your eclipse project settings by:

  1. Right click on the project in eclipse on the left panel under the package explorer view.
  2. Click Java EE Module Dependencies.
  3. Check (make sure the checkbox is ticked) the Maven Dependencies option (the last option).
Advertisement

6 comments on “Debuging java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener in Eclipse, tomcat, maven

  1. Pekka says:

    Thanks, this really helped me! The error message didn’t really give that much information about the cause of the problem.

  2. Jen says:

    Thanks SO much for posting this. I have been going crazy trying to figure out whether my dependencies were wrong, or what!

  3. Zack says:

    I owe you a lunch!
    Thanks a bunch for the info.

  4. RK says:

    Thanks for this tip. It was valuable

  5. trupti says:

    Hello there,

    I too get the same error, but when I try to follow your steps, there is no “Java EE Module Dependencies” under project properties. How do I proceed now?! I’m using Eclipse Helios for Java EE with Maven and Tomcat running from within Eclipse. Please help!

    Thanks,
    Trupti

  6. Hollywood says:

    2 trupi

    Java EE Module Dependencies is replaced by Web Deployment Assembly
    http://www.mkyong.com/eclipse/eclipse-java-ee-module-dependencies-is-replaced-by-web-deployment-assembly/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.