【问题标题】:Remote debug docker+wildfly with intelliJ 2017.2.6使用 IntelliJ 2017.2.6 远程调试 docker+wildfly
【发布时间】:2018-03-16 09:23:18
【问题描述】:

所以有很多关于这个主题的帖子,但似乎都没有帮助。

我有一个应用程序在 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

我什至可以使用 localhost:9990/console 上的凭据 admin:admin 访问管理控制台

但是 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

我完全不知道问题可能是什么......

有趣的是,在 intelliJ 失败后,如果我使缓存无效并重新启动,wildfly 会重新打印消息说它正在侦听端口 9999

【问题讨论】:

  • >"我创建了一个远程 JBoss 服务器配置,它在服务器选项卡中指向具有管理端口 9990 的 localhost。"对于主机字段,您应该指定可从您的 PC 访问的远程接口,IDE 将在其中部署工件。
  • >"在启动/连接选项卡中,我输入了 9999 作为远程套接字端口。"在那里,您应该复制 Debug 模式的命令行并使用它来启动远程 VM。然后使用 JBoss Remote Run/Debug 配置连接到已启动的远程 VM。参考JBoss配置Server tab for a remote configuration

标签: docker intellij-idea wildfly remote-debugging


【解决方案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"]

码头工人撰写:

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 上。

【讨论】:

    【解决方案2】:

    不确定这是否可以被视为答案,因为它解决了问题。 但我解决这个问题的方法是在 intelliJ 中添加“纯”远程配置,而不是 jboss 远程。这意味着它不会自动部署,但我可以接受

    【讨论】:

    • 这很有帮助...我的 dockerized wildfly 项目遇到了完全相同的问题。您能解释一下您是如何配置“纯”远程配置的吗?
    • 我很久没有对wildfly做过了,但可以肯定的是它离正常情况不会太远。所以看看这里stackoverflow.com/questions/21114066/…
    猜你喜欢
    • 1970-01-01
    • 2016-07-01
    • 2014-07-25
    • 2017-02-03
    • 1970-01-01
    • 2018-03-01
    • 2023-03-14
    • 2012-07-23
    • 1970-01-01
    相关资源
    最近更新 更多