服務器:linnux 5.5 64位,已安裝好 jdk;html
Tomcat版本:apache-tomcat-7.0.53java
操做軟件:Xshell 4(Free for Home / School)linux
剛開始重啓了一次tomcat,但用瀏覽器訪問網站的時候一直卡着打不開,多是tomcat的問題,因而在Xshell裏輸入命令 ps -ef|grep java 查看進程中是否有tomcat出現,以下圖:shell
出現如上信息,說明tomcat進程存在,再次運行shutdown.sh和ps -ef|grep java看到該進程仍然沒法結束,因而我強制結束該進程。要命的時,我kill錯了進程,如上圖,本應是kill掉29053,但卻把29378給kill掉了,致使的後果是再次運行shutdown.sh的時候,出現瞭如下的錯誤。apache
[root@sdc bin]# ./shutdown.sh Using CATALINA_BASE: /opt/tomcat Using CATALINA_HOME: /opt/tomcat Using CATALINA_TMPDIR: /opt/tomcat/temp Using JRE_HOME: /usr/java/jdk1.6.0_22 Using CLASSPATH: /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar Apr 17, 2014 11:14:50 AM org.apache.catalina.startup.Catalina stopServer SEVERE: Could not contact localhost:8005. Tomcat may not be running. Apr 17, 2014 11:14:50 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.PlainSocketImpl.doConnect(PlainSocketImpl.java:333) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) at java.net.Socket.connect(Socket.java:529) at java.net.Socket.connect(Socket.java:478) at java.net.Socket.<init>(Socket.java:375) at java.net.Socket.<init>(Socket.java:189) at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:498) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:370) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:457) [root@sdc bin]#
以下圖:bootstrap
反覆操做,問題仍然沒有解決,包括用reboot命令重啓linux系統同樣不行。瀏覽器
但奇怪的是,過了十多分鐘後,分別再次運行shutdown.sh和startup.sh,發現上述問題已經不出現了,tomcat又恢復了正常,不知道是怎麼回事。tomcat
過後又出現屢次這樣的問題,後來終於發現原來是tomcat內存過小了,須要給tomcat增長虛擬內存,增長了tomcat的內存後,問題得以解決,終於能夠再次關閉或啓動tomcat了。點擊這裏查看:在linux系統裏修改tomcat內存的方法。服務器