java remote debugging Tomcat app: Why does the JVM not listen?

家住魔仙堡 提交于 2019-12-03 09:13:11

问题


I want to remote debug an application running in Tomcat 7. Tomcat is running as a service on a Win2008 server. I added the following to the Java options in the Java Configuration Panel of Tomcat: -Xdebug -Xrunjdwp:transport=dt_socket,address=4711,server=y,suspend=n and opened the firewall on my workstation and the server for this port. But when I try debugging from IntelliJ 9 on my workstation, I get an error message Unable to open debugger port : java.net.ConnectException "Connection timed out: connect". The jvm is the standatd Sun/Oracle 64 bit JVM version 1.6.0_27.

I verified that the command line parameters are in use by accessing ManagementFactory.getRuntimeMXBean().getInputArguments() within the application deployed to Tomcat and logging the result to the log file. I verified via Wireshark on my workstation and on the server that the TCP request on port 4711 is sent from my pc and arriving on the server, but there is is no answer. Running netstat -a on the server does not show a process listening on this port. So I assume somehow Tomcat/JVM does not start the remote debugging.


回答1:


You need to put -Xdebug and -Xrunjdwp... on separate lines in the Java panel of the Tomcat Service Configuration Panel.

So having:

-Xdebug -Xrunjdwp:transport=dt_socket,address=4711,server=y,suspend=n

will not work, but:

-Xdebug
-Xrunjdwp:transport=dt_socket,address=4711,server=y,suspend=n

will.



来源:https://stackoverflow.com/questions/14338520/java-remote-debugging-tomcat-app-why-does-the-jvm-not-listen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!