Friday, September 04, 2015

Glassfish debug error

Starting Glassfish with --debug option fails, producing an error similar to below;

Waiting for domain1 to start .Error starting domain domain1.
The server exited prematurely with exit code 134.
Before it died, it produced the following output:

FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)
ERROR: transport error 202: connect failed: Connection refused
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [../../../src/share/back/debugInit.c:750]

Command start-domain failed.

The problem was identified to be the jpda settings in the domain.xml file. These were set to server=n,suspend=y instead of server=y,suspend=n. Setting the server directive to "yes" and the suspend directive fixed the problem.

In the end, the java debug options look like this;

<java-config classpath-suffix="" debug-options="-agentlib:jdwp=transport=dt_socket,address=9090,server=y,suspend=n" java-home="/path/to/java/home" system-classpath="">