大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
今天遇到个很郁闷的问题,使用catalina.sh stop 或者 shutdown.sh 关闭tomcat总是失败,总提示连接超时。
创新互联在网站设计、网站制作、app软件定制开发、网站运营等方面均有出色的表现,凭借多年丰富的经验,我们会仔细了解各客户的需求而做出多方面的分析、设计、整合,为客户设计出具风格及创意性的商业解决方案,我们更提供一系列全网整合营销推广,网站制作和网站推广的服务,以推动各中小企业全面信息化,并利用创新技术帮助各行业提升企业形象和运营效率。
开始以为是自己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.(Socket.java:434) at java.net.Socket. (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: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: 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