首次接触maven,导入的工程其中一个maven没配好,Tomcat可以正常启动,但是部署某maven工程后不能启动,部署其他项目可以。
错误信息:
三月 10, 2015 9:05:03 上午 org.apache.tomcat.util.digester.SetPropertiesRule begin 警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:iam' did not find a matching property. 三月 10, 2015 9:05:03 上午 org.apache.catalina.startup.VersionLoggerListener log 信息: Server version: Apache Tomcat/7.0.59 三月 10, 2015 9:05:03 上午 org.apache.catalina.startup.VersionLoggerListener log 信息: Server built: Jan 28 2015 15:51:10 UTC 三月 10, 2015 9:05:03 上午 org.apache.catalina.startup.VersionLoggerListener log 信息: Server number: 7.0.59.0 三月 10, 2015 9:05:03 上午 org.apache.catalina.startup.VersionLoggerListener log 信息: OS Name: Windows 7 三月 10, 2015 9:05:03 上午 org.apache.catalina.startup.VersionLoggerListener log 信息: OS Version: 6.1 三月 10, 2015 9:05:03 上午 org.apache.catalina.startup.VersionLoggerListener log 信息: Architecture: x86 三月 10, 2015 9:05:03 上午 org.apache.catalina.startup.VersionLoggerListener log 信息: Java Home: C:\Program Files\Java\jdk1.7.0_75\jre 三月 10, 2015 9:05:03 上午 org.apache.catalina.startup.VersionLoggerListener log 信息: JVM Version: 1.7.0_75-b13 三月 10, 2015 9:05:03 上午 org.apache.catalina.startup.VersionLoggerListener log 信息: JVM Vendor: Oracle Corporation 三月 10, 2015 9:05:03 上午 org.apache.catalina.startup.VersionLoggerListener log 信息: CATALINA_BASE: D:\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0 三月 10, 2015 9:05:03 上午 org.apache.catalina.startup.VersionLoggerListener log 信息: CATALINA_HOME: D:\apache-tomcat-7.0.59-windows-x86\apache-tomcat-7.0.59 三月 10, 2015 9:05:03 上午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:50216 三月 10, 2015 9:05:03 上午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Xms512m 三月 10, 2015 9:05:03 上午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Xmx512m 三月 10, 2015 9:05:03 上午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -XX:PermSize=128M 三月 10, 2015 9:05:03 上午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -XX:MaxNewSize=256m 三月 10, 2015 9:05:03 上午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -XX:MaxPermSize=256m 三月 10, 2015 9:05:03 上午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dcatalina.base=D:\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0 三月 10, 2015 9:05:03 上午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dcatalina.home=D:\apache-tomcat-7.0.59-windows-x86\apache-tomcat-7.0.59 三月 10, 2015 9:05:03 上午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dwtp.deploy=D:\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps 三月 10, 2015 9:05:03 上午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Djava.endorsed.dirs=D:\apache-tomcat-7.0.59-windows-x86\apache-tomcat-7.0.59\endorsed 三月 10, 2015 9:05:03 上午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dfile.encoding=UTF-8 三月 10, 2015 9:05:03 上午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent 信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.7.0_75\bin;C:\windows\Sun\Java\bin;C:\windows\system32;C:\windows;C:\Program Files\Java\jdk1.7.0_75\jre\bin;C:/Program Files/Java/jdk1.7.0_75/bin/../jre/bin/client;C:/Program Files/Java/jdk1.7.0_75/bin/../jre/bin;C:/Program Files/Java/jdk1.7.0_75/bin/../jre/lib/i386;C:\Program Files\AMD APP\bin\x86;C:\Program Files\Common Files\NetSarang;D:\Program Files\MySQL\MySQL Server 5.5\bin;C:\Program Files\Java\jdk1.7.0_75\bin;C:\ProgramData\Oracle\Java\javapath;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;D:\Program Files\MySQL\MySQL Server 5.5\bin;D:\Program Files\TortoiseSVN\bin;D:\apache-maven-3.2.1\bin;C:\Program Files\ATI Technologies\ATI.ACE\Core-Static;D:\Program Files\eclipse-jee;;. 三月 10, 2015 9:05:03 上午 org.apache.coyote.AbstractProtocol init 信息: Initializing ProtocolHandler ["http-bio-8080"] 三月 10, 2015 9:05:03 上午 org.apache.coyote.AbstractProtocol init 信息: Initializing ProtocolHandler ["ajp-bio-8009"] 三月 10, 2015 9:05:03 上午 org.apache.catalina.startup.Catalina load 信息: Initialization processed in 841 ms SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. 三月 10, 2015 9:05:04 上午 org.apache.catalina.core.StandardService startInternal 信息: Starting service Catalina 三月 10, 2015 9:05:04 上午 org.apache.catalina.core.StandardEngine startInternal 信息: Starting Servlet Engine: Apache Tomcat/7.0.59 三月 10, 2015 9:05:09 上午 org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom 信息: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [591] milliseconds. 三月 10, 2015 9:05:17 上午 org.apache.catalina.core.ContainerBase startInternal 严重: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/iam]] at java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.util.concurrent.FutureTask.get(FutureTask.java:188) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:816) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565) 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) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/iam]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) ... 6 more Caused by: java.lang.NoClassDefFoundError: Lorg/springframework/web/context/ContextLoaderListener; at java.lang.Class.getDeclaredFields0(Native Method) at java.lang.Class.privateGetDeclaredFields(Class.java:2499) at java.lang.Class.getDeclaredFields(Class.java:1811) at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106) at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:270) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationListenerAnnotations(WebAnnotationSet.java:89) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:63) at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:415) at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:892) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:386) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5412) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ... 6 more Caused by: 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) ... 20 more 三月 10, 2015 9:05:17 上午 org.apache.catalina.core.ContainerBase startInternal 严重: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]] at java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.util.concurrent.FutureTask.get(FutureTask.java:188) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123) at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:300) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:739) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.startup.Catalina.start(Catalina.java:689) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:321) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:455) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565) 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) Caused by: org.apache.catalina.LifecycleException: A child container failed during start at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1131) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:816) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ... 6 more 三月 10, 2015 9:05:17 上午 org.apache.catalina.startup.Catalina start 严重: The required Server component failed to start so Tomcat is unable to start. org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) at org.apache.catalina.startup.Catalina.start(Catalina.java:689) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:321) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:455) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Catalina]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:739) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ... 7 more Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ... 9 more Caused by: org.apache.catalina.LifecycleException: A child container failed during start at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1131) at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:300) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ... 11 more 三月 10, 2015 9:05:17 上午 org.apache.coyote.AbstractProtocol pause 信息: Pausing ProtocolHandler ["http-bio-8080"] 三月 10, 2015 9:05:17 上午 org.apache.coyote.AbstractProtocol pause 信息: Pausing ProtocolHandler ["ajp-bio-8009"] 三月 10, 2015 9:05:17 上午 org.apache.catalina.core.StandardService stopInternal 信息: Stopping service Catalina 三月 10, 2015 9:05:17 上午 org.apache.coyote.AbstractProtocol destroy 信息: Destroying ProtocolHandler ["http-bio-8080"] 三月 10, 2015 9:05:17 上午 org.apache.coyote.AbstractProtocol destroy
原因:maven依赖配置错误
根目录下的.classpath文件配置没有改动
普通的web项目改为maven项目的步骤:
1.加上一个pom.xml文件;
2.项目根目录下的.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>
3.项目根目录下的.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,错误已经解决!
时隔几个月,每次从svn导入一次就得这样弄一次,今天才发现,是因为从svn导入项目pom.xml的内容发生了变化,今天试着覆盖更新一次,就可以了,完全不用这样改。。。想想也是醉了!
这两个月这种子进程的错误出现了好几次,一般就是包错误或者是配置文件出错,报错误会有报错,配置文件出错的错误信息不明显。要仔细检查。eclipse有时是真抽,尤其是人品不好的时候~~~乖乖攒人品吧,瘸腿的少年~