Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/opencv/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
java.lang.NoClassDefFoundError:org/springframework/web/context/ContextCleanupListener问题_Spring_Hibernate_Jsp_Authentication_Struts - Fatal编程技术网

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

java.lang.NoClassDefFoundError:org/springframework/web/context/ContextCleanupListener问题,spring,hibernate,jsp,authentication,struts,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.spring

我得到这个错误

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,我做错了什么

问题是,当我尝试转到localhost:8080/spacechip时,我得到“资源不可用”


这是我的配置。

jar可能在您部署的文件夹中,但jar(或带有通配符的部署文件夹)在类路径中吗?

尝试将spring web的依赖关系更改为3.0.5。在pom中,您当前在类路径上有2个版本

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

org.springframework
弹簧网
3.0.5.1发布

EnvironmentAware位于spring-context-3.1.1.RELEASE.jar中,因此您缺少该版本


还要重新检查Maven POM文件,这样您就不会丢失任何其他Spring库,如Spring web、Spring webmvc(如果找到DispatcherServlet类,您可能会有这些库)、Spring orm(如果使用Hibernate之类的orm)、Spring jms(如果使用jms)等等。

我不知道,我如何检查?你是说环境变量还是什么?我在windows中。这个问题的答案取决于你如何运行程序。从命令行,您可以将其添加到CLASSPATH环境变量(Set CLASSPATH=…等),或者使用-cp命令行开关for java.exe,您还可以将其添加到“我的电脑”->“属性”中的类路径。如果它运行在服务器(比如web服务器或类似的服务器)下,那么您必须参考它的文档,因为上述两种情况都不适用。例如,对于LotusDomino,jar必须位于\Notes\JVM\Lib\Ext中(因为没有显式的类路径)。底线是java不会隐式地查找jar文件的任何地方(甚至不是当前的子目录)。它只检查类路径的设置位置。我正在通过tomcat运行它,是否仍然通过命令行添加它?