I included these in the Build Path:
The project still fails during startup:
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.
I was facing the same issue for a eclipse project configured for Tomcat 7 runtime
Right click on project and go to project properties. Click on Deployment Assembly. I could notice that my spring library jars which I created during compile time with a user library was missing. Just add the jars and you should see no errors in console during tomcat start up
I had the same issue. I resolved it by adding spring-web dependency in my pom. Make sure you use spring-web jar which has ContextLoaderListener class extends ContextLoader implements ServletContextListener and reside in the package org.springframework.web.context. I used 3.0.4.RELEASE
One quick solution I prefer which I suited most for this situation is simply delete .metadata folder of your work space and import your projects again. If you try all other option it wont guarantee the success. Sometimes the above solutions work sometime you will spend your precious hours to fix this configuration.
One day i decided to clean my work station.I arranged the projects to their suitable folders according to different clients. As a result all got messed up. After spending a whole day it did not end up in a fixed work space. Next day I simply deleted the .metadata folder of the work space and imported all the projects again. Bingo all set.
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:
This usually fixes the issue you mention.
You have to use at least version 3.2.8.RELEASE
of spring-core.
For Maven, set in your pom.xml
:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.2.8.RELEASE</version>
</dependency>
Source: http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/cglib/core/SpringNamingPolicy.html, since 3.2.8.