Could not obtain the localhost address...解决方法

[[178879]]

Weblogic:Could not obtain the localhost address…解决方法

启动Weblogic报错:

 
 
  1. <Server subsystem failed. Reason: java.lang.AssertionError: Could not obtain the localhost address. The most likely cause is an error in the network configuration of this machine. 
  2. java.lang.AssertionError: Could not obtain the localhost address. The most likely cause is an error in the network configuration of this machine. 
  3.  at weblogic.server.channels.AddressUtils$AddressMaker.getLocalHost(AddressUtils.java:40) 
  4.  at weblogic.server.channels.AddressUtils$AddressMaker.<clinit>(AddressUtils.java:35) 
  5.  at weblogic.server.channels.AddressUtils.getIPAny(AddressUtils.java:105) 
  6.  at weblogic.protocol.configuration.ChannelHelper.checkConsistency(ChannelHelper.java:60) 
  7.  at weblogic.server.channels.ChannelService.start(ChannelService.java:197) 
  8.  Truncated. see log file for complete stacktrace 
  9. java.net.UnknownHostException: bogon: bogon 
  10.  at java.net.InetAddress.getLocalHost(InetAddress.java:1354) 
  11.  at weblogic.server.channels.AddressUtils$AddressMaker.getLocalHost(AddressUtils.java:38) 
  12.  at weblogic.server.channels.AddressUtils$AddressMaker.<clinit>(AddressUtils.java:35) 
  13.  at weblogic.server.channels.AddressUtils.getIPAny(AddressUtils.java:105) 
  14.  at weblogic.protocol.configuration.ChannelHelper.checkConsistency(ChannelHelper.java:60) 
  15.  Truncated. see log file for complete stacktrace 

解决方法:

修改hosts文件

 
 
  1. $:vi /etc/hosts 
  2. #添加 IP hostname ($:hostname 查询) 
  3. 127.0.0.1 localhost.localdomain localhost 
  4. 127.0.0.1 localhost6.localdomain6 localhost6 
  5. 127.0.0.1 bogon #这里就是我添加的,我的主机名就是bogon 

【本文是专栏作者张勇波的原创文章,转载请通过获取作者授权】

THE END