1年前 (2018-05-25)  tomcat |   抢沙发  231 
文章评分 0 次,平均分 0.0
[收起] 文章目录

问题描述:

今天在运行tomcat-7.0.61的时候想用shutdown.sh 关闭的时候,出现如下错误,

SEVERE: Could not contact localhost:8005. Tomcat may not be running.

 

[root@dk5 bin]# ./shutdown.sh 
Using CATALINA_BASE:   /opt/apache-tomcat-7.0.61
Using CATALINA_HOME:   /opt/apache-tomcat-7.0.61
Using CATALINA_TMPDIR: /opt/apache-tomcat-7.0.61/temp
Using JRE_HOME:        /opt/dkh/jdk1.8.0_161
Using CLASSPATH:       /opt/apache-tomcat-7.0.61/bin/bootstrap.jar:/opt/apache-tomcat-7.0.61/bin/tomcat-juli.jar
May 25, 2018 1:56:18 PM org.apache.catalina.startup.Catalina stopServer
SEVERE: Could not contact localhost:8005. Tomcat may not be running.
May 25, 2018 1:56:18 PM org.apache.catalina.startup.Catalina stopServer
SEVERE: Catalina.stop: 
java.net.ConnectException: Connection timed out (Connection timed out)
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
    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)

 

 

 

解决方案:

看日志:查看logs文件夹下的catalina.out 内容发现8005端口被占用

May 25, 2018 11:38:29 AM org.apache.catalina.core.StandardServer await
SEVERE: StandardServer.await: create[localhost:8005]: 
java.net.BindException: Address already in use (Bind failed)
    at java.net.PlainSocketImpl.socketBind(Native Method)
    at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:387)
    at java.net.ServerSocket.bind(ServerSocket.java:375)
    at java.net.ServerSocket.<init>(ServerSocket.java:237)
    at org.apache.catalina.core.StandardServer.await(StandardServer.java:427)
    at org.apache.catalina.startup.Catalina.await(Catalina.java:777)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:723)
    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:321)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:455)
用命令查看端口占用情况:
netstat -tunlp|grep 8005
如下:
[root@dk5 conf]# netstat -tunlp|grep 8005
tcp        0      0 ::ffff:127.0.0.1:8005       :::*                        LISTEN      26923/java          
[root@dk5 conf]# kill -9 26923
[root@dk5 conf]# netstat -tunlp|grep 8005

 

 

因为在tomcat没完全启动前就关闭tomcat,Kill掉进程后重启,等待一段时间再关闭

  
 

除特别注明外,本站所有文章均为HadoopAll原创,转载请注明出处来自http://hadoopall.com/63.html

发表评论

表情 格式

暂无评论

登录

忘记密码 ?

切换登录

注册

扫一扫二维码分享