正常启动tomcat服务 ./startup.sh
Using CATALINA_BASE: /opt/apache-tomcat-8.0.47
Using CATALINA_HOME: /opt/apache-tomcat-8.0.47
Using CATALINA_TMPDIR: /opt/apache-tomcat-8.0.47/temp
Using JRE_HOME: /opt/jdk1.8.0_191
Using CLASSPATH: /opt/apache-tomcat-8.0.47/bin/bootstrap.jar:/opt/apache-tomcat-8.0.47/bin/tomcat-juli.jar
Tomcat started.
检查tomcat是否已启动,显示未启动 ps -ef | grep java
或 ps -ef | grep tomcat
查看日志
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[imageService]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:789)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
... 7 more
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[imageService]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:441)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
... 9 more
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:951)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
... 11 more
14-Aug-2022 15:51:48.992 INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-nio-8080"]
14-Aug-2022 15:51:49.052 INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["ajp-nio-8009"]
14-Aug-2022 15:51:49.113 INFO [main] org.apache.catalina.core.StandardService.stopInternal Stopping service Catalina
14-Aug-2022 15:51:49.150 INFO [main] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["http-nio-8080"]
14-Aug-2022 15:51:49.152 INFO [main] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["ajp-nio-8009"]
14-Aug-2022 15:51:49.154 INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-nio-8089"]
14-Aug-2022 15:51:49.154 INFO [main] org.apache.catalina.core.StandardService.stopInternal Stopping service imageService
14-Aug-2022 15:51:49.154 INFO [main] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["http-nio-8080"]
14-Aug-2022 15:51:49.158 INFO [main] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["ajp-nio-8009"]
14-Aug-2022 15:51:49.160 INFO [main] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["http-nio-8089"]
14-Aug-2022 15:51:49.160 SEVERE [main] org.apache.coyote.AbstractProtocol.destroy Failed to destroy end point associated with ProtocolHandler ["http-nio-8089"]
java.lang.NullPointerException
at org.apache.tomcat.util.net.NioEndpoint.releaseCaches(NioEndpoint.java:315)
at org.apache.tomcat.util.net.NioEndpoint.unbind(NioEndpoint.java:491)
at org.apache.tomcat.util.net.AbstractEndpoint.destroy(AbstractEndpoint.java:896)
at org.apache.coyote.AbstractProtocol.destroy(AbstractProtocol.java:551)
at org.apache.catalina.connector.Connector.destroyInternal(Connector.java:1023)
at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:292)
at org.apache.catalina.core.StandardService.destroyInternal(StandardService.java:589)
at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:292)
at org.apache.catalina.core.StandardServer.destroyInternal(StandardServer.java:879)
at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:292)
at org.apache.catalina.startup.Catalina.start(Catalina.java:634)
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:351)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:485)
查看了一下我之前配置的server.xml
,之前有配置过tomcat使其成为图片服务器,配置内容如下:
<Service name="imageService">
<Connector port="8089"
protocol="HTTP/1.1"
connectionTimeout="20000"
URIEncoding="GBK"
redirectPort="8443" />
<Engine name="imageService" defaultHost="192.168.2.195">
<Host name="192.168.2.195" appBase="webapps" unpackWARs="true"
autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
<Context path="" docBase="/home/ftpuser/images" debug="0" reloadable="false"/>
Host>
Engine>
Service>
其中涉及到图片路径/home/ftpuser/images
,文件夹和文件的所属者为ftpuser
,而我当前登录用户为xuzh
,所以我切换的root用户,并启动tomcat服务,启动成功
14-Aug-2022 15:52:24.436 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
14-Aug-2022 15:52:24.451 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
14-Aug-2022 15:52:24.455 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service imageService
14-Aug-2022 15:52:24.455 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.47
14-Aug-2022 15:52:24.489 INFO [192.168.2.195-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /opt/apache-tomcat-8.0.47/webapps/manager
14-Aug-2022 15:52:24.504 INFO [192.168.2.195-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /opt/apache-tomcat-8.0.47/webapps/manager has finished in 15 ms
14-Aug-2022 15:52:24.504 INFO [192.168.2.195-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /opt/apache-tomcat-8.0.47/webapps/host-manager
14-Aug-2022 15:52:24.527 INFO [192.168.2.195-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /opt/apache-tomcat-8.0.47/webapps/host-manager has finished in 23 ms
14-Aug-2022 15:52:24.528 INFO [192.168.2.195-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /opt/apache-tomcat-8.0.47/webapps/examples
14-Aug-2022 15:52:24.649 INFO [192.168.2.195-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextInitialized()
14-Aug-2022 15:52:24.650 INFO [192.168.2.195-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextInitialized()
14-Aug-2022 15:52:24.653 INFO [192.168.2.195-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /opt/apache-tomcat-8.0.47/webapps/examples has finished in 125 ms
14-Aug-2022 15:52:24.653 INFO [192.168.2.195-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /opt/apache-tomcat-8.0.47/webapps/docs
14-Aug-2022 15:52:24.663 INFO [192.168.2.195-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /opt/apache-tomcat-8.0.47/webapps/docs has finished in 10 ms
14-Aug-2022 15:52:24.668 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8089"]
14-Aug-2022 15:52:24.676 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 695 ms
tomcat服务访问正常
图片服务器正常