I'm trying to remote debug a Tomcat. I added -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
to JAVA_OPTS
and restarted Tomcat. IntelliJ wasn't able to attach. So I tried telnet thehost 5005
and it seemed I was initially attached but then my session was terminated with Connection closed by foreign host
and catalina.out
had Debugger failed to attach: timeout during handshake
. Same thing happened if I did telnet localhost 5005
on the remote machine.
If I do netstat -antp | grep 5005
on the remote machine I get
tcp 0 0 0.0.0.0:5005 0.0.0.0:* LISTEN 26745/java-tomcat12
So it seems the JVM is listening. What am I doing wrong?
Update: using the same options I can debug a very simple hello world like application which I run on the remote server. So it seems it's something specific to Tomcat, or at least this specific web application.