所以围绕这个主题有很多帖子,但似乎都没有帮助。
我在docker容器内的wildfly服务器上运行了一个应用程序。 由于某种原因,我无法将远程调试器连接到它。
因此,它是一个使用此命令启动的wildfly 11服务器:
/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
我甚至可以使用凭据admin:admin on localhost:9990/console
然而,IntelliJ拒绝连接......我创建了一个远程JBoss服务器配置,在服务器选项卡中指向具有管理端口9990的localhost。 在启动/连接选项卡中,我输入了9999作为远程套接字端口。
docker镜像公开了端口9999和9990,docker-compose文件按原样绑定了这些端口。
即使所有这些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
我完全不知道问题是什么......
Interessting的补充是,在intelliJ失败之后,如果我使缓存失效并重新启动,那么wildfly会重新打印消息,说它正在侦听端口9999
答案 0 :(得分:1)
不确定这是否可以被视为答案,因为它解决了问题。 但我解决这个问题的方法是在intelliJ中添加一个“纯粹的”远程配置而不是jboss remote。这意味着它不会自动部署,但我很好用
答案 1 :(得分:1)
万一将来有人遇到同样的问题,我在这里找到了这个解决方案: https://github.com/jboss-dockerfiles/wildfly/issues/91#issuecomment-450192272
基本上,从--debug参数开始,您还需要传递*:8787
Dockerfile:
CMD ["/opt/jboss/wildfly/bin/standalone.sh", "-b", "0.0.0.0", "-bmanagement", "0.0.0.0", "--debug", "*:8787"]
docker-compose:
ports:
- "8080:8080"
- "8787:8787"
- "9990:9990"
command: /opt/jboss/wildfly/bin/standalone.sh -b 0.0.0.0 -bmanagement 0.0.0.0 --debug *:8787
我尚未测试docker-compose解决方案,因为我的解决方案位于dockerfile上。