I'm trying to connect my debugger to Wildlfy running on Open JDK 11.
Despite Wildfly says:
Listening for transport dt_socket at address: 8787
My IDE (IntelliJ IDEA CE 2018.1) claims that it doesn't get any connection:
Unable to open debugger port (localhost:8787): java.io.IOException "handshake failed - connection prematurally closed"
.
I'm starting Wildfly via standalone.sh --debug
resulting in the following JAVA_OPTS
:
-server -Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED --add-exports=jdk.unsupported/sun.reflect=ALL-UNNAMED --add-modules=java.se
Did something change in Java 9/10/11? Remote debugging with the exact same setup works fine when using Oracle JDK 8.
Using telnet I can confirm, that port 8787
is indeed not reachable.
Update after reading @ehsavoie's comment: netstat -ln
on the server running Wildfly shows:
Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 127.0.0.1:8787 0.0.0.0:* LISTEN
So apparently with OpenJDK 11 the debug port is now bound to localhost by default.
Remote debugging WildFly with Eclipse To enable debugging in your Eclipse IDE, it is generally sufficient to select from the Menu: Run | Debug As | Remote Java application. More in detail, Eclipse won't be able to attach automatically to the JVM with suspend=y.
First, to enable JBoss to allow remote debugging, edit your <jboss install location>/bin/standalone. conf. Now, look for # JAVA_OPTS=”$JAVA_OPTS -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n” and uncomment it. It should be near the bottom.
For jdk 11,you should use
-agentlib:jdwp=transport=dt_socket,address=*:8787,server=y,suspend=n
instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With