How to start tomcat in remote debug mode under Ubuntu 10?

I'm getting crazy to set up Tomcat in remote debug mode under ubuntu 10. Basically I added this to /etc/init.d/tomcat6 (at the beginning):

JAVA_OPTS="-Djava.awt.headless=true -Xmx256M -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"

But I see no effect... in fact I can't see port 8000 open with netstat -a and Eclipse remote debugger says it can't connect. If I do ps -A u| grep java I get:

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

Notice it doesn't even set the heap size (if this is meaninful).

So any hints?


Solution 1:

Don't touch the init script. Instead, edit the /etc/default/tomcat6 file and comment out the line enabling remote debugging there:

# 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"