org.springframework.web.context.ContextLoaderListe

2019-09-07 02:14发布

问题:

I get the below error when I run my Spring project..I followed multiple SO links and implemented everything but still I have the same problem.

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

I have attached my project Maven depedencies, deployment assembly and wtpwebapps lib folder to show all the dependencies..

Not sure what else Im missing.

Stack

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:1680)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4153)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4709)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1060)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:822)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1060)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
    at org.apache.catalina.core.StandardService.start(StandardService.java:525)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:759)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

回答1:

You should have this in your pom.xml

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-web</artifactId>
    <version>3.0.5.RELEASE</version>
</dependency>

Also you can try:

  • Right click on your project
  • "Propeties"
  • Deployment Assembly
  • Add
  • Java Build Path Entries
  • Maven Dependencies (Selected them all)
  • Finish


回答2:

Your project setup shows there is jar file missing or your are pointing to missing jar file in your project build path.

Right click on your project ==> Go to Build Path ==> In Libraries tab..

You can see the jar files missed with red color cross mark delete them (if you need them add those missing jars in your path)

And re-build the project.