使用IntelliJ 2017.2.6远程调试Docker内WildFly失败求助
我翻了一大堆相关文章,但都没能解决我的问题——我在Docker容器中运行了一个部署在WildFly 11服务器上的应用,却始终无法将远程调试器连接到该服务器。
我的配置与已确认的正常状态
- WildFly启动命令:
/opt/jboss/wildfly/bin/standalone.sh -b 0.0.0.0 -bmanagement 0.0.0.0 -c standalone.xml --debug 9999;
- standalone.xml关键配置片段:
<socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/>
- 已验证的正常行为:
- 控制台明确输出:
Listening for transport dt_socket at address: 9999 - 可以通过
localhost:9990/console,使用admin:admin凭据正常访问WildFly管理控制台 - Docker镜像已暴露9999(调试端口)和9990(管理端口),docker-compose文件也完成了这两个端口的绑定映射
IntelliJ配置与报错信息
我在IntelliJ中创建了远程JBoss Server配置:
- 服务器选项卡:目标地址设为
localhost,管理端口填9990 - 启动/连接选项卡:远程套接字端口设置为
9999
但尝试连接时,IntelliJ连续抛出两个错误:
第一个调试端口连接错误:
Error running 'remote':
Unable to open debugger port (localhost:9999): java.io.IOException "handshake failed - connection prematurally closed"
紧接着出现管理端口连接错误:
Error running 'remote':
Unable to connect to the localhost:9990, reason:
com.intellij.javaee.process.common.WrappedException: java.io.IOException: java.net.ConnectException: WFLYPRT0053: Could not connect to remote+http://localhost:9990. The connection failed
奇怪的附加现象
更诡异的是,每次IntelliJ连接失败后,我清理IntelliJ缓存并重启它,WildFly都会重新打印一遍Listening for transport dt_socket at address: 9999的消息。
我完全摸不着头绪,有没有大佬能帮我排查下问题出在哪里?
内容的提问来源于stack exchange,提问作者munHunger

