spring - java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

ID : 10139

viewed : 23

Tags : springtomcat7classnotfoundexceptionspring

Top 5 Answer for spring - java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

vote vote


I had a similar problem when running a spring web application in an Eclipse managed tomcat. I solved this problem by adding maven dependencies in the project's web deployment assembly.

  1. Open the project's properties (e.g., right-click on the project's name in the project explorer and select "Properties").
  2. Select "Deployment Assembly".
  3. Click the "Add..." button on the right margin.
  4. Select "Java Build Path Entries" from the menu of Directive Type and click "Next".
  5. Select "Maven Dependencies" from the Java Build Path Entries menu and click "Finish".

You should see "Maven Dependencies" added to the Web Deployment Assembly definition.

vote vote


Same thing happens to me from time to time when using Eclipse WDT. Its specialy frustrating when this happens to a unmodified and previously working project. This is what I do to fix it in this last scenario:

  1. Stop Tomcat (if it's running)
  2. Open the "Servers" view: Window > Show view > Other > Server > Servers
  3. Right Click on Tomcat Server > Clean Tomcat Work Directory.
  4. Right Click on Tomcat Server > Clean
  5. Restart the server

This usually fixes the issue you mention.

vote vote


I used IntelliJ IDEA, compilation is successful, but when starting Tomcat, it says:

Error configuring application listener of class org.springframework.web.context.ContextLoaderListener java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener 

In the beginning, I thought the JAR was missing, but it was in place.

Solution: File > Project Structure > Artifacts, in the Output Layout double click in right panel Available Elements the library named like Maven:..., it will be moved to WEB-INF/lib in the left pane.

Accept and restart Tomcat.

vote vote


You could try "Clean Tomcat Work Directory" or simply "Clean..". This supposed to discard all published state and republish from scratch.

vote vote


This is surely Eclipse related issue. The thing which worked for me is creating a new server in eclipse server tab. Then run your application in this new server, it should work.

Top 3 video Explaining spring - java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener