简体   繁体   English

作为Windows服务安装时使用远程调试(jdwp)启动Tomcat

[英]Starting Tomcat with remote debugging (jdwp) when installed as a windows service

I have a Tomcat installed as a Windows service. 我已将Tomcat安装为Windows服务。 I'd like to configure it to support remote debugging via jdwp. 我想将其配置为支持通过jdwp进行远程调试。

When starting it from the command line (catalina.bat), I can add this string to allow debugging: 从命令行(catalina.bat)启动它时,我可以添加以下字符串以允许调试:

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

Where can I added jdwp support when running it as a windows service? 作为Windows服务运行时,在哪里可以添加jdwp支持? 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 ... 出于这个问题的目的,我不想使用“ Monitor Tomcat”应用程序,而是通过诸如server.xml,catalins.properties等某些文件进行配置。

Steps to start Tomcat windows service in Debug mode: 在调试模式下启动Tomcat Windows服务的步骤:

1) Go to Directory under Tomcat bin folder 1)转到Tomcat bin文件夹下的目录
2) C:\\Program Files (x86)\\Apache Software Foundation\\Tomcat 7.0\\bin 2)C:\\ Program Files(x86)\\ Apache Software Foundation \\ Tomcat 7.0 \\ bin
3) Run tomcat7w.exe 3)运行tomcat7w.exe
4) Under Java/ Java Options, enter lines above all the -D options 4)在Java / Java选项下,在所有-D选项上方输入行
-Xdebug -Xdebug
-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n -Xrunjdwp:运输= dt_socket,地址= 8000,服务器= Y,暂停=正

Make sure the above 2 lines are in separate lines 确保以上2行在单独的行中

see this how-to and modify the provided service.bat to include the following line: 请参阅此方法,并修改提供的service.bat以包括以下行:

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. 这是JVM_OPTIONS的第一个设置。 make sure you dont overwrite options already set. 确保您不覆盖已设置的选项。

run the service.bat as usual to install the debug service 像往常一样运行service.bat以安装调试服务

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM