Java 我的应用程序没有看到ContextLoaderListener

Java 我的应用程序没有看到ContextLoaderListener,java,spring,jakarta-ee,Java,Spring,Jakarta Ee,我有一个使用Spring3.0.3的应用程序。所有需要的jar都已添加,但当我在eclipse中运行它时,会发生以下错误: java.lang.ClassNotFoundException:org.springframework.web.context.ContextLoaderListener 我打开了org.springframework.web-sources-3.0.3.RELEASE.jar,可以看到ContextLoader.java文件!!!! 以下是web.xml配置: <

我有一个使用Spring3.0.3的应用程序。所有需要的jar都已添加,但当我在eclipse中运行它时,会发生以下错误: java.lang.ClassNotFoundException:org.springframework.web.context.ContextLoaderListener

我打开了org.springframework.web-sources-3.0.3.RELEASE.jar,可以看到ContextLoader.java文件!!!! 以下是web.xml配置:

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
    /WEB-INF/applicationContext.xml     


    </param-value>
</context-param>

<listener>
 <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

上下文配置位置
/WEB-INF/applicationContext.xml
org.springframework.web.context.ContextLoaderListener
你是如何运行你的应用程序的?如果使用tomcat,请确保所需的jar存在于tomcat的lib文件夹中,或者在
WEB-INF
目录中创建一个名为
lib
的目录,并将所有spring jar放在该目录中


在eclipse中开发时,将JAR放在类路径上是可以的,但要运行应用程序,容器(tomcat等)应该知道这一点,唯一的方法是将JAR放在
lib
目录中。

applicationContext.xml应该放在类路径中,你能从你的项目构建路径检查它吗?你的意思是我必须在java构建路径中添加applicationContext.xml吗?@NGSyes你应该将它添加到你的构建路径
org.springframework.web-sources-3.0.3.RELEASE.jar
包含源代码而不是二进制文件。您需要在
WEB-INF/lib
中使用不带
-sources
前缀的jar。