Starting tomcat v9.0 server at localhost error

2019-09-22 02:01发布

问题:

I was trying to start a tomcat v9.0 server at localhost on Spring STS but it pops up following error.

"starting tomcat v9.0 server at localhost has encountered a problem"

There wasn't any process using the port 8080. So this shouldn't be the port 8080 is using another process. Tried changing the ports as well but it gives the same error again and again. Can someone help me to overcome this error.

Following error displays in the console.

Mar 26, 2017 7:30:02 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.j2ee.server:FitnessTracker' did not find a matching property.
Mar 26, 2017 7:30:02 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version:        Apache Tomcat/9.0.0.M18
Mar 26, 2017 7:30:02 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built:          Mar 8 2017 15:20:57 UTC
Mar 26, 2017 7:30:02 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number:         9.0.0.0
Mar 26, 2017 7:30:02 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name:               Windows 10
Mar 26, 2017 7:30:02 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version:            10.0
Mar 26, 2017 7:30:02 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture:          amd64
Mar 26, 2017 7:30:02 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home:             C:\Program Files\Java\jdk1.8.0_121\jre
Mar 26, 2017 7:30:02 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version:           1.8.0_121-b13
Mar 26, 2017 7:30:02 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor:            Oracle Corporation
Mar 26, 2017 7:30:02 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE:         D:\dev\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
Mar 26, 2017 7:30:02 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME:         D:\dev\tools\apache-tomcat-9.0.0.M18
Mar 26, 2017 7:30:02 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=D:\dev\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
Mar 26, 2017 7:30:02 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=D:\dev\tools\apache-tomcat-9.0.0.M18
Mar 26, 2017 7:30:02 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=D:\dev\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
Mar 26, 2017 7:30:02 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=D:\dev\tools\apache-tomcat-9.0.0.M18\endorsed
Mar 26, 2017 7:30:02 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=Cp1252
Mar 26, 2017 7:30:02 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: 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.8.0_121\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Android;C:\Windows\System32;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Skype\Phone\;C:\apache-maven-3.3.9\bin;C:\Program Files (x86)\Java\jdk1.7.0_25\bin;C:\Users\Sameera\AppData\Local\Microsoft\WindowsApps;.
Mar 26, 2017 7:30:02 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
Mar 26, 2017 7:30:03 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Mar 26, 2017 7:30:03 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-nio-8009"]
Mar 26, 2017 7:30:03 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Mar 26, 2017 7:30:03 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1587 ms
Mar 26, 2017 7:30:03 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Mar 26, 2017 7:30:03 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/9.0.0.M18
Mar 26, 2017 7:30:05 PM 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[/FitnessTracker]]
    at java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.util.concurrent.FutureTask.get(FutureTask.java:192)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:959)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:872)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1439)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1429)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:953)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:793)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:655)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:355)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:495)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/FitnessTracker]]
    at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:441)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1439)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1429)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:953)
    ... 21 more
Caused by: java.lang.IllegalArgumentException: Servlet mapping specifies an unknown servlet name fitTracketServlet
    at org.apache.catalina.core.StandardContext.addServletMappingDecoded(StandardContext.java:3153)
    at org.apache.catalina.Context.addServletMappingDecoded(Context.java:879)
    at org.apache.catalina.startup.ContextConfig.configureContext(ContextConfig.java:1378)
    at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1190)
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:775)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:299)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5104)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    ... 27 more

Mar 26, 2017 7:30:05 PM org.apache.catalina.core.ContainerBase startInternal
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: A child container failed during start
    at java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.util.concurrent.FutureTask.get(FutureTask.java:192)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:959)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:793)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:655)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:355)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:495)
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:968)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:872)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1439)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1429)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:953)
    ... 13 more

Mar 26, 2017 7:30:05 PM org.apache.catalina.startup.Catalina start
SEVERE: The required Server component failed to start so Tomcat is unable to start.
org.apache.catalina.LifecycleException: A child container failed during start
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:968)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:793)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:655)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:355)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:495)

Mar 26, 2017 7:30:05 PM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-nio-8080"]
Mar 26, 2017 7:30:05 PM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["ajp-nio-8009"]
Mar 26, 2017 7:30:05 PM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Catalina
Mar 26, 2017 7:30:05 PM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["http-nio-8080"]
Mar 26, 2017 7:30:05 PM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["ajp-nio-8009"]

回答1:

Two things you have to verify before start tomcat server in eclipse.

  1. Port availability:
    If your tomcat server ports are already used, kill those process.
    windows: netstat -aon |find /i "listening" |find "port_num"
                    taskkill /F /PID "here PID which you get from previous command"
    Linux: sudo netstat -plten |grep java
                        kill -9 "here PID which you get from previous commanand"
    Your can find tomcat server port in server.xml in conf folder.

  2. Apache common logging libs.
    Most of the servlet beginners are doesn't know to add Apache common logging library. Download the jars from here:
    https://commons.apache.org/proper/commons-logging/download_logging.cgi

After these processes try to start apache tomcat server. I hope this may be helped you.