Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remote debugging: No connection to Wildfly 14 on OpenJDK 11 at port 8787

Tags:

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.

like image 330
Sebastian S Avatar asked Nov 07 '18 22:11

Sebastian S


People also ask

How do I enable remote debug in WildFly?

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.

Where is JBoss debug port?

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.


1 Answers

For jdk 11,you should use

-agentlib:jdwp=transport=dt_socket,address=*:8787,server=y,suspend=n 

instead.

like image 111
white.black Avatar answered Sep 18 '22 08:09

white.black