2017年07月21日 14:52:10 子木HAPPY陽VIP 閱讀數:14134 標籤: tomcatnginx 更多java
我的分類: 隨筆nginx
在測試nginx反向代理 時在同一個liunx上配置了三個tomcat7,startup.sh時正常啓動。shutdown.sh時報錯以下:apache
Jul 20, 2017 10:19:55 PM org.apache.catalina.startup.Catalina stopServer SEVERE: Could not contact localhost:8005. Tomcat may not be running. Jul 20, 2017 10:19:55 PM org.apache.catalina.startup.Catalina stopServer SEVERE: Catalina.stop: java.net.ConnectException: Connection refused at java.net.PlainSocketImpl.socketConnect(Native Method)
因而度娘了好多辦法,從這些方法中獲得了些啓發,解決過程以下:
查看logs文件夾下的catalina.out 內容發現8005端口被佔用tomcat
Jul 20, 2017 10:53:24 PM org.apache.catalina.core.StandardServer await SEVERE: StandardServer.await: create[localhost:8005]: java.net.BindException: Address already in use at java.net.PlainSocketImpl.socketBind(Native Method) at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376) at java.net.ServerSocket.bind(ServerSocket.java:376) 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:779) at org.apache.catalina.startup.Catalina.start(Catalina.java:725) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:456)
網上的方法大部分都比較學術。。。。不就是端口被佔用?那就改啊!!(原諒鄙人的因爲無知帶來的強大自信。嘿嘿)
因而就着手改了三個tomcat的conf下的server.xml裏的」SHUTDOWN」端口(固然三個都不同8017,8016,8015):socket
<Server port="8017" shutdown="SHUTDOWN">
哈哈。。而後有startup.sh 了一番(因爲關不掉因此以前的直接kill了)而後執行shutdown.sh 你猜怎麼着???居然好了!!所有正常!解決!
ps:/etc/profile裏不用配置tomcat的信息,tomcat會本身識別。。測試