vscode-java-debug icon indicating copy to clipboard operation
vscode-java-debug copied to clipboard

cant remote debug on tomcat via attach

Open kvonspiczak opened this issue 6 years ago • 13 comments
trafficstars

i'm trying to remote debug my application, which is running on a tomcat.

Environment
  • Operating System: mac OS 10.14.4
  • JDK version: 1.8.0_131
  • Visual Studio Code version: 1.34.0
  • Java extension version: 0.7.1
  • Java Debugger extension version: 0.18.0
Steps To Reproduce

my configuration:

{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
        "type": "java",
        "name": "Debug (Attach) - Remote",
        "request": "attach",
        "hostName": "localhost",
        "port": 8090
    },
  ]
}

[attach a sample project reproducing the error] attach logs

Current Result

i'm getting an error message in vscode: Timeout occured while waiting for packet 106

Expected Result

debugger attaches to the remote tomcat just fine

Additional Informations

the same configuration works with intelliJ idea, so it should work in vscode. idea connects fine with host: localhost, port: 8090 idea shows these params: -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8090 do i have to add them somewhere for vscode?

kvonspiczak avatar May 21 '19 11:05 kvonspiczak

just noticed this output in the debug console: is that the cause?

[Warn] The debugger and the debuggee are running in different versions of JVMs. You could see wrong source mapping results.
Debugger JVM version: 1.8.0_131
Debuggee JVM version: 1.8.0_181

kvonspiczak avatar May 21 '19 11:05 kvonspiczak

Have you compiled the project? Second thing, tell me what's the command you have used to make the server?

minkir014 avatar May 21 '19 11:05 minkir014

i built it and deployed it, i can debug it just fine in intelliJ idea. i didnt setup the tomcat, my experience with administration and setting up these servers is a bit limited

kvonspiczak avatar May 21 '19 11:05 kvonspiczak

just noticed this output in the debug console: is that the cause?

[Warn] The debugger and the debuggee are running in different versions of JVMs. You could see wrong source mapping results.
Debugger JVM version: 1.8.0_131
Debuggee JVM version: 1.8.0_181

This problem happens when you use Intellij idea JDK. The version of the JDK intellij idea uses is older than the requirements of vs code . if you installed a jdk now. It will work. See issue #30.

minkir014 avatar May 21 '19 11:05 minkir014

awesome thanks! i'll give it a try and close this issue if it works!

kvonspiczak avatar May 21 '19 11:05 kvonspiczak

OK. Please tell me the results. And don't forget to set it up in the path an JAVA_HOME.

minkir014 avatar May 21 '19 11:05 minkir014

@kvonspiczak could you mind share us the log file? Run VS Code command "Java: Open Java Language Server log file" to get the log.

testforstephen avatar May 21 '19 11:05 testforstephen

i downloaded the latest from oracle, but now it seems like my version is too "new".

Debugger JVM version: 1.8.0_211
Debuggee JVM version: 1.8.0_181

kvonspiczak avatar May 21 '19 12:05 kvonspiczak

sure @testforstephen export.log

kvonspiczak avatar May 21 '19 12:05 kvonspiczak

The JVM version mismatch is just a warning, not the root cause of the attach failure. Looks like it's network issue.

testforstephen avatar May 21 '19 12:05 testforstephen

i'm using a SSH tunnel to connect to the remote tomcat, but it works with the same configuration in intelliJ idea

kvonspiczak avatar May 21 '19 12:05 kvonspiczak

Does the error continue or just that warning?

minkir014 avatar May 21 '19 12:05 minkir014

i keep getting the error, last time it took a bit longer until the error came up. the warning is also still there

kvonspiczak avatar May 21 '19 12:05 kvonspiczak