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

后端 未结 3 677
失恋的感觉
失恋的感觉 2021-01-21 07:50

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 Window

相关标签:
3条回答
  • 2021-01-21 08:34

    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.

    0 讨论(0)
  • 2021-01-21 08:40

    In case you are on Windows and using Tomcat as Service 64-bit. Then it would be needed to change in the Windows registry. This registry path:

    HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Apache Software Foundation\Procrun 2.0\<Tomcat9ServiceName>\Parameters\Java
    

    With 32-bit Windows this path will be without WOW6432Node. There is a string value Options and remote debug can be enabled by adding these 2 lines there

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

    if you do not put *: to address parameter, then remote debug will be possible only from localhost. *: means you can connect from anywhere/any host to the tomcat for debugging.

    Tomcat9ServiceName - is the name of the Tomcat Service which shown in the screenshot below and usually you type it during the installation

    0 讨论(0)
  • 2021-01-21 08:53

    I had similar issue running Tomcat 9 in docker. I specified the JPDA_ADDRESS in the docker build to allow access from any host:

    ENV JPDA_ADDRESS=8000 CMD ["catalina.sh", "jpda", "run"]

    0 讨论(0)
提交回复
热议问题