Friday, November 9, 2012

java.lang.IllegalStateException while configuring Oracle NoSQL


“Big Data” is the well know terminology in today's IT industry. Many people are working in this area. It inspired me to do some experiments with Big Data and I started exploring Oracle NoSQL. Though its much simpler to install and use Oracle NoSQL, I face many challenges. One of them is here.

I came across below exception while configuring KV Store on my system.
Oracle NoSQL DB 11gR2.1.2.123 java.lang.IllegalStateException: unexpected exception creating environment java.lang.IllegalStateException: unexpected exception creating environment
 at oracle.kv.impl.admin.Admin.openEnv(Admin.java:407)
 at oracle.kv.impl.admin.Admin.renewRepEnv(Admin.java:335)
 at oracle.kv.impl.admin.Admin.(Admin.java:230)
 at oracle.kv.impl.admin.AdminService.configure(AdminService.java:252)
 at oracle.kv.impl.admin.CommandServiceImpl$33.execute(CommandServiceImpl.java:629)
 at oracle.kv.impl.fault.ProcessFaultHandler.execute(ProcessFaultHandler.java:142)
 at oracle.kv.impl.admin.CommandServiceImpl.configure(CommandServiceImpl.java:624)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:616)
 at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)
 at sun.rmi.transport.Transport$1.run(Transport.java:177)
 at java.security.AccessController.doPrivileged(Native Method)
 at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
 at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:553)
 at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:808)
 at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:667)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
 at java.lang.Thread.run(Thread.java:679)
Caused by: java.lang.ExceptionInInitializerError
 at com.sleepycat.je.rep.elections.Elections.(Elections.java:193)
 at com.sleepycat.je.rep.impl.node.RepNode.startup(RepNode.java:711)
 at com.sleepycat.je.rep.impl.node.RepNode.joinGroup(RepNode.java:1542)
 at com.sleepycat.je.rep.impl.RepImpl.joinGroup(RepImpl.java:459)
 at com.sleepycat.je.rep.ReplicatedEnvironment.joinGroup(ReplicatedEnvironment.java:414)
 at com.sleepycat.je.rep.ReplicatedEnvironment.(ReplicatedEnvironment.java:467)
 at com.sleepycat.je.rep.ReplicatedEnvironment.(ReplicatedEnvironment.java:332)
 at com.sleepycat.je.rep.ReplicatedEnvironment.(ReplicatedEnvironment.java:396)
 at oracle.kv.impl.admin.Admin.openEnv(Admin.java:380)
 ... 20 more
Caused by: com.sleepycat.je.EnvironmentFailureException: (JE 5.0.36) java.net.UnknownHostException: macmini-opensuse: macmini-opensuse UNEXPECTED_EXCEPTION: Unexpected internal Exception, may have side effects.
 at com.sleepycat.je.EnvironmentFailureException.unexpectedException(EnvironmentFailureException.java:286)
 at com.sleepycat.je.rep.elections.TimebasedProposalGenerator.(TimebasedProposalGenerator.java:107)
 ... 29 more
Caused by: java.net.UnknownHostException: macmini-opensuse: macmini-opensuse
 at java.net.InetAddress.getLocalHost(InetAddress.java:1426)
 at com.sleepycat.je.rep.elections.TimebasedProposalGenerator.(TimebasedProposalGenerator.java:62)
 ... 29 more
The problem is created due to not getting correct IP and host name binding. You will find the IP and host name binding in /etc/hosts file. The following steps helped me to solve the issue.

Get Host Name

Identify the host name of your system by using hostname command.
 $ hostname

Get IP address

Get IP address of your system using ifconfig command.
 $ ifconfig

Correct IP and host binding

Comment loopback addresses in your /etc/hosts file. It starts with '127.0.'. and add new line 'ipaddress hostname localhost'
#127.0.0.1 localhost
#127.0.1.1 localhost
192.168.50.50 localhost my-desktop
It solved my problem.