servlet提示:server tomcat v7.0 server at localhost failed to start

eclipse上编写了一个servlet的demo,编译运行时提示:

wKiom1MlW9WyL8oKAACsloOZVxs457.jpg

通过eclipse的Console窗口可以看到以下提示:

三月 16, 2014 4:04:17 下午 org.apache.catalina.core.AprLifecycleListener init

INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\Java\jre7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;D:\Java\jdk1.7.0_21\bin;D:\Program Files\TortoiseGit\bin;D:\Python27;D:\Python27\Lib\site-packages\django\bin;D:\Program Files\TortoiseSVN\bin;.

三月 16, 2014 4:04:18 下午 org.apache.tomcat.util.digester.SetPropertiesRule begin

WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:cmgdemo' did not find a matching property.

三月 16, 2014 4:04:18 下午 org.apache.coyote.AbstractProtocol init

INFO: Initializing ProtocolHandler ["http-bio-8080"]

三月 16, 2014 4:04:18 下午 org.apache.coyote.AbstractProtocol init

INFO: Initializing ProtocolHandler ["ajp-bio-8009"]

三月 16, 2014 4:04:18 下午 org.apache.catalina.startup.Catalina load

INFO: Initialization processed in 989 ms

三月 16, 2014 4:04:18 下午 org.apache.catalina.core.StandardService startInternal

INFO: Starting service Catalina

三月 16, 2014 4:04:18 下午 org.apache.catalina.core.StandardEngine startInternal

INFO: Starting Servlet Engine: Apache Tomcat/7.0.47

三月 16, 2014 4:04:19 下午 org.apache.catalina.core.ContainerBase startInternal

SEVERE: A child container failed during start

java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/cmgdemo]]

at java.util.concurrent.FutureTask$Sync.innerGet(Unknown Source)

at java.util.concurrent.FutureTask.get(Unknown Source)

at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)

at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:800)

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$Sync.innerRun(Unknown Source)

at java.util.concurrent.FutureTask.run(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/cmgdemo]]

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)

... 7 more

Caused by: java.lang.IllegalArgumentException: The servlets named [Demo] and [cn.chenmg.Servlet.Demo] are both mapped to the url-pattern [/demo] which is not permitted

at org.apache.catalina.deploy.WebXml.addServletMapping(WebXml.java:335)

at org.apache.catalina.startup.ContextConfig.processAnnotationWebServlet(ContextConfig.java:2466)

at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2148)

at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2109)

at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2102)

at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2102)

at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2102)

at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1293)

at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:878)

at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:376)

at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)

at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)

at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5322)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)

... 7 more


三月 16, 2014 4:04:19 下午 org.apache.catalina.core.ContainerBase startInternal

SEVERE: 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$Sync.innerGet(Unknown Source)

at java.util.concurrent.FutureTask.get(Unknown Source)

at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)

at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:302)

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:732)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)

at org.apache.catalina.startup.Catalina.start(Catalina.java:691)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322)

at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:456)

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:1559)

at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)

at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)

at java.util.concurrent.FutureTask.run(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

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:800)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)

... 7 more


三月 16, 2014 4:04:19 下午 org.apache.catalina.startup.Catalina start

SEVERE: 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:691)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322)

at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:456)

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:732)

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:302)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)

... 11 more


三月 16, 2014 4:04:19 下午 org.apache.coyote.AbstractProtocol pause

INFO: Pausing ProtocolHandler ["http-bio-8080"]

三月 16, 2014 4:04:19 下午 org.apache.coyote.AbstractProtocol pause

INFO: Pausing ProtocolHandler ["ajp-bio-8009"]

三月 16, 2014 4:04:19 下午 org.apache.catalina.core.StandardService stopInternal

INFO: Stopping service Catalina

三月 16, 2014 4:04:19 下午 org.apache.coyote.AbstractProtocol destroy

INFO: Destroying ProtocolHandler ["http-bio-8080"]

三月 16, 2014 4:04:19 下午 org.apache.coyote.AbstractProtocol destroy

INFO: Destroying ProtocolHandler ["ajp-bio-8009"]

通过寻找“Caused by”定位问题,如上红色字体的提示,表明<url-pattern></url-pattern>标签定义为demo是不允许的,但是应该不会是java规定不允许创建"demo"这个映射名词,虽然实际上内容改为非“demo”确实可以编译通过。

进一步查看代码发现原来servlet类里面已经有一个:@WebServlet("/demo"),这好像是一个新特性,可以免去自己在web.xml中修改映射关系的过程,有可能是有重复定义的嫌疑,导致编译出错。

但是又发现一个问题,自己手动改web.xml的<url-pattern></url-pattern>和servlet自定义的语句不一样之后,在jsp的action属性中无论设置哪个都可以跳转,这算是一个优点还是一个bug呢?


你可能感兴趣的:(java,tomcat,servlet)