java.lang.NoClassDefFoundError:org / springframework / web / context / ContextCleanupListener问题

时间:2014-12-05 19:56:39

标签: spring hibernate jsp authentication struts

我收到此错误

SEVERE: Exception sending context destroyed event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.NoClassDefFoundError: org/springframework/web/context/ContextCleanupListener
        at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:80)
        at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:5035)
        at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5687)
        at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
        at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:1028)
        at org.apache.catalina.startup.HostConfig.undeploy(HostConfig.java:1498)
        at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1425)
        at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1646)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:328)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
        at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1374)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1546)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1556)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1524)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: org.springframework.web.context.ContextCleanupListener
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)
        ... 16 more

我查看我已部署的文件夹但是我看到包含该文件的jar,我做错了什么?

https://github.com/davidahines/spacechip/tree/spring_security

问题在于,当我尝试转到localhost时:8080 / spacechip我得到了#34;资源不可用。"

有我的配置。

3 个答案:

答案 0 :(得分:2)

尝试将spring-web的依赖关系更改为你的pom中的3.0.5.RELEASE,你当前在classpath上有2个版本

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

答案 1 :(得分:1)

jar可能位于已部署的文件夹中,但是CLASSPATH中的jar(或带有通配符的已部署文件夹)?

答案 2 :(得分:0)

EnvironmentAware位于spring-context-3.1.1.RELEASE.jar中,所以你错过了那个。

还要重新检查你的Maven POM文件,这样你就不会错过任何其他Spring库,比如spring-web,spring-webmvc(如果找到DispatcherServlet类,你可能会有这些文件),如果你使用ORM就可以使用spring-orm如果你使用JMS等,Hibernate,spring-jms