开发者社区> 问答> 正文

tomcat结束不了,Could not contact localhost:8005?报错

运行shutdown.sh和./catalina.sh stop均报错:


[root@localhost bin]# sh shutdown.sh 
Using CATALINA_BASE:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:        /usr/java/jdk1.6.0_17
Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Jul 17, 2015 9:47:54 AM org.apache.catalina.startup.Catalina stopServer
SEVERE: Could not contact localhost:8005. Tomcat may not be running.
Jul 17, 2015 9:47:54 AM org.apache.catalina.startup.Catalina stopServer
SEVERE: Catalina.stop: 
java.net.ConnectException: Connection timed out
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
	at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
	at java.net.Socket.connect(Socket.java:525)
	at java.net.Socket.connect(Socket.java:475)
	at java.net.Socket.<init>(Socket.java:372)
	at java.net.Socket.<init>(Socket.java:186)
	at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:498)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:370)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:457)



清空 catalina.2015-07-17.log,重演错误步骤,无报错日志输出。



Could not contact localhost:8005    //这句好像挺重要
[root@localhost bin]# netstat -tnlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 0.0.0.0:40832               0.0.0.0:*                   LISTEN      3016/rpc.statd      
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      2879/rpcbind        
tcp        0      0 192.168.122.1:53            0.0.0.0:*                   LISTEN      3598/dnsmasq        
tcp        0      0 0.0.0.0:21                  0.0.0.0:*                   LISTEN      3245/vsftpd         
tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN      3047/cupsd          
tcp        0      0 127.0.0.1:6010              0.0.0.0:*                   LISTEN      3736/sshd           
tcp        0      0 127.0.0.1:6011              0.0.0.0:*                   LISTEN      4049/sshd           
tcp        0      0 0.0.0.0:3389                0.0.0.0:*                   LISTEN      3224/sshd           
tcp        0      0 :::47458                    :::*                        LISTEN      3016/rpc.statd      
tcp        0      0 ::ffff:127.0.0.1:8005       :::*                        LISTEN      3601/java           
tcp        0      0 :::8009                     :::*                        LISTEN      3601/java           
tcp        0      0 :::3306                     :::*                        LISTEN      3433/mysqld         
tcp        0      0 :::111                      :::*                        LISTEN      2879/rpcbind        
tcp        0      0 :::81                       :::*                        LISTEN      3601/java           
tcp        0      0 :::23                       :::*                        LISTEN      3233/xinetd         
tcp        0      0 ::1:631                     :::*                        LISTEN      3047/cupsd          
tcp        0      0 ::1:6010                    :::*                        LISTEN      3736/sshd           
tcp        0      0 ::1:6011                    :::*                        LISTEN      4049/sshd           
tcp        0      0 :::3389                     :::*                        LISTEN      3224/sshd



没有8005,是这个原因么?怎么解决?


展开
收起
爱吃鱼的程序员 2020-06-12 15:47:42 1461 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    因为你已经shutdown过一次了,但是并没有成功结束掉java进程,所以8005端口已经被shutdown了,无法再次通过8005端口停掉服务。

    只有手工kill掉java进程了。

    想不用每次都这么麻烦的话,看我的博客吧: http://my.oschina.net/abcfy2/blog/192203

    这个问题解决了吗,我也遇到这个问题了回复 @一把刀:手工杀掉tomcat的进程,然后再重启。如果8005端口无法启动,肯定会有日志重启之后,依然这样报错啊,而且8005还是没起来,,,
    2020-06-12 15:48:00
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
Apache Tomcat 的云原生演进 立即下载
低代码开发师(初级)实战教程 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载