Java – remote debugging: no connection to wildly 14 on openjdk 11 on port 8787

I'm trying to connect my debugger to wild. Net running on open JDK 11

Although wildfly said:

My IDE (IntelliJ idea CE 2018.1) claims that it has no connection:

I passed the standard SH – debug starts wildfly and produces 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

Are there any changes in Java 9 / 10 / 11? When using Oracle JDK 8, remote debugging with exactly the same settings can work normally

Using telnet, I can confirm that port 8787 is indeed inaccessible

Updated after reading @ ehsavoie's comments: 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

Obviously, using openjdk 11, the debug port is now bound to localhost by default

Solution

The reason is that the default behavior changed in Java 9 according to this answer: starting from Java 9, the JVM only accepts local connections unless otherwise specified

So the solution is fairly easy:

When using java 8, it is enough to start wildly with – debug. When using java 9, I need to change it to – debug *: 8787

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>