在JDK 14应用程序上启用jdwp会导致“Address family not supported by protocol”错误。

huangapple go评论77阅读模式
英文:

Enabling jdwp on a jdk 14 app results in Address family not supported by protocol error

问题

在运行于Linux系统上的JDK 14应用程序中,添加以下JVM参数会导致以下错误:

启动主程序...
错误:传输错误 202:套接字创建失败:协议不支持的地址族
错误:JDWP传输dt_socket无法初始化,TRANSPORT_INIT(510)
JDWP退出错误AGENT_ERROR_TRANSPORT_INIT(197):未初始化任何传输[open/src/jdk.jdwp.agent/share/native/libjdwp/debugInit.c:734]

将地址从*:5005更改为localhost:5005似乎可以工作,但这样它只绑定到本地主机。我确信在JDK 12上*:5005是有效的,我找不到任何关于这方面的更改,事实上,JPDA规范仍然提到了jse 14的*选项:https://docs.oracle.com/en/java/javase/14/docs/specs/jpda/conninv.html。是否有人有任何想法可以让我查看?这是一个错误还是一个我找不到文档的功能呢?

英文:

For a JDK 14 application, running on linux, adding the following JVM parameter

-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005

results in the following error

Starting Main...
ERROR: transport error 202: socket creation failed: Address family not supported by protocol
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [open/src/jdk.jdwp.agent/share/native/libjdwp/debugInit.c:734]

Changing the address from *:5005 to localhost:5005 seems to work but then it's only bound to localhost. I know for a fact that *:5005 worked on JDK 12 and I can't find any changes regarding this, In fact JPDA spec still mentions the * option for jse 14 https://docs.oracle.com/en/java/javase/14/docs/specs/jpda/conninv.html. Anyone got any ideas what I can look into? Is it a bug or a feature for which I can't seem to find documentation for.

答案1

得分: 8

按照@apangin在评论中提到的建议,解决方案是将地址指定为0.0.0.0:5005,或者设置-Djava.net.preferIPv4Stack=true的JVM参数。

英文:

As @apangin suggested in the comment. The solution is to specify the address as 0.0.0.0:5005 or to set the -Djava.net.preferIPv4Stack=true JVM parameter.

huangapple
  • 本文由 发表于 2020年9月18日 20:24:26
  • 转载请务必保留本文链接:https://go.coder-hub.com/63955736.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定