我是Tomcat的新手,只是用jprofiler配置我的tomcat。但是现在无法停止tomcat服务器,收到以下错误信息。
[root@localhost 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
我不确定我的配置有什么问题,并且框中禁用了防火墙。
[root@localhost bin]# service iptables status
Firewall is stopped.
答案 0 :(得分:7)
为了找到tomcat PID运行:
ps -ef | grep tomcat
比使用:
kill -9 PID
或者在一个命令中:
kill -9 $(ps -ef | grep tomcat | grep -v "grep" | awk '{print $2}')
另一件事,你可能有一个看门狗运行,不断让tomcat恢复 - 在这种情况下,你也想要关闭(或杀死)看门狗
答案 1 :(得分:0)
您已插入VM参数以在tomcat脚本中加载JProfiler代理。 JProfiler代理期望能够侦听特定端口上的传入连接(默认情况下为8849)。该端口已被正在运行的Tomcat使用。再次启动tomcat脚本时,JVM的初始化失败,因为无法初始化分析代理。
您必须从tomcat启动脚本中删除JVM参数-agentlib:[path to jprofilerti.dll]
或使其成为条件,以便它不会应用于" stop"命令。
答案 2 :(得分:0)
根据Tomcat文档,您可以定义一个PID文件,该文件应该存储Tomcat的进程ID。
您可以在“setenv.sh”中获取tomcat pid信息。像下面的东西..
#!/bin/bash
CATALINA_PID="$CATALINA_BASE/bin/catalina.pid"
通过上述步骤,tomcat将在其bin目录中查找名为“catalina.pid”的文件。所以只需创建它。
你已经完成了。只是不要忘记使用-force选项停止tomcat。
./shutdown.sh -force
force选项告诉tomcat通过PID杀死tomcat,如果它无法在给定时间内停止。