What are the options of remote debugging like:-Xrunjdwp, server, suspend? 📎
To debug an application remotely, you will have to set options like: -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=4242
. This allows remote debuggers (jdb even ships with JDK) to attach to a running Java process.
There are two flavors of transports: dt_socket
and dt_shmem
. The dt_shmem
option only works in case both processes are running on the same platform and is only available on Windows.
With suspend=y
the Java-process will wait until the debugger connects, with suspend=n
you will be also able to debug the application servers startup process.
The option server=y
opens a socket and listens for incoming debugger requests. With server=n
the debugged application will try to connect actively to a debugger and run therefore as a client.
So there is no black magic involved in debugging application servers. As long they are implemented in Java, you will be always able to debug them. Even without any fancy tools.
See "official" list of all available remote debugging options: http://docs.oracle.com/javase/1.5.0/docs/guide/jpda/conninv.html
See you at Java EE Workshops at MUC Airport or on demand and in a location very near you: airhacks.io!