IntelliJ - Remote debug - Unable to open debugger port

glassfish, intellij-idea, java, payara

Solution

- In glassfish\domains\domain1\config\domain.xml :

<java-config classpath-suffix="" debug-options="-agentlib:jdwp=transport=dt_socket,address=9009,server=y,suspend=n" java-home="C:\Program Files\Java\jdk1.8.0_162" debug-enabled="true" system-classpath="">

or in http://localhost:4848/common/index.jsf 2. In current Idea - Server Run Configuration - Debug - Port - address

Problem

I am using IntelliJ 2017.3 with Payara 4.1.2.172. I used to just start the server from the command line had a Remote Debug running on port 9009, and everything used to work fine. Then I set up an plugged in server with attached modules in IntelliJ, to enable HotSwap. I run this server in debug mode, and it works fine. Now, if I don't use the plugged in server, but want to start the server as previous, when I run the debug remote, I get the following: Error Error running 'Debug Glassfish OSM': Unable to open debugger port (localhost:9009): java.net.ConnectException "Connection refused: connect" I have run a netstat and there's nothing running on port 9009. Question How do I get the remote debug working on the server? More info The domail.xml has: ``` <system-property name="JAVA_DEBUGGER_PORT" value="9009"></system-property> ``` And in the server-config JVM Settings: More info I set the above 'Enable' checkbox to on, but now I get the following error when I try start the server, i.e. the server won't start now. (netstat shows noting running on port 9009) 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 [debugInit.c:750] If I set it to off in the damain.cml, I still get the error and am unable to start the server. ``` <java-config classpath-suffix="" debug-options="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=${JAVA_DEBUGGER_PORT}" debug-enabled="true" system-classpath=""> ```

Original source