2012-08-08 98 views
4

我對Tomcat非常陌生,剛剛使用jprofiler配置了我的tomcat。但現在無法停止tomcat服務器,得到以下錯誤信息。無法停止Tomcat

[[email protected] bin]# service tomcat stop 
Stopping . 
Using CATALINA_BASE: /data/applications/apache-tomcat-6.0.26 
Using CATALINA_HOME: /data/applications/apache-tomcat-6.0.26 
Using CATALINA_TMPDIR: /data/applications/apache-tomcat-6.0.26/temp 
Using JRE_HOME:  /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0 
Using CLASSPATH:  /data/applications/apache-tomcat-6.0.26/bin/bootstrap.jar 
JProfiler> Protocol version 35 
JProfiler> Using JVMTI 
JProfiler> JVMTI version 1.1 detected. 
JProfiler> 32-bit library 
JProfiler> Listening on port: 8849. 
JProfiler> Instrumenting native methods. 
JProfiler> Can retransform classes. 
JProfiler> Can retransform any class. 
JProfiler> Native library initialized 
JProfiler> VM initialized 
JProfiler> Waiting for a connection from the JProfiler GUI ... 
JProfiler> ERROR: Could not bind socket. 
\n\nTomcat has shutdown 

我不知道我的配置有什麼問題,並且在防火牆上禁用了防火牆。

[[email protected] bin]# service iptables status 
Firewall is stopped. 
+0

但它表示Tomcat已停止 – Cratylus 2012-08-08 19:21:16

+0

它也會提示錯誤JProfiler>正在等待來自JProfiler GUI的連接... JProfiler>錯誤:無法綁定套接字。 並且是Tomcat在使用service或init.d腳本多次停止後仍在運行 – PratapSingh 2012-08-09 08:24:26

+0

查看由'service'命令調用的腳本。也許輸入了一些不需要的配置。你很可能會發現腳本接近'/ etc/init.d'的地方。 – HonkyTonk 2012-08-09 11:46:34

回答

6

爲了找到tomcat的PID運行:

ps -ef | grep tomcat 

不是使用:

kill -9 PID 

另一件事,你可能有一個看門狗運行,保持把tomcat的備份 - 在這樣的您還需要關閉(或終止)看門狗

+0

我已經檢查過它的運行情況,並且看門狗在服務器上沒有啓用。 – PratapSingh 2012-08-09 08:20:54

+0

你嘗試殺死它嗎? – alfasin 2012-08-09 17:14:28

0

您已經插入了用於加載J的VM參數Profiler代理在你的tomcat腳本中。 JProfiler代理期望能夠偵聽特定端口上的傳入連接(默認情況下爲8849)。該端口已被運行的Tomcat使用。當您再次啓動tomcat腳本時,JVM的初始化將失敗,因爲概要分析代理無法初始化。

您將不得不從tomcat啓動腳本中刪除JVM參數-agentlib:[path to jprofilerti.dll]或使其成爲有條件的,以使其不適用於「stop」命令。

0

根據Tomcat文檔,您可以定義一個PID文件,它應該存儲Tomcat的進程ID。

  1. 在Tomcat bin目錄下創建一個shell腳本「setenv.sh」。
  2. 該文件在catalina.sh中引用,所以它應該有完全相同的名稱。
  3. 您可以在「setenv.sh」中獲得tomcat pid信息。類似下面..

    #!/bin/bash CATALINA_PID="$CATALINA_BASE/bin/catalina.pid"

  4. 通過上述步驟,tomcat會尋找一個命名爲它的bin目錄「catalina.pid」文件。所以只需創建它。

你完成了。只要不要忘記用-force選項來阻止tomcat。

./shutdown.sh -force 

force選項告訴tomcat通過PID殺死tomcat,如果它在給定時間內無法停止。