127.0.0.1 localhost
服务器操作系统:Red Hat Enterprise Linux Server release 5.3
JDK:1.6.0_31
AAS:7.0
直接在linux命令行运行./startapusic,运行时,发生如下异常:
2012-03-12 11:04:09 错误 [apusic.service.Muxer] 启动失败
java.net.UnknownHostException: localhost.localdomain: localhost.localdomain
at java.net.InetAddress.getLocalHost(InetAddress.java:1360)
at com.apusic.net.Muxer.startService(Unknown Source)
at com.apusic.service.Service.start(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.apusic.jmx.MBeanDescriptor.invoke(Unknown Source)
at com.apusic.jmx.DynamicMBeanSupport.invoke(Unknown Source)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
at com.apusic.server.J2EEServer.start(Unknown Source)
at com.apusic.server.J2EEServer.startup(Unknown Source)
at com.apusic.server.Main.main(Unknown Source)
一看“java.net.UnknownHostException”,应该是hosts文件配置不正确造成的。
打开目前的/etc/hosts文件内容如下:
127.0.0.1 localhost
而异常信息看起来是名字为:localhost.localdomain的domain不能被识别。想起来网卡的配置里面DNS下的“主机名”被配置为:localhost.localdomain,但是hosts文件中并没有添加对localhost.localdomain的配置,因此,要么调整主机名,要么修改/etc/hosts文件,修改hosts文件还是比较安全可控的,因此,修改/etc/hosts文件为如下内容:
127.0.0.1 localhost.localdomain localhost
重新启动AAS,OK!