ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

When you happen to work with a Spring MVC Framework based Web application. Then java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener is a common problem which will be occurring during deployment. Spring MVC throws this exception when it is not able to find the “org.springframework.web.context.ContextLoaderListener” class which loads up the all the Spring MVC configuration files and other configuration files which is declared in the web.xml.

 <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value> 
       /WEB-INF/SpringMVC-servlet.xml, 
       /WEB-INF/SpringSecurity.xml 
    </param-value>
 </context-param>

 <listener>
      <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
 </listener>

This exception will mostly happen when you start the server [Read more…]

Difference Between ClassNotFoundException Vs NoClassDefFoundError In Java

ClassNotFoundException  and  NoClassDefFoundError are the most popular exceptions in Java which almost all the Java developers would have come across. Both ClassNotFoundException and NoClassDefFoundError occurs when a particular class is not found during the run time, but at different scenarios ClassNotFoundException occurs when you try to load a class dynamically using Class.forName() or ClassLoader.loadClass() or ClassLoader.findSystemClass() methods while the NoClassDefFoundError  occurs when the class is found during the compile time but not at the run time. In this tutorial lets clearly understand the difference between ClassNotFoundException vs NoClassDefFoundError in Java.

[Read more…]