Java JDB:错误:传输错误202:gethostbyname:未知主机 [英] Java JDB: ERROR: transport error 202: gethostbyname: unknown host
问题描述
我对此帖子有非常相似的错误消息帖子;但是,同一职位上的解决方案对我不起作用。不幸的是,编辑主机文件时将 127.0.0.1 my-host-name
添加到我的主机文件中(按链接线程中的每个解决方案)。
I have a very similar error message to this post; however, the solution on that same post did not work for me. Editing the host file my adding in 127.0.0.1 my-host-name
to my hosts file (per solution in linked thread) did nothing for me unfortunately.
在JDB中运行后,出现以下错误消息:
After "run" in JDB, I get the following error message:
初始化jdb ..
Initializing jdb ...
运行运行QuadtreeBitmap VM启动异常:VM初始化失败:
/Library/Java/JavaVirtualMachines/jdk-9.0。 4.jdk / Contents / Home / bin / java
-Xdebug -Xrunjdwp:transport = dt_socket,address = Patricks-iMac.local:50547,suspend = y
QuadtreeBitmap
run run QuadtreeBitmap VM start exception: VM initialization failed for: /Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home/bin/java -Xdebug -Xrunjdwp:transport=dt_socket,address=Patricks-iMac.local:50547,suspend=y QuadtreeBitmap
错误:传输错误202:gethostbyname:未知主机错误:JDWP
传输dt_socket初始化失败,TRANSPORT_INIT(510)JDWP
退出错误AGENT_ERROR_TRANSPORT_INIT (197):没有初始化传输的
[debugInit.c:730]
ERROR: transport error 202: gethostbyname: unknown host ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510) JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [debugInit.c:730]
致命错误:目标VM初始化失败。
Fatal error: Target VM failed to initialize.
我正在使用MacOS并尝试直接通过终端(而不是通过Eclipse或任何其他IDE)启动JDB。
I am using MacOS and trying to launch JDB directly through the terminal (and not through Eclipse or any other IDE).
推荐答案
jvm正在尝试在主机 Patricks-iMac.local
,端口 50547 $ c的主机上打开
dt_socket
$ c>,但首先需要将该主机名解析为IP地址。 DNS查找将失败,因为它是分配给专用地址的虚拟主机名,除非系统管理员配置了DNS服务器,否则DNS服务器通常不知道这些主机名(公司通常会这样做)。为此,有两种解决方案:
The jvm is trying to open the dt_socket
at host Patricks-iMac.local
, port 50547
but needs first to resolve that host name to an IP address. DNS lookup will fail since it's a dummy hostname assigned to a private address and DNS servers usually don't know about them unless a sysadmin has configured them (companies use to do that). There are two solutions for this:
1)在主机文件上添加主机名映射,同时保留为该IP配置的其他名称
127.0.0.1 localhost Patricks-iMac.local
1) Add the hostname mapping on hosts file keeping other names configured for that IP
127.0.0.1 localhost Patricks-iMac.local
2)通过IP地址配置dt_socket,而无需触摸主机文件(推荐)
2) Configure the dt_socket by IP address without touching hosts file (recommended)
-Xrunjdwp:transport = dt_socket,address = 127.0.0.1:50547
有关网络故障排除的信息:
* 未知主机
表示DNS问题,TCP连接未从以下位置开始都是因为IP地址不可用。
* 主机不可达
表示TCP连接问题,由于防火墙,路由或其他问题。 ping
到该IP将失败。
* 端口不可达
表示TCP连接问题,即IP可以访问,但端口不是由于防火墙,服务关闭等原因。对IP的 ping
可以正常工作,但与该端口的连接仍然会失败。
A word on networking troubleshooting:
* unknown host
means DNS problems, TCP connection did not start at all because an IP address was not available.
* host unreachable
means TCP connectivity problems, an IP is known but not reachable because of firewall, routing or other problems. ping
to that IP will fail.
* port unreachable
means TCP connectivity problems, the IP is reachable but the port is not because of firewalls, service is down, etc. ping
to the IP will work but connections to that port will still fail.
这篇关于Java JDB:错误:传输错误202:gethostbyname:未知主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!