zl程序教程

您现在的位置是:首页 >  其他

当前栏目

[J2MEQ&A]WTK初始化WMAClient报错XXX has no IP address的解释

ampIP 报错 解释 No 初始化 has xxx
2023-09-14 08:58:21 时间

WMAClient: localhost has no IP address: java.net.UnknownHostException: xxxx: xxxx
Warning: Failed to initialize WMA message routing support
ClientConnector: localhost has no IP address: java.net.UnknownHostException: xxxx: xxxx
Warning: Failed to initialize Bluetooth (JSR 82) support


Running with storage root DefaultColorPhone
WMAClient: localhost has no IP address: java.net.UnknownHostException: 梅花
Warning: Failed to initialize WMA message routing support
ClientConnector: localhost has no IP address: java.net.UnknownHostException: 梅花


如果你第一次运行WTK之后,就改变了本机的IP地址,那么可能会导致WTK误认为你没有IP地址。或者你需要检查是否有网卡。

  

或者检查你的机器名,不能为中文。

把你的IP地址改回第一次运行WTK时的那个。

或装一个网卡。

  

或将机器名改为英文名称。

[详细解释]

可能WTK初始化WMAClient和ClientConnector时,必须先运行InetAddress.getLocalHost()来寻找localhost的IP地址。

但是你看

http://www.vf.utwente.nl/~vriesajk/j2me/java/net/InetAddress.html#getLocalHost()

它说了

“Throws:

UnknownHostException - if no IP address for the host could be found.

所以,如果它没有能够找到IP地址的话,它就报告“localhost has no IP address”。


UNP总结 Chapter 11 名字与地址转换 本章讲述在名字和数值地址间进行转换的函数:gethostbyname和gethostbyaddr在主机名字与IP地址间进行转换,getservbyname和getservbyport在服务器名字和端口号间进行转换。
郑昀 ☑移动数据业务 times;6年 ☑语义聚合 times;4年 ☑O2O times;5年的一个老兵。