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!