2014-09-12 154 views
-1

我創建了tomcat集羣,當我嘗試啓動tomcat時,它顯示tomcat已啓動,但我無法從localhost訪問:當我嘗試關閉它時,我無法關閉它。 請幫我解決這個問題。tomcat 7無法訪問,無法關閉

[email protected]:~/softz/cluster$ ./startup-instance1.sh 
    Using CATALINA_BASE: /home/gaiz/softz/cluster/instance-1 
    Using CATALINA_HOME: /home/gaiz/softz/cluster/apache-tomcat-7.0.55 
    Using CATALINA_TMPDIR: /home/gaiz/softz/cluster/instance-1/temp 
    Using JRE_HOME:  /usr 
    Using CLASSPATH:  /home/gaiz/softz/cluster/apache-tomcat-7.0.55/bin/bootstrap.jar:/home/gaiz/softz/cluster/apache-tomcat-7.0.55/bin/tomcat-juli.jar 
    Tomcat started. 

,並當我嘗試關閉它發生這個錯誤

[email protected]:~/softz/cluster$ ./shutdown-instance1.sh 
Using CATALINA_BASE: /home/gaiz/softz/cluster/instance-1 
Using CATALINA_HOME: /home/gaiz/softz/cluster/apache-tomcat-7.0.55 
Using CATALINA_TMPDIR: /home/gaiz/softz/cluster/instance-1/temp 
Using JRE_HOME:  /usr 
Using CLASSPATH:  /home/gaiz/softz/cluster/apache-tomcat-7.0.55/bin/bootstrap.jar:/home/gaiz/softz/cluster/apache-tomcat-7.0.55/bin/tomcat-juli.jar 
Sep 12, 2014 9:13:42 AM org.apache.catalina.startup.Catalina stopServer 
SEVERE: Could not contact localhost:8006. Tomcat may not be running. 
Sep 12, 2014 9:13:42 AM org.apache.catalina.startup.Catalina stopServer 
SEVERE: Catalina.stop: 
java.net.ConnectException: Connection refused 
    at java.net.PlainSocketImpl.socketConnect(Native Method) 
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339) 
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200) 
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182) 
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) 
    at java.net.Socket.connect(Socket.java:579) 
    at java.net.Socket.connect(Socket.java:528) 
    at java.net.Socket.<init>(Socket.java:425) 
    at java.net.Socket.<init>(Socket.java:208) 
    at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:498) 
    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.stopServer(Bootstrap.java:370) 
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:457) 

回答

1
  1. 這很可能是Tomcat的開始和失敗,但不會立即進行。因此,您的啓動腳本認爲它正在運行,但是當您嘗試停止服務時,它會失敗,說它無法停止Tomcat,因爲它沒有運行。在啓動Tomcat之後,您可以運行ps aux | grep catalina並查看過程是否仍在運行。

  2. 假設失敗,請在您的Tomcat日誌中查找錯誤。這可能會在/home/gaiz/softz/cluster/instance-1/logs。檢查所有日誌,包括catalina.yyyy-mm-dd.log,catalina.outlocalhost.yyyy-mm-dd.log,因爲錯誤可能會被隔離到其中一個日誌文件。同時檢查任何應用程序特定的日誌,因爲您也可能遇到應用程序問題。