You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Chandrashekhar Kotekar <sh...@gmail.com> on 2015/03/03 06:07:56 UTC

InvocationTargetException exception from org.apache.hadoop.hbase.client.HConnectionManager.createConnection

My tomcat based REST API application is not able to process request due to
above mentioned error. I have tried following things so far :

   1. checking if all the jar files are available or not
   2. Checking permissions on all files present in tomcat/webapp/ directory
   3. firewall rules
   4. Hbase is availabe or not

but then also getting following exception. I am using CDH 5.3.1 which
contains HBase 0.98.6. Does anyone know how to resolve this issue?


2015-03-03 05:09:02 privateLog [ERROR]
java.lang.reflect.InvocationTargetException
org.apache.hadoop.hbase.client.HConnectionManager.createConnection(HConnectionManager.java:413)

org.apache.hadoop.hbase.client.HConnectionManager.createConnection(HConnectionManager.java:306)
                com.amazon.dao.MyDAO.<clinit>(SensorDataDAO.java:78)

sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)

sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
                java.lang.reflect.Constructor.newInstance(Constructor.java:526)

org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126)

org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:74)

org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:958)

org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:911)

org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)

org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)

org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)

org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)

org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)

org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)

org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)

org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)

org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)

org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)

org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)

org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)

org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4779)

org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5273)

org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)

org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:895)

org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:871)

org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)

org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:958)

org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1599)

java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)

java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
                java.util.concurrent.FutureTask.run(FutureTask.java:166)

java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
                java.lang.Thread.run(Thread.java:724)
                com.amazon.dao.MyDAO  <clinit>


Code which tries to establish connection is as follows:

public class MyDAO {

  protected static HConnection connection;


  static {
      Configuration conf = HBaseConfiguration.create();
      conf.addResource("hbase-site.xml");
      connection = HConnectionManager.createConnection(conf);
      // connection object is still null at this point
    try {
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
}


Regards,
Chandrash3khar Kotekar
Mobile - +91 8600011455

Re: InvocationTargetException exception from org.apache.hadoop.hbase.client.HConnectionManager.createConnection

Posted by Chandrashekhar Kotekar <sh...@gmail.com>.
Hi JM,

Thanks for the answer. My code was missing "hdfs-site.xml". I added this
file as well while creating configuration object and error was gone but
some other errors came which I solved by putting proper jar files on the
class path.

I had to use "hdfs-site.xml" in configuration because my Hadoop cluster is
using name node HA feature. Strange thing is that I was not able to get
this information anywhere. After lot of trial and error I found out that
"hdfs-site.xml" file is also required.




Regards,
Chandrash3khar Kotekar
Mobile - +91 8600011455

On Tue, Mar 3, 2015 at 9:59 PM, Jean-Marc Spaggiari <jean-marc@spaggiari.org
> wrote:

> Hi Chandrashekhar,
>
> Can you make sure your hbase-site.xml is into the classpath and remove the
> addResouce line from your code?
>
> JM
>
> 2015-03-03 0:07 GMT-05:00 Chandrashekhar Kotekar <
> shekhar.kotekar@gmail.com>
> :
>
> > My tomcat based REST API application is not able to process request due
> to
> > above mentioned error. I have tried following things so far :
> >
> >    1. checking if all the jar files are available or not
> >    2. Checking permissions on all files present in tomcat/webapp/
> directory
> >    3. firewall rules
> >    4. Hbase is availabe or not
> >
> > but then also getting following exception. I am using CDH 5.3.1 which
> > contains HBase 0.98.6. Does anyone know how to resolve this issue?
> >
> >
> > 2015-03-03 05:09:02 privateLog [ERROR]
> > java.lang.reflect.InvocationTargetException
> >
> >
> org.apache.hadoop.hbase.client.HConnectionManager.createConnection(HConnectionManager.java:413)
> >
> >
> >
> org.apache.hadoop.hbase.client.HConnectionManager.createConnection(HConnectionManager.java:306)
> >                 com.amazon.dao.MyDAO.<clinit>(SensorDataDAO.java:78)
> >
> > sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> >
> >
> >
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
> >
> >
> >
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> >
> > java.lang.reflect.Constructor.newInstance(Constructor.java:526)
> >
> > org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126)
> >
> >
> >
> org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:74)
> >
> >
> >
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:958)
> >
> >
> >
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:911)
> >
> >
> >
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
> >
> >
> >
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
> >
> >
> >
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
> >
> >
> >
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
> >
> >
> >
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
> >
> >
> >
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
> >
> >
> >
> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
> >
> >
> >
> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
> >
> >
> >
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
> >
> >
> >
> org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
> >
> >
> >
> org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
> >
> >
> >
> org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
> >
> >
> >
> org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4779)
> >
> >
> >
> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5273)
> >
> > org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
> >
> >
> >
> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:895)
> >
> > org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:871)
> >
> > org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
> >
> > org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:958)
> >
> >
> org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1599)
> >
> > java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
> >
> > java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
> >                 java.util.concurrent.FutureTask.run(FutureTask.java:166)
> >
> >
> >
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> >
> >
> >
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> >                 java.lang.Thread.run(Thread.java:724)
> >                 com.amazon.dao.MyDAO  <clinit>
> >
> >
> > Code which tries to establish connection is as follows:
> >
> > public class MyDAO {
> >
> >   protected static HConnection connection;
> >
> >
> >   static {
> >       Configuration conf = HBaseConfiguration.create();
> >       conf.addResource("hbase-site.xml");
> >       connection = HConnectionManager.createConnection(conf);
> >       // connection object is still null at this point
> >     try {
> >     } catch (Exception ex) {
> >       ex.printStackTrace();
> >     }
> >   }
> > }
> >
> >
> > Regards,
> > Chandrash3khar Kotekar
> > Mobile - +91 8600011455
> >
>

Re: InvocationTargetException exception from org.apache.hadoop.hbase.client.HConnectionManager.createConnection

Posted by Jean-Marc Spaggiari <je...@spaggiari.org>.
Hi Chandrashekhar,

Can you make sure your hbase-site.xml is into the classpath and remove the
addResouce line from your code?

JM

2015-03-03 0:07 GMT-05:00 Chandrashekhar Kotekar <sh...@gmail.com>
:

> My tomcat based REST API application is not able to process request due to
> above mentioned error. I have tried following things so far :
>
>    1. checking if all the jar files are available or not
>    2. Checking permissions on all files present in tomcat/webapp/ directory
>    3. firewall rules
>    4. Hbase is availabe or not
>
> but then also getting following exception. I am using CDH 5.3.1 which
> contains HBase 0.98.6. Does anyone know how to resolve this issue?
>
>
> 2015-03-03 05:09:02 privateLog [ERROR]
> java.lang.reflect.InvocationTargetException
>
> org.apache.hadoop.hbase.client.HConnectionManager.createConnection(HConnectionManager.java:413)
>
>
> org.apache.hadoop.hbase.client.HConnectionManager.createConnection(HConnectionManager.java:306)
>                 com.amazon.dao.MyDAO.<clinit>(SensorDataDAO.java:78)
>
> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>
>
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
>
>
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>
> java.lang.reflect.Constructor.newInstance(Constructor.java:526)
>
> org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126)
>
>
> org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:74)
>
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:958)
>
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:911)
>
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
>
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
>
>
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
>
>
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
>
>
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
>
>
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
>
>
> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
>
>
> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
>
>
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
>
>
> org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
>
>
> org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
>
>
> org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
>
>
> org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4779)
>
>
> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5273)
>
> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
>
>
> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:895)
>
> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:871)
>
> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
>
> org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:958)
>
> org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1599)
>
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
>
> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
>                 java.util.concurrent.FutureTask.run(FutureTask.java:166)
>
>
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>
>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>                 java.lang.Thread.run(Thread.java:724)
>                 com.amazon.dao.MyDAO  <clinit>
>
>
> Code which tries to establish connection is as follows:
>
> public class MyDAO {
>
>   protected static HConnection connection;
>
>
>   static {
>       Configuration conf = HBaseConfiguration.create();
>       conf.addResource("hbase-site.xml");
>       connection = HConnectionManager.createConnection(conf);
>       // connection object is still null at this point
>     try {
>     } catch (Exception ex) {
>       ex.printStackTrace();
>     }
>   }
> }
>
>
> Regards,
> Chandrash3khar Kotekar
> Mobile - +91 8600011455
>