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

后端 未结 30 1680
南旧
南旧 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: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.

    
        
            
            
        
    
    

    put back

    
    

    and you will be OK.

    thank you /michael

提交回复
热议问题