---
title: "weblogic启动报错java.net.UnknownHostException"
author: "java-xp"
date: "2010-08-18T13:54:58Z"
tags: []
categories: ["企业架构"]
slug: "weblogic-java-net-unknownhostexception"
draft: false
lastmod: "2010-08-18T13:54:58Z"
id: 740118
url: "https://java-xp.iteye.com/blog/740118"
---

今天接收运维提供一台机器，启动weblogic的时候出现下面的错误：
<Aug 18, 2010 9:48:10 PM CST> <Critical> <WebLogicServer> <BEA-000386> <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.<clinit>(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.<clinit>(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
> 
经过Google，看了几篇文章，问题基本定位在hosts文件上面。打开/etc/hosts文件，果然发现没有配置机器名对应的ip地址，于是在文件里面加入：
127.0.0.1 qswm     注：qswm是机器名称。
保存后，再次启动weblogic正常启动。