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

后端 未结 30 1360
南旧
南旧 2020-11-22 16:58

I included these in the Build Path:

  • all Spring libs
  • Apache Tomcat 7.0 library

The project still fails during startup:

相关标签:
30条回答
  • 2020-11-22 17:14

    If everything mentioned above does not work try the following. It worked for me.

    Remove your project from the server > Restart server > Add your project to server > Restart server.

    Detailed Instruction:

    1. Right click on server > Add and Remove
    2. Select your project > Remove > Finish
    3. Restart your server
    4. Right click on server > Add and Remove
    5. Select your project > Add > Finish
    6. Restart your server again.
    
    0 讨论(0)
  • 2020-11-22 17:14

    If you're using maven, perhaps the project aint built yet. First do a mvn clean package then try redeploying again.

    0 讨论(0)
  • 2020-11-22 17:14

    I have the same issue , and I have resolved it using the steps mentioned above.but no when I have this issue again and i try the following,

    RC(right click on web project) --> properties --> Deployment Assembly --> Add --> Java Build Path Entries --> Next -->

    after clicking on next its only a blank window with the options Next and Fnish disabled.What can I do now?

    0 讨论(0)
  • 2020-11-22 17:15

    I ran into this a couple times a quarter. This time I had a minimal change summary in my git diff and tracked the problem to a reset classpath (missing my WEB-INF/lib dependency) in eclipse. This seems to occur any time I pull in or pull out parent/sibling maven projects.

    There are mentions of adding your spring jars to the tomcat web container lib - this is ok and is the way most EE servers run. However be aware that by placing spring higher in the classloader tree on tomcat you will be running higher than the classloader level of your war context. I recommend you leave the libs in a per/war lower level classloader.

    We see the following after a truncated .classpath after a structural project change in eclipse.

    Dec 18, 2016 11:13:39 PM org.apache.catalina.core.StandardContext listenerStart
    SEVERE: Error configuring application listener of class org.springframework.web.context.request.RequestContextListener
    java.lang.ClassNotFoundException: org.springframework.web.context.request.RequestContextListener
    

    My classpath was reset and the WEB-INF/lib dependency was removed.

    <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
        <attributes>
            <attribute name="maven.pomderived" value="true"/>
            <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
        </attributes>
    </classpathentry>
    

    put back

    <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
    

    and you will be OK.

    thank you /michael

    0 讨论(0)
  • 2020-11-22 17:17

    i too faced the same problem.... and resolved by following the below steps:

    RC(right click on web project) --> properties --> Deployment Assembly --> Add --> Java Build Path Entries --> Next --> select jar files which are missing --> next --> finish

    Application is running successfully...

    0 讨论(0)
  • 2020-11-22 17:18

    I also had the same error. I had not added the below dependency in my POM file.

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

    But My porject used to run even before I had added this dependency. But at one point it stopped and started giving the same above error.

    If any one couldn't solve this error they can also solve by this link

    0 讨论(0)
提交回复
热议问题