Tomcat报错 java.lang.ClassNotFoundException:org.springframework.web.context.ContextLoaderListener
2017-11-24 05:15
609 查看
java.lang.ClassNotFoundException错误分析
一个典型的错误:
用eclipse中插件在Tomcat部署spring等时,出现 <php> 严重: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1523) at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:415) at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:397) at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:118) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4660) at org.apache.catalina.core.StandardContext1.call(StandardContext.java:5226) at org.apache.catalina.core.StandardContext1.call(StandardContext.java:5221) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutorWorker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutorWorker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) </php> 当时博主一阵头疼,搞什么,网上一口同声:“你把这个jar build打上勾,添加上,不过也有分析的,第①少包,第②写的对不对”,写的对啊,我的包加载了啊,你们在扯淡吗,,,额,好吧,开始说重点了?
博主是如何做得解决 并给出错误分析 :
作为程序员,先要有不解决问题不睡觉的决心,哈哈!看上述这个问题,我们报这种错误都是配置的spring类,必然是一个web项目,更何况你还用了Tomcat来部署,既然你用了Tomcat服务器,必然项目的class文件以及项目配置都会在Tomcat服务器(也就是Tomcat文件夹)下产生。
网友们说Tomcat的lib缺少jar,却没有说具体,其实他们说的不完全正确,当我去查看我本地的Tomcat安装目录时,发现webapps文件夹并没有项目,甚至连 class文件都没,我们都知道 一个Java程序 必然是从源码 经过编译 才能被运行
那么我们再eclipse中集成的Tomcat编译运行完去了哪里呢?我们要做的就是:
找到它的编译文件,并让它运行在本地的Tomcat中,自然而然 Tomcat就不会说找不到这个类了。
Eclipse启动Web项目,Tomcat中webapps中没有项目文件夹
一直用MyEclipse,后来用Eclipse时,启动项目后去Tomcat webapps找对应文件夹,发现没有,才知道
Eclipse 默认不往本地Tomcat部署项目。
①.eclipse不像MyEclipse默认将项目部署到tomcat安装目录下的webapps中,而默认部署到工作目录下的.metadata.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps中,tmp1文件夹里面存放着该项目的信息。
2.问题的解决:
为了使项目默认部署到tomcat安装目录下的webapps中,show view—>servers—>找到需要修改的tomcat—>右击 后
①停止eclipse内的Tomcat服务器(stop)
②删除该容器中部署的项目(add and remove)
③清除该容器相关数据(clean)
④打开tomcat的修改界面(open)
⑤找到servers location,选择第二个(User tomcat Installation)
⑥修改deploy path为webapps
⑦保存关闭
问题自述:
其实,在这个问题上,我主要是讲如何去思考一个问题,其实每一个问题都是有根源的,就像能量守恒定律一样,不可能凭空存在,一定有某种联系。当我们去转换一个角度去思考,你会发现程序无比精彩。就像该问题,你是否能够思考到是未找到编译的文件? 其实它是一个软件之间的设置(兼容),也可出现成为一出精彩戏剧。
最后希望能和大家一起学习,一起奋斗! 有指正、建议、问题 一起讨论一起解决,GoGo!
2017年11月24日 05:01:58
相关文章推荐
- tomcat启动报错:java.lang.ClassNotFoundException:org.springframework.web.context.ContextLoaderListener
- tomcat启动问题---java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- 启动tomcat出现java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- tomcat : Error configuring application listener of class org.springframework.web.context.ContextLoaderListener java.lang.ClassNotFoundException:
- 真正解决问题:maven eclipse tomcat java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener--转
- Tomcat启动报错:java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- tomcat启动报错:java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- Tomcat运行报错:java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- tomcat启动报错java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- Tomcat 启动报java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener 异常
- maven 项目出现 java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- SSH框架问题——java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener报错
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- 1.java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- maven 项目出现 java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- 启动报错:java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- 关于java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- Java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- 【java】—— 真正解决java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener