3

I have a Tomcat installed as a Windows service. I'd like to configure it to support remote debugging via jdwp.

When starting it from the command line (catalina.bat), I can add this string to allow debugging:

-agentlib:jdwp=transport=dt_socket,suspend=n,server=y,address=10000

Where can I added jdwp support when running it as a windows service? For the purpose of this question, I do not want to use the "Monitor Tomcat" application, but rather configure it via some file like server.xml, catalins.properties, etc ...

ripper234
  • 222,824
  • 274
  • 634
  • 905

2 Answers2

4

Steps to start Tomcat windows service in Debug mode:

1) Go to Directory under Tomcat bin folder
2) C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0\bin
3) Run tomcat7w.exe
4) Under Java/ Java Options, enter lines above all the -D options
-Xdebug
-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n

Make sure the above 2 lines are in separate lines

prilia
  • 996
  • 5
  • 18
  • 41
2

see this how-to and modify the provided service.bat to include the following line:

set JVM_OPTIONS=-Djava.io.tmpdir=%TMPDIR%;-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager;-Djava.util.logging.config.file=%CATALINA_BASE%\conf\logging.properties;-Dcatalina.base=%CATALINA_BASE%;-Dcatalina.home=%CATALINA_HOME%;-Djava.endorsed.dirs=%CATALINA_HOME%\endorsed;-Xms256M;-Xmx512M;-Xmixed;-Xincgc;-Xdebug;-Xrunjdwp:transport=dt_socket,server=n,suspend=y,address=127.0.0.1:4153

this is the first setting of the JVM_OPTIONS. make sure you dont overwrite options already set.

run the service.bat as usual to install the debug service

mkoryak
  • 57,086
  • 61
  • 201
  • 257