2

When I try to start a WebSphere Liberty server in debug mode (to connect the Eclipse Java debugger) via:

$ ./wlp/bin/server debug MyServer

I get the following error:

Error occurred during initialization of VM
agent library failed to init: jdwp
ERROR: Cannot load this JVM TI agent twice, check your java command line for duplicate jdwp options.

and the server doesn't start.

3 Answers 3

3

The jvm.options contents can collide with the 'debug' subcommand

If the jvm.options file already includes options enabling the debugger then use the

liberty start <server>

subcommand rather than:

liberty debug <server>

E.g. in my case my server had file .../usr/servers/MyServer/jvm.options with contents:

#Generated by liberty-maven-plugin
-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=7777

so these options collided with the options triggered by the debug subcommand.

OR

You can remove the jvm.options contents or file and use the debug subcommand instead.

NOTE: Reading this explanation, the error message becomes clear, but this Q&A is hopefully useful in case it didn't occur to someone that this is the solution.

0

In jvm.options put these entries:

-Dwas.debug.mode=true
-Dcom.ibm.websphere.ras.inject.at.transform=true
-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=7777
0

Just to add an update, jvm.options can also reside in /usr/shared so the same debug options span multiple servers. This would be a bad approach if you're running multiple servers and need to debug them all individually.

Not the answer you're looking for? Browse other questions tagged or ask your own question.