JAVA EXAMPLE PROGRAMS

JAVA EXAMPLE PROGRAMS

Publish Your Article Here

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>

blog comments powered by Disqus

Java problems and solutions

  1. Unable to install Java 7 in Eclipse on Mac - Java 7 Mac OS issues
  2. How to change Java (JVM) version in Mac OS? - Java version Mac OS issues
  3. SunCertPathBuilderException: Unable To Find Valid Certification Path To Requested Target
  4. How to merge two jssecacerts files? - Merge key store files
  5. How to write Micro-Benchmark for java Hotspot?
  6. servlet-api-2.5.jar - jar not loaded - tomcat error
  7. How to exclude property files in a jar using Maven
  8. ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
  9. CGLIB is required to process @Configuration classes
  10. Git command to list conflicted files
Knowledge Centre
What is fail-fast in java?
A fail-fast system is nothing but immediately report any failure that is likely to lead to failure. When a problem occurs, a fail-fast system fails immediately. In Java, we can find this behavior with iterators. Incase, you have called iterator on a collection object, and another thread tries to modify the collection object, then concurrent modification exception will be thrown. This is called fail-fast.
Famous Quotations
I respect faith, but doubt is what gets you an education.
-- Wilson Mizner

About Author

Most Visited Pages

Other Interesting Sites

Reference: Java™ Platform Standard Ed. 7 - API Specification | Java is registered trademark of Oracle.
Privacy Policy | Copyright © 2017 by Nataraja Gootooru. All Rights Reserved.