SSM项目启动tomcat抛出ClassNotFoundException
来源:互联网 发布:淘宝客怎么加群 编辑:程序博客网 时间:2024/05/01 23:34
项目采用ssm框架,我为了让项目的jar包可以让其他project也可以使用,将项目需要的jar包放进一个Faceted Project中,这是模仿之前实习公司的作法,然后配置web.xml、applicationContext.xml等,各项完事,在BuildPath正常,但是在启动tomcat时反复提示
java.lang.ClassNotFoundException:org.springframework.web.context.ContextLoaderListener
我就很纳闷,然后突然想起来之前遇到类似的问题,是通过修改项目的.classpath文件解决,我于是打开了该文件,果然看到原本正确的设置是这样:
...... <classpathentry kind="lib" path="/Lib/castor-1.0.1-xml.jar"> <attributes> <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/> </attributes> </classpathentry> <classpathentry kind="lib" path="/Lib/commons-beanutils.jar"> <attributes> <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/> </attributes> </classpathentry> <classpathentry kind="lib" path="/Lib/commons-collections-3.2.1.jar"> <attributes> <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/> </attributes> </classpathentry> <classpathentry kind="lib" path="/Lib/commons-dbcp-1.4.jar"> <attributes> <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/> </attributes> </classpathentry> <classpathentry kind="lib" path="/Lib/commons-digester.jar">......
但我的是这样的
...... <attributes> <attribute name="owner.project.facets" value="java"/> </attributes> </classpathentry> <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/> <classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v7.0"> <attributes> <attribute name="owner.project.facets" value="jst.web"/> </attributes> </classpathentry> <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/> <classpathentry kind="lib" path="/Lib/antlr-2.7.6.jar"/> <classpathentry kind="lib" path="/Lib/aopalliance-1.0.jar"/> <classpathentry kind="lib" path="/Lib/cglib-2.2.jar"/> <classpathentry kind="lib" path="/Lib/com.springsource.org.aspectj.weaver-1.6.8.RELEASE.jar"/> <classpathentry kind="lib" path="/Lib/commons-collections-3.1.jar"/> <classpathentry kind="lib" path="/Lib/commons-fileupload-1.2.1.jar"/> <classpathentry kind="lib" path="/Lib/commons-io-1.3.2.jar"/> <classpathentry kind="lib" path="/Lib/commons-lang.jar"/> <classpathentry kind="lib" path="/Lib/commons-logging-1.1.1.jar"/> <classpathentry kind="lib" path="/Lib/dom4j-1.6.1.jar"/>......
也就是如果通过引用外部项目的jar包后需要.classpath文件中设置依赖路径,否则myeclipse就找到这些jar包,就会报出那个错误。
于是将文件中的 />
替换为 ><attributes><attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/></attributes></classpathentry>
问题解决。
这个问题充分说明,每个人问题都不一定是一样的,遇到问题还是需要自己找到问题的根源去解决。只在网上搜是治标不治本的。
0 0
- SSM项目启动tomcat抛出ClassNotFoundException
- tomcat启动项目时抛出的严重错误
- tomcat启动项目报错:Java.lang.classnotfoundexception filterconfig
- Eclipse中启动Tomcat时抛出异常:java.lang.ClassNotFoundException: org.apache.juli.logging.LogFactory的解决办法
- ssm项目中class.forName抛出异常
- 【项目启动】 tomcat启动,项目无法启动,无法正常访问/项目可以启动,报错:java.lang.ClassNotFoundException: ContextLoaderListener
- Tomcat启动报错,ClassNotFoundException
- Tomcat启动报错,ClassNotFoundException
- 关于Tomcat启动项目时,控制台抛出各种异常,误以为项目错误
- Intellij IDEA 启动项目ClassNotFoundException
- Intellij IDEA 启动项目ClassNotFoundException
- ssm启动tomcat时报错
- tomcat启动maven依赖项目报错:java.lang.ClassNotFoundException: com.test.core.listener.ContextParameterLi
- tomcat启动提示端口被占用 maven项目 java.lang.ClassNotFoundException: org.springframework.web.servlet.Dispatche
- maven项目在tomcat启动的时候报java.lang.ClassNotFoundException
- eclipse maven项目用tomcat启动报错 java.lang.ClassNotFoundException
- 启动Tomcat,抛出java.io.IOException异常
- linux下安装tomcat,启动抛出异常
- 你的
- 莫名其妙
- 杭电2955Robberies(01背包)
- lkeetcode 57. Insert Interval
- Oracle学习笔记四 --- 变量及表管理
- SSM项目启动tomcat抛出ClassNotFoundException
- ML:Scikit-Learn 学习笔记(1) --- Nearest Neighbors 最近邻 综述
- poj 2663 (轮廓线dp)
- No tag "datetimepicker" defined in tag library imported with prefix "s"
- 白板讲解
- MVC3写的一个留言板
- 承诺
- 爱情游戏
- 简单的色调