加载ContextLoaderListener时出现ClassNotFoundException

Rit*_*esh 9 java spring maven

我正在使用spring 3.0,hibernate开发webapp.当我尝试在WAS 7.0上部署我的应用程序时,它给出了错误 - 无法加载侦听器:org.springframework.web.context.ContextLoaderListener]:java.lang.ClassNotFoundException:

以下是我的网络应用的外观:

<?xml version="1.0" encoding="UTF-8"?>
   <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>ABC</display-name>
<welcome-file-list>
    <welcome-file>index.html</welcome-file>
</welcome-file-list>
<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:applicationContext.xml</param-value>
</context-param>
<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
Run Code Online (Sandbox Code Playgroud)

抛出的异常如下,

com.ibm.ws.webcontainer.webapp.WebApp logError SRVE0293E: [Servlet Error]-[Failed to load listener: org.springframework.web.context.ContextLoaderListener]: java.lang.ClassNotFoundException: class java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
at java.beans.Beans.instantiate(Beans.java:190)
at java.beans.Beans.instantiate(Beans.java:75)
at com.ibm.ws.webcontainer.webapp.WebApp.loadListener(WebApp.java:1643)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.loadListener(WebAppImpl.java:671)
at com.ibm.ws.webcontainer.webapp.WebApp.loadLifecycleListeners(WebApp.java:1554)
Run Code Online (Sandbox Code Playgroud)

那么,web.xml中有什么问题吗?

编辑:对不起,我没有提及,我正在使用Maven来获取罐子.我在WEB-INF文件夹中也有所需的jar文件,即org.springframework.web.context

小智 11

请查看以下链接
http://forum.springsource.org/showthread.php?60812-ClassNotFoundException-org.springframework.web.con-text.ContextLoaderListener

它说您可以通过转到项目属性 - >部署程序集并添加Maven依赖项构建路径条目来解决此问题