You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

当客户端为localhost时,Java服务器为何返回lm.licenses.adobe.com作为主机名?

本地运行Java客户端-服务器时,localhost主机名被识别为Adobe域名的原因

先看运行的Java代码:

public class Client{
    public static void main(String[] args) throws IOException{
        Socket s = new Socket("localhost", 8080);
        s.close();
    }
}
public class Server{
    public static void main(String[] args) throws IOException, ClassNotFoundException{
        ServerSocket ss = new ServerSocket(8080);
        Socket s = ss.accept();
        InetAddress inetAddress = s.getInetAddress();
        System.out.println("Client's host name is " + inetAddress.getHostName());
        System.out.println("Client's IP Address is " + inetAddress.getHostAddress());
        ss.close();     s.close();
    }
}

本地运行后,服务器输出如下:

Client's host name is lm.licenses.adobe.com
Client's IP Address is 127.0.0.1

原因分析

这是因为Java的getHostName()方法依赖反向DNS解析获取IP对应的主机名,问题出在本地系统的解析配置:

  • 你的系统hosts文件(Windows路径C:\Windows\System32\drivers\etc\hosts,Linux/macOS路径/etc/hosts)可能被修改过,存在127.0.0.1 lm.licenses.adobe.com的映射条目,部分Adobe软件安装时会添加这类配置;
  • 若hosts文件无对应项,可能是本地DNS缓存或DNS服务器的反向解析结果把127.0.0.1指向了该域名。

解决方法

  • 打开系统hosts文件,查找是否有127.0.0.1 lm.licenses.adobe.com相关条目,可通过在行首添加#注释掉,或直接删除该条目;
  • 清理本地DNS缓存,确保后续解析恢复正常。

内容的提问来源于stack exchange,提问作者Osama El-Ghonimy

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.04 22:05:54