maven 导入项目中经常出现这个问题

严重: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

在网上找了些资料,有的说是少jar包,把有关spring的jar包复制到/WEB-INF/lib下面就行了,但这是maven项目,不需要这样做...

还有一个原因是,项目不是maven项目,我这个之前是普通的web项目,只是加上了一个pom.xml而已
需要修改的有两个地方
1.项目根目录下的.project文件,用记事本打开,加入以下代码(把原来的<buildSpec>节点和<natures>替换了):

<buildSpec>
<buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.maven.ide.eclipse.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.maven.ide.eclipse.maven2Nature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>

2.项目根目录下的.classpath,找到

<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>

替换为:

<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>

新增加一个classpathentry节点:

<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>

OK,到这一步已经完成了,到eclipse中刷新项目,然后重新启动tomcat,错误已经解决!

在.classpath文件中:

<classpathentry kind="output" path="target/classes"/>

改为:

<classpathentry kind="output" path="WebContent/WEB-INF/classes"/>

习惯,^_^,把编译后的文件放到WEB-INF/classes下面

转载自  http://www.cnblogs.com/zhouyalei/archive/2011/11/30/2268606.html

maven 项目出现 java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener的更多相关文章

  1. 【转】maven 项目出现 java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

    http://blessht.iteye.com/blog/1104450 http://www.cnblogs.com/zhouyalei/archive/2011/11/30/2268606.ht ...

  2. 真正解决问题:maven eclipse tomcat java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

    在使用eclipse进行整合springmvc时经常会碰到这样的异常: java.lang.ClassNotFoundException:org.springframework.web.context ...

  3. springmvc项目中java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

    java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener 严重: Error co ...

  4. maven 项目启动tomcat报错 java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

    maven项目启动tomcat报错: java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderLi ...

  5. 部署Maven项目到tomcat报错:java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener【转】

    部署Maven项目到tomcat报错:java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderLi ...

  6. maven创建spring项目之后,启动报错java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

    出错情景:maven中已经加载了spring的核心包,但是项目启动时,报错: org.apache.catalina.core.StandardContext listenerStart严重: Err ...

  7. 真正解决问题:maven eclipse tomcat java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener--转

    原文地址:http://www.cnblogs.com/amosli/p/4067665.html 在使用eclipse进行整合springmvc时经常会碰到这样的异常: java.lang.Clas ...

  8. 使用eclipse启动tomcat里的项目时报错:java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

    1.这种错:java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener刚开始看的时候 ...

  9. java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener,环境Spring+Maven

    记录一下莫名出现的错误.Spring+Maven+STS. 严重: Error configuring application listener of class org.springframewor ...

随机推荐

  1. SuperSocket基础(二)-----一个完成SocketServer项目

    SuperSocket基础(二)-----一个完成SocketServer项目 由于时间关系未能及时更新,关于SuperSocket,对于初学者而言,一个SuperSock的Server真的不好写.官 ...

  2. Redis笔记——技术点汇总

    目录 · 特点 · 安装 · 数据库 · 服务器命令 · 数据类型及其操作命令 · 数据结构 · string · list · set · hash · zset · 发布与订阅 · 排序 · 事务 ...

  3. CSS 常用样式 提高网页编写速度

    *{margin:0px;padding:0px;}/*内外边距初始化*/html, body, div, h1, h2, h3, h4, h5, h6, p, span, img, input, t ...

  4. JSP知识点大致介绍1

    解释:当jsp写好,运行服务器,还没有发出请求(写网址按Enter),Tomcat的work下是没有字节码文件的.当写网址:localhost:8888/xxxx/index.jsp按Enter,运行 ...

  5. MySQL插入、更新、删除数据

    1.插入数据:由于下表的id会自增,故赋值null. 注意:字符串用'   '单引号,不能双引号,英文状态下. 可以写上部分属性名进行插入操作,如bookTypeId没写,默认NULL. 也可以写上所 ...

  6. Kettle6.0表输入连接数据库

    kettle6.0表输入我们需要从数据中获取数据的时候,需要和数据库建立连接,简单的说下步骤: 1.双击表输入: 2.点击"新建",输入参数值: 注意:数据库用户名可以通过sql进 ...

  7. 第二篇--Jmeter测试Java请求

    前提:需要准备eclipse作为开发工具,安装jdk,准备完毕,接下来开工喽! 1.新建Java工程BMIrisJNIJarTest,新建lib目录,将Jmeter安装目录下lib/ext包下的Apa ...

  8. POI 自用API

    poi包下载 API 使用POI生成Excel,大家都是赞个.可是狐狸觉得毕竟不是微软的产品,使用没有C#语言的好用,方法还是存在极限的. 下面总结狐狸自己用过的方法: import org.apac ...

  9. 有哪些关于 Python 的技术博客?

    Python是一种动态解释型的编程语言,它可以在Windows.UNIX.MAC等多种操作系统以及Java..NET开发平台上使用.不过包含的内容很多,加上各种标准库.拓展库,乱花渐欲迷人眼.因此如何 ...

  10. TC358749XBG:HDMI转MIPI CSI芯片简介

    TC358749XBG是一颗HDMI转MIPI CSI功能的视频转换芯片,分辨率:1920*1080,电源3.3/1.8/1.2,通信方式:IIC,封装形式BGA80