加载ContextLoaderListener时出现ClassNotFoundException [英] ClassNotFoundException while loading ContextLoaderListener

查看:483
本文介绍了加载ContextLoaderListener时出现ClassNotFoundException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am working on a webapp, using spring 3.0, hibernate. When I try to deploy my app on WAS 7.0, it gives me the error - Failed to load listener: org.springframework.web.context.ContextLoaderListener]: java.lang.ClassNotFoundException:

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

Here is how my web app looks:

<?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>



抛出的异常如下,

The exception being thrown is as follows,

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)

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

So, is there anything wrong in web.xml ?

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

Sorry I did not mention, I am using Maven to get the jars. I have the required jar file in the WEB-INF folder too i.e. org.springframework.web.context

推荐答案

看看以下链接

http://forum.springsource.org/showthread.php?60812-ClassNotFoundException-org.springframework.web.con-text.ContextLoaderListener

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

It says you can fix this problem by going to project properties -> Deployment Assembly and adding the Maven Dependency Build Path entry

这篇关于加载ContextLoaderListener时出现ClassNotFoundException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆