ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
If you ever want to access the Servlet context during startup of your web application spring provides a
ContextLoaderListener, that can easily be plugged into web.xml
Some of the most common use cases of ContextLoaderListener are:
1) During startup of the web application, if I want to load some static or configuration data from database and keep in the memory.
2) During startup and before destroy of my web application, If I want to get notify.
3) If I want to have a programatic configuration of spring, instead of from static context file.
You must configure the listner in your web.xml as shown below:
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
|
And make sure that you have included spring-web.jar dependency in your pom.xml file as shown below:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.2.0.RELEASE</version>
</dependency>
|
|