---
title: "weblogic启动报错java.net.UnknownHostException"
author: "andyniu"
date: "2014-04-16T14:16:57Z"
tags: []
categories: ["开源软件"]
slug: "weblogic-java-net-unknownhostexception"
draft: false
lastmod: "2014-04-16T14:16:57Z"
id: 2047341
url: "https://andyniu.iteye.com/blog/2047341"
---

今天接收运维提供一台机器，启动weblogic的时候出现下面的错误：   
&lt;Aug 18, 2010 9:48:10 PM CST&gt; &lt;Critical&gt; &lt;WebLogicServer&gt; &lt;BEA-000386&gt; &lt;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.   
java.lang.AssertionError: Could not obtain the localhost address. The most likely cause is an error in the network configuration of this machine.   
        at weblogic.server.channels.AddressUtils$AddressMaker.getLocalHost(AddressUtils.java:40)   
        at weblogic.server.channels.AddressUtils$AddressMaker.&lt;clinit&gt;(AddressUtils.java:35)   
        at weblogic.server.channels.AddressUtils.getIPAny(AddressUtils.java:105)   
        at weblogic.protocol.configuration.ChannelHelper.checkConsistency(ChannelHelper.java:60)   
        at weblogic.server.channels.ChannelService.start(ChannelService.java:197)   
        Truncated. see log file for complete stacktrace   
java.net.UnknownHostException: qswm: qswm   
        at java.net.InetAddress.getLocalHost(InetAddress.java:1354)   
        at weblogic.server.channels.AddressUtils$AddressMaker.getLocalHost(AddressUtils.java:38)   
        at weblogic.server.channels.AddressUtils$AddressMaker.&lt;clinit&gt;(AddressUtils.java:35)   
        at weblogic.server.channels.AddressUtils.getIPAny(AddressUtils.java:105)   
        at weblogic.protocol.configuration.ChannelHelper.checkConsistency(ChannelHelper.java:60)   
        Truncated. see log file for complete stacktrace   
&gt;   
经过Google，看了几篇文章，问题基本定位在hosts文件上面。打开/etc/hosts文件，果然发现没有配置机器名对应的ip地址，于是在文件里面加入：   
127.0.0.1 qswm     注：qswm是机器名称。   
保存后，再次启动weblogic正常启动。