I am facing some issue in my project which is a Spring MVC project. In this project, for persistence layer, we are using Hibernate.
Below is my web.xml
details:
<servlet>
<servlet-name>spring</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/beanRefFactory.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
When I try to run this project, I get the following error:
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1688)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1533)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:525)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:507)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:124)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4701)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5260)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1525)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1515)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Here is my classpath jar details:
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/ant-1.6.5.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/ant-antlr-1.6.5.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/antlr-2.7.6.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/aopalliance-1.0.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/asm-attrs.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/asm.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/aspectjweaver-1.6.9.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/c3p0-0.9.1.2.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/c3p0-0.9.1.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/cglib-2.1.3.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/cglib-2.2.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/cglib-nodep-2.2.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/commons-collections-3.1.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/commons-collections-3.2.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/commons-dbcp-1.4.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/commons-logging-1.1.1.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/commons-pool-1.5.3.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/dom4j-1.6.1.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/ehcache-1.2.3.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/ejb3-persistence.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/hibernate-annotations.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/hibernate-commons-annotations.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/hibernate-entitymanager.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/hibernate-search.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/hibernate-validator.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/hibernate3.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/javassist-3.9.0.GA.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/jta-1.1.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/jta.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/lucene-core-2.3.0.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/oscache-2.4.1.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/spring/antlr-runtime-3.0.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/spring/commons-beanutils-1.8.3.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/spring/commons-configuration-1.4.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/spring/commons-logging-1.0.4.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/spring/jstl.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/spring/log4j-1.2.16.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/spring/org.springframework.asm-3.0.0.M3.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/spring/org.springframework.beans-3.0.0.M3.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/spring/org.springframework.context-3.0.0.M3.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/spring/org.springframework.context.support-3.0.0.M3.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/spring/org.springframework.core-3.0.0.M3.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/spring/org.springframework.expression-3.0.0.M3.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/spring/org.springframework.jdbc-3.1.1.RELEASE.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/spring/org.springframework.transaction-3.1.1.RELEASE.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/spring/org.springframework.web-3.0.0.M3.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/spring/org.springframework.web.servlet-3.0.0.M3.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/spring/slf4j-api-1.6.6.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/spring/slf4j-log4j12-1.6.6.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/spring/spring-orm-3.2.0.M1.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/spring/spring-oxm-3.2.0.M1.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/spring/standard.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/misslenious/mysql-connector-java-5.1.8-bin.jar"/>
Any pointer or help is very appreciable. Thanks in advance.
ContextLoaderListner is a Servlet listener that loads all the different configuration files (service layer configuration, persistence layer configuration etc) into single spring application context. This helps to split spring configurations across multiple XML files.
You are missing spring-web jar (spring-web-3.2.0.M2.jar) in your classpath which contains this class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With