如何在 Ubuntu 10 下以远程调试模式启动 tomcat?

got*_*ch4 12 scripting ubuntu tomcat6

我在 ubuntu 10 下以远程调试模式设置 Tomcat 变得很疯狂。基本上我将它添加到 /etc/init.d/tomcat6(在开始时):

JAVA_OPTS="-Djava.awt.headless=true -Xmx256M -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"
Run Code Online (Sandbox Code Playgroud)

但我看不到任何效果......实际上我看不到端口 8000 用 netstat -a 打开,Eclipse 远程调试器说它无法连接。如果我做 ps -A u| 我得到的 grep java:

tomcat6   9612  3.1 13.1 470560 154168 ?       Sl   15:24   0:17 /usr/lib/jvm/java-6-sun/bin/java -Djava.util.logging.config.file=/var/lib/tomcat6/conf/logging.properties -Djava.awt.headless=true -Xmx128m -XX:+UseConcMarkSweepGC -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/usr/share/tomcat6/endorsed -classpath /usr/share/tomcat6/bin/bootstrap.jar -Dcatalina.base=/var/lib/tomcat6 -Dcatalina.home=/usr/share/tomcat6 -Djava.io.tmpdir=/tmp/tomcat6-tmp org.apache.catalina.startup.Bootstrap start
Run Code Online (Sandbox Code Playgroud)

请注意,它甚至没有设置堆大小(如果这有意义的话)。

所以有什么提示吗?

jll*_*gre 16

不要触摸初始化脚本。相反,编辑/etc/default/tomcat6文件并注释掉启用远程调试的行:

# To enable remote debugging uncomment the following line.
# You will then be able to use a java debugger on port 8000.
JAVA_OPTS="${JAVA_OPTS} -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"
Run Code Online (Sandbox Code Playgroud)