Search This Blog

org.springframework.web.context.ContextLoaderListener java.lang.ClassNotFoundException

Error while starting server with maven spring project.

In my case I was using tomcat7 and after adding my war file to server when i was trying to start the server i got below error log

INFO: Starting Servlet Engine: Apache Tomcat/7.0.64
Sep 16, 2015 11:12:18 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
       at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1858)
       at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1709)
       at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:506)
       at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:488)
       at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:115)
       at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4919)
       at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5517)
       at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
       at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1574)
       at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1564)
       at java.util.concurrent.FutureTask.run(FutureTask.java:266)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
       at java.lang.Thread.run(Thread.java:745)

Sep 16, 2015 11:12:18 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Skipped installing application listeners due to previous error(s)
Sep 16, 2015 11:12:18 AM org.apache.catalina.core.StandardContext startInternal

After spending lot of time I figured out that the issue was with maven dependencies not being in deployment assembly and I followed below steps.
Solution

1) Go to project properties
2) Select Deployment Assembly
3) Click on Add
4) Click on Java Build Path Entries
5) Click Next
6) Select Maven Dependencies
7) Click Finish & OK
8) Restart your server

No comments:

Post a Comment