12

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?

16

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"
  • thanks man. Anyway what's the difference between what is in etc/init.d and etc/default ? – gotch4 May 4 '11 at 14:51
  • In that specific case the difference is pretty obvious. /etc/default settings override whatever was previously set in /etc/init.d before the default file is read. This is documented around line 90. – jlliagre May 4 '11 at 14:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.