远程调试:在端口8787上未连接OpenJDK 11上的Wildfly 14 [英] Remote debugging: No connection to Wildfly 14 on OpenJDK 11 at port 8787

查看:321
本文介绍了远程调试:在端口8787上未连接OpenJDK 11上的Wildfly 14的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将调试器连接到在Open JDK 11上运行的Wildlfy。

I'm trying to connect my debugger to Wildlfy running on Open JDK 11.

尽管Wildfly说:

Despite Wildfly says:


收听地址为dt_socket的运输:8787

我的IDE(IntelliJ IDEA CE 2018.1)声称没有任何连接:

My IDE (IntelliJ IDEA CE 2018.1) claims that it doesn't get any connection:


无法打开调试器端口(localhost:8787):java.io.IOException握手失败-连接过早关闭。。

我正在通过 standalone.sh --debug 启动Wildfly,从而导致以下 JAVA_OPTS

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

Java 9/10/11中有什么变化吗?使用Oracle JDK 8时,使用完全相同的设置进行远程调试可以很好地工作。

Did something change in Java 9/10/11? Remote debugging with the exact same setup works fine when using Oracle JDK 8.

使用telnet,我可以确认端口 8787 确实无法访问。

Using telnet I can confirm, that port 8787 is indeed not reachable.

更新,请先阅读@ehsavoie的评论: netstat -ln 在运行Wildfly的服务器上显示:

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 

显然使用OpenJDK 11调试端口现在默认情况下已绑定到localhost。

So apparently with OpenJDK 11 the debug port is now bound to localhost by default.

推荐答案

原因在于默认行为是Java 9根据此答案:从Java 9开始,除非另有说明,JVM仅接受本地连接。

The cause lies in the default behaviour that changed with Java 9 according to this answer: Beginning with Java 9, the JVM only accepts local connections unless otherwise specified.

因此解决方案非常简单:

Therefore the solution is fairly easy:

使用Java 8时,我足以使用-debug 和Java 9启动Wildfly,我需要将其更改为-debug *:8787

While with Java 8 it is sufficient to start Wildfly with --debug, with Java 9 I needed to change this to --debug *:8787.

这篇关于远程调试:在端口8787上未连接OpenJDK 11上的Wildfly 14的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆