Java remote debugging (JPDA) not working for me in Tomcat 9

浪尽此生 提交于 2019-12-10 19:29:42

问题


I'm trying to remotely debug a Tomcat webapp on a recently upgraded Tomcat 9.0.13 and Open JDK 11.0.1. Server is Redhat Enterprise Linux 7.6 and I'm using Eclipse on a Windows 7 developer box to connect.

Tomcat starts, and the app is accessible on port 8080 but fails on certain requests. So on my Eclipse, I've configured a Remote Java application with my configuration details. When I try to connect to it, the connecting fails with

Failed to connect to remote VM. Connection refused.

I'm using the default port, 8000 and on the Linux server, netstat -an shows that there is a process listening on that port when Tomcat starts and not when Tomcat stops.

I've tried telnet from the Windows box to port 8000 and get

$ telnet c516vefpubrec 8000
Trying XX.XXX.XX.XX...
telnet: Unable to connect to remote host: Connection refused

When I do the same running our old Tomcat 7 + Java 1.8 everything is successful. I've tried other ports with the same result.

Could this be a bug? Is there a configuration item to enable JPDA on Tomcat 9?


回答1:


I had this exact same issue. I'm running an application from a centos vm and trying to debug from my windows machine.

I had to go into the catalina.sh file on the vm and make an edit. In the section that says that handles the jpda flag, the JPA_OPTS variable needed to be changed to JPDA_OPTS="-agentlib:jdwp=transport=$JPDA_TRANSPORT,address=*:$JPDA_ADDRESS,server=y,suspend=$JPDA_SUSPEND"

Note the *: before the JPDA variable. This allows any ip address to have access to remote debugging. I believe by default it only allows local host.

Hope this helps.



来源:https://stackoverflow.com/questions/54373166/java-remote-debugging-jpda-not-working-for-me-in-tomcat-9

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