您好,登錄后才能下訂單哦!
今天遇到個很郁悶的問題,使用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: eth2: <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 eth2 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
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。