This should be easy, but I can't get debugging to work on Tomcat 6 when it is running as a service on RHEL 6.1.
I've added the following line to /etc/tomcat6/tomcat6.conf
JAVA_OPTS="${JAVA_OPTS} -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"
When I restart the tomcat 6 service with
service tomcat6 restart
the command line indicates that Tomcat shutdown and started, but it is not running and when I look in the catalina.out log I see
ERROR: Cannot load this JVM TI agent twice, check your java command line for duplicate jdwp options.
Error occurred during initialization of VM
agent library failed to init: jdwp
Attempting to restart the Tomcat6 service fails for both shutdown and startup. I have to reboot RHEL.
I thought that maybe Tomcat6 is running in debug mode by default, but when I comment out the line in tomcat6.conf and reboot using netstat -an doesn't show anything using port 8000 or any port in use by Tomcat.
Can Tomcat 6 be run in debug mode when it is run as a service?
One more reboot seems to have solved it. RHEL is now listening on port 8000 and I can attache a remote debugger.
Weird.