Thursday, January 22, 2015

Friday, December 26, 2014

Getting java.net.UnknownHostException while starting WebLogic Admin Server

Problem

Unable to start the WebLogic Admin server 11g (10.3.6) and getting "UnknownHostException"

Error Message

(1) Some times we will get the error message "
java.lang.AssertionError: Could not obtain the localhost address. The most likely cause is an error in the network configuration of this machine"


<Dec 27, 2014 9:18:33 AM IST> <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.BasicServerChannelImpl.getLocalHost(BasicServerChannelImpl.java:59)
    at weblogic.server.channels.BasicServerChannelImpl.<clinit>(BasicServerChannelImpl.java:54)
    at weblogic.rjvm.t3.ProtocolHandlerT3$ChannelInitializer.<clinit>(ProtocolHandlerT3.java:37)
    at weblogic.rjvm.t3.ProtocolHandlerT3.getDefaultServerChannel(ProtocolHandlerT3.java:42)
    at weblogic.server.channels.ChannelService.createServerChannels(ChannelService.java:506)
    Truncated. see log file for complete stacktrace
Caused By: java.net.UnknownHostException: OEL: OEL
    at java.net.InetAddress.getLocalHost(InetAddress.java:1360)
    at weblogic.server.channels.BasicServerChannelImpl.getLocalHost(BasicServerChannelImpl.java:57)
    at weblogic.server.channels.BasicServerChannelImpl.<clinit>(BasicServerChannelImpl.java:54)
    at weblogic.rjvm.t3.ProtocolHandlerT3$ChannelInitializer.<clinit>(ProtocolHandlerT3.java:37)
    at weblogic.rjvm.t3.ProtocolHandlerT3.getDefaultServerChannel(ProtocolHandlerT3.java:42)
    Truncated. see log file for complete stacktrace
>
<Dec 27, 2014 9:18:34 AM IST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to FAILED>
<Dec 27, 2014 9:18:34 AM IST> <Error> <WebLogicServer> <BEA-000383> <A critical service failed. The server will shut itself down>
<Dec 27, 2014 9:18:34 AM IST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to FORCE_SHUTTING_DOWN>



(2) Some times we will get the error message "WLSGeneratorHelper - Unable to determine local host name or IP!"


2014-10-16 11:09:14,308 WARNING [16] com.oracle.cie.domain.WLSGeneratorHelper - Unable to determine local host name or IP!
java.net.UnknownHostException: OEL: OEL: unknown error
at java.net.InetAddress.getLocalHost(InetAddress.java:1484)
at com.oracle.cie.domain.WLSGeneratorHelper.initGeneratorStore(WLSGeneratorHelper.java:1263)
at com.oracle.cie.domain.WLSGeneratorHelper.initDomainGenerator(WLSGeneratorHelper.java:274)
at com.oracle.cie.domain.WLSGeneratorHelper.createDomainGenerator(WLSGeneratorHelper.java:176)
at com.oracle.cie.domain.WLSGeneratorHelper.createGenerator(WLSGeneratorHelper.java:519)
at com.oracle.cie.domain.WLSGeneratorHelper.createConfigAction(WLSGeneratorHelper.java:494)
at com.oracle.cie.wizard.domain.gui.tasks.ProgressGUITask.configure(ProgressGUITask.java:123)
at com.oracle.cie.wizard.domain.gui.tasks.ProgressGUITask.configure(ProgressGUITask.java:40)
at com.oracle.cie.wizard.internal.cont.AbstractTaskContainer.doConfigureTask(AbstractTaskContainer.java:119)
at com.oracle.cie.wizard.internal.cont.AbstractTaskContainer.setTask(AbstractTaskContainer.java:43)
at com.oracle.cie.wizard.internal.engine.WizardControllerEngine.goForward(WizardControllerEngine.java:720)
at com.oracle.cie.wizard.internal.engine.WizardControllerEngine.run(WizardControllerEngine.java:229)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.UnknownHostException: OEL: unknown error
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:907)
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1302)
at java.net.InetAddress.getLocalHost(InetAddress.java:1479)
... 12 more 


Cause
From the above log traces, the hostname or DNS Server name OEL is not configured. We have WebLogic Server installed on our Oracle Virtual Box

$ uname -a
Linux OEL 2.6.39-400.214.3.el6uek.x86_64 #1 SMP Thu Feb 13 17:08:24 PST 2014 x86_64 x86_64 x86_64 GNU/Linux

$ hostname
OEL
$ cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
[mastshai@OEL mastan_domain]$ 

 
In the above hosts file, the OEL hostname entry was not present.

Solution
To fix the issue, we need to add the hostname or DNS server name in /etc/hosts file and bounced the Admin Server

$ cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4 OEL

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6