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


12

我为在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"

但是我看不到任何效果...实际上,我看不到netstat -a打开了8000端口,并且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

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

有什么提示吗?

Answers:


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"

谢啦。无论如何,etc / init.d和etc / default之间有什么区别?
gotch4 2011年

在这种特定情况下,差异非常明显。在读取默认文件之前,/ etc / default设置会覆盖/etc/init.d中先前设置的内容。这是围绕90行记录
jlliagre
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.