Can I remote debug tomcat running in intelliJ from a different instance of intelliJ?

1k Views Asked by At

I have two windows open in intelliJ IDEA ultimate 11.1.4. Lets call them windowA and windowB. In windowA I'm running Tomcat 7 localy. In windowB I want to run a remote tomcat configuration to debug the code deployed to the instance of tomcat that's running in windowA. To this end I've added these VM options to the local tomcat configuration:

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

When I try to start up tomcat i get this error message:

ERROR: Cannot load this JVM TI agent twice, check your java command line for duplicate jdwp options.

and here is the full server output:

B:\apache-tomcat-7.0.27\bin\catalina.bat run
ERROR: Cannot load this JVM TI agent twice, check your java command line for duplicate jdwp options.
Using CATALINA_BASE:   "C:\Users\dallend\.IntelliJIdea11\system\tomcat\Unnamed_davidswebapp_8"
Using CATALINA_HOME:   "B:\apache-tomcat-7.0.27"
Using CATALINA_TMPDIR: "B:\apache-tomcat-7.0.27\temp"
Using JRE_HOME:        "B:\java\jdk1.6.0_33"
Using CLASSPATH:       "B:\apache-tomcat-7.0.27\bin\bootstrap.jar;B:\apache-tomcat-7.0.27\bin\tomcat-juli.jar"
Error occurred during initialization of VM
agent library failed to init: jdwp
Disconnected from server

I'm guessing that what I'm trying to do here is completely uneccesary and that really I should try something like this: Can IntelliJ debug two war files on the same instance of tomcat?

but still I'm a curious guy and so I've got some questions:

  • What does the error message above mean?
  • Why is the error occuring?
  • Is what I'm trying to do possible with intelliJ?
  • As stated above, I'm probobly just being stupid by trying to do this, but are there any ever times when it's a good idea to try to remote-debug tomcat running localy in IntelliJ from a different instance of IntelliJ?
2

There are 2 best solutions below

0
On

To enable remote debugging will not be able to start the application in debug mode. You should run the program (-Xdebug -Xrunjdwp:transport)directly.Not configured for remote debugging and then start the program by debugging

0
On

IntelliJ is probably adding his own -Xrunjdwp: argument to attach his agent.

If you look at the first line in your debug console, you will see the command IntelliJ has built.

JDWP support only one debugger at the time. You'll have to choose between the two. Running the command outside of IntelliJ should fix this problem.