首页 > 代码库 > tomcat停止失败 java.net.ConnectException: Connection refused
tomcat停止失败 java.net.ConnectException: Connection refused
今天遇到个很郁闷的问题,使用catalina.sh stop 或者 shutdown.sh 关闭tomcat总是失败,总提示连接超时。
开始以为是自己tomcat配置的问题,重新部署上没更改过配置的tomcat,结果依然是失败。
后来使用telnet 127.0.0.1 到shutdown的端口 发现失败;
tomcat停止的时候将SHUTDOWN指令发送给127.0.0.1:8005端口执行;
问题原来出在自己之前测试的时候把配置有127.0.0.1 IP的lo网卡给禁用了;
启用lo网卡,然后重新停止tomcat成功。o(∩_∩)o
解决步骤:
tomcat监听端口如下:
[root@node1 ~]# netstat -napt |grep java |grep LISTEN tcp 0 0 :::8080 :::* LISTEN 1317/java tcp 0 0 ::ffff:127.0.0.1:8005 :::* LISTEN 1317/java tcp 0 0 :::8009 :::* LISTEN 1317/java
报错如下:
[root@node1 ~]# /usr/local/tomcat/bin/catalina.sh stop Using CATALINA_BASE: /usr/local/tomcat Using CATALINA_HOME: /usr/local/tomcat Using CATALINA_TMPDIR: /usr/local/tomcat/temp Using JRE_HOME: /usr/local/jdk Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar 六月 25, 2014 4:29:37 下午 org.apache.catalina.startup.Catalina stopServer 严重: Catalina.stop: java.net.ConnectException: 连接超时 at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at java.net.Socket.connect(Socket.java:538) at java.net.Socket.<init>(Socket.java:434) at java.net.Socket.<init>(Socket.java:211) at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:422) 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:483) at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:338) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:416)
Telnet 本地8005端口:
[root@node1 ~]# telnet 127.0.0.1 8005 Trying 127.0.0.1... telnet: connect to address 127.0.0.1: Connection timed out
查看IP配置:
[root@node1 ~]# ip a 1: lo: <LOOPBACK> mtu 16436 qdisc noqueue state DOWN ##状态为down的 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo 2: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:0c:29:32:0c:53 brd ff:ff:ff:ff:ff:ff inet 192.168.1.44/24 brd 192.168.1.255 scope global eth1 inet6 fe80::20c:29ff:fe32:c53/64 scope link valid_lft forever preferred_lft forever
启用lo网卡:
[root@node1 ~]# ifup lo
重新停止Tomcat成功:
[root@node1 ~]# /usr/local/tomcat/bin/catalina.sh stop Using CATALINA_BASE: /usr/local/tomcat Using CATALINA_HOME: /usr/local/tomcat Using CATALINA_TMPDIR: /usr/local/tomcat/temp Using JRE_HOME: /usr/local/jdk Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar [root@node1 ~]# netstat -napt |grep java |grep LISTEN
本文出自 “zrer(技术群:1991706)” 博客,请务必保留此出处http://zrer90.blog.51cto.com/8679896/1430813
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。