maven的java web项目启动找不到Spring ContextLoaderListener的解决办法
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_16485855/article/details/70208204
用maven搭建的java web项目,上传到git仓库后,当同事clone下来项目,部署到tomcat运行时,就报了如下错误,即启动web项目时,加载web.xml文件,找不到spring的监听器,控制台错误如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
十月 30, 2015
4:42:36
下午 org.apache.catalina.core.AprLifecycleListener init
信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:Java64jdk1.7.0_55in;C:WINDOWSSunJavain;C:WINDOWSsystem32;C:WINDOWS;C:Java64jdk1.7.0_55jrein;c:Program Files (x86)InteliCLS Client;c:Program FilesInteliCLS Client;C:WINDOWSsystem32;C:WINDOWS;C:WINDOWSSystem32Wbem;C:WINDOWSSystem32WindowsPowerShellv1.0;C:Program FilesIntelIntel(R) Management Engine ComponentsDAL;C:Program FilesIntelIntel(R) Management Engine ComponentsIPT;C:Program Files (x86)IntelIntel(R) Management Engine ComponentsDAL;C:Program Files (x86)IntelIntel(R) Management Engine ComponentsIPT;C:Java64jdk1.7.0_55in;D:Program FilesMySQLMySQL Server 5.5in;D:developerapache-maven-3.1.1in;C:Program Files odejs;C:Program FilesTortoiseGitin;C:Program Files (x86)SkypePhone;C:Program Files (x86)Microsoft SDKsTypeScript1.0;C:UsersvanAppDataLocalAndroidsdkplatform-tools;C:UsersvanAppDataLocalAndroidsdk ools;d:Program FilesGitcmd;d:Program FilesGitmingw64in;d:Program FilesGitusrin;C:UsersvanAppDataRoaming pm;.
十月 30, 2015
4:42:36
下午 org.apache.tomcat.util.digester.SetPropertiesRule begin
警告: [SetPropertiesRule]{Server/Service/Engine/Host} Setting property 'xmlNamespaceAware'
to 'false'
did not find a matching property.
十月 30, 2015
4:42:37
下午 org.apache.tomcat.util.digester.SetPropertiesRule begin
警告: [SetPropertiesRule]{Server/Service/Engine/Host} Setting property 'xmlValidation'
to 'false'
did not find a matching property.
十月 30, 2015
4:42:37
下午 org.apache.tomcat.util.digester.SetPropertiesRule begin
警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property
'source'
to 'org.eclipse.jst.j2ee.server:dsx-app'
did not find a matching property.
十月 30, 2015
4:42:37
下午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["http-bio-8080"]
十月 30, 2015
4:42:37
下午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["ajp-bio-8019"]
十月 30, 2015
4:42:37
下午 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 1064
ms
十月 30, 2015
4:42:37
下午 org.apache.catalina.core.StandardService startInternal
信息: Starting service Catalina
十月 30, 2015
4:42:37
下午 org.apache.catalina.core.StandardEngine startInternal
信息: Starting Servlet Engine: Apache Tomcat/7.0.53
十月 30, 2015
4:42:38
下午 org.apache.catalina.util.SessionIdGenerator createSecureRandom
信息: Creation of SecureRandom instance for
session ID generation using [SHA1PRNG] took [132] milliseconds.
十月 30, 2015
4:42:38
下午 org.apache.catalina.core.StandardContext listenerStart
严重: 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:1720)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:529)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:511)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:139)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4888)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
十月 30, 2015
4:42:38
下午 org.apache.catalina.core.StandardContext listenerStart
严重: Skipped installing application listeners due to previous error(s)
十月 30, 2015
4:42:38
下午 org.apache.catalina.core.StandardContext startInternal
严重: Error listenerStart
十月 30, 2015
4:42:38
下午 org.apache.catalina.core.StandardContext startInternal
严重: Context [/dsx-app] startup failed due to previous errors
十月 30, 2015
4:42:38
下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-bio-8080"]
十月 30, 2015
4:42:38
下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["ajp-bio-8019"]
十月 30, 2015
4:42:38
下午 org.apache.catalina.startup.Catalina start
信息: Server startup in 1363
ms
这,这个错误真心让人醉了,究竟是怎么回事,我本地是没问题的啊,为什么同事clone下来就出了这种错误。经过半天研究后发现,不知道什么原因,clone下来后用eclipse导入maven项目后,在他那里用git status命令看了一下,有两个配置文件改变了,一个是.classpath,一个是.project,这两个文件内容变了,当我把这两个文件还原为最初状态后,项目就正常了。
虽然这样能够解决,但是终归不太完美,因为以后新人进来还会出现这种问题!
最后终于找到解决方法,感谢原作者,参考http://www.yihaomen.com/article/java/471.htm
解决方法:
1. 右键单击工程项目 ->点击 properties
2. 选择 Deployment Assembly
3. 点击 Add -> Java Build Path Entries -> Next
4. 选择 Maven Dependencies -> Finish -> Apply -> OK
5. Clean project and server. 重启server
---------------------
作者:梦想的出发点
来源:CSDN
原文:https://blog.csdn.net/qq_16485855/article/details/70208204
版权声明:本文为博主原创文章,转载请附上博文链接!