Need help with remote debug and attach to Tomcat process?

Answered

Hi,

I'm trying to attach to a remote Tomcat process, but keep getting "Unable to connect to the <url>"?  I created a Tomcat Server -> Remote Debug Configuration, then entered in the "Remote Connection Settings IP of the host (Linux) and port used 64637.  Then opened the "Startup/Connection" tab, selected "Debug" and copied the command line arguments listed there, i.e. "-agentlib:jdwp=transport=dt_socket,address=64637,suspend=n,server=y".  These arguments I pasted into the startup script with CATALINA_OPTS.  Then, I start the service on the Linux node, and then run the process in Debug mode.  However, I always get the error mentioned above?  And, yes, I disabled the firewall.  Any help would be GREATLY appreciated!

Thank you in advance,

John

4 comments
Comment actions Permalink

Also, netstat -an shows the following:

        TCP    192.168.39.18:54815    192.168.33.23:64637    ESTABLISHED

... where my machine is 39.18:54815 and the server I'm trying to debug is at 33.23.64637.

And, I was happy to find the Intellij IDEA logs, and in there I found the following:

        2016-04-13 18:38:09,568 [894222758]   WARN - erver.JavaeeServerInstanceImpl - Unable to ping server at 192.168.33.23:64637

However, when I drop down in Intellij's terminal and execute a ping manually, i.e. ping 192.168.33.23, it replies:

        Pinging 192.168.33.23 with 32 bytes of data:
        Reply from 192.168.33.23: bytes=32 time<1ms TTL=63

        Ping statistics for 192.168.33.23:
        Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
        Approximate round trip times in milli-seconds:
        Minimum = 0ms, Maximum = 0ms, Average = 0ms

Again, any help would be GREATLY appreciated!!

V/r,

John

0
Comment actions Permalink

Well, Thanks to a coworker, I now have the simple answer ... and will post his answer to my question.  I needed to create a regular "Remote" Run/Debug Configuration and not a "Tomcat Server -> Remote" Run/Debug Configuration.  He tells me the "Tomcat Server" Run/Debug Config is for doing debug of Tomcat itself.  Silly me.

Thank you to any who at least read my post and who maybe wished they could help ;-)

V/r,

John

0
Comment actions Permalink

Remote connection settings specifies the web port, not the Java debugger port. This configuration is not to debug Tomcat itself, it's to debug your own apps on a remote Tomcat.

0
Comment actions Permalink

I had the same problem. The solution?

First restart the tomcat server (to clear any existing connections)

In the "Server" Tab of  Run/Debug Configurations under "Remote Connection Settings" set Port: to 8080 (or whatever web port you are using)

Do *not* set this port to your debug port -- that is set in another tab, the "Startup/Connection" tab.

This solved the problem for me.

 

0

Please sign in to leave a comment.