• 【已解决】CentOS7 启动tomcat服务器,提示Tomcat started,但实际服务未启动成功(失败原因与图片服务器配置和用户权限有关)


    正常启动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.
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    检查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)
    
    
    • 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

    查看了一下我之前配置的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>
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20

    其中涉及到图片路径/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
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17

    tomcat服务访问正常

    在这里插入图片描述

    图片服务器正常

    在这里插入图片描述

  • 相关阅读:
    srs流媒体部署
    花菁荧光染料Cy3/Cy5/Cy7标记COX-2环氧合酶,Cy3/Cy5/Cy7-Cyclooxygenase-2
    MySQL数据库期末考试试题及参考答案(04)
    vue 子组件向父组件传递参数 子传父
    python+vue+elementui心理健康测试教育系统django339
    JDBC技术
    Flume学习笔记(2)—— Flume进阶
    Excel自定义函数提取超链接
    mybatis学习(18):列名与属性名不一致的情况(使用ResultMap)
    CAD Exchanger SDK 3.23.0 for Linux Crack
  • 原文地址:https://blog.csdn.net/bronzehammer/article/details/126330225