AnsweredAssumed Answered

Error while trying to connect to maprdb table

Question asked by SanjeevSukumaran on Jun 23, 2016
Latest reply on Sep 4, 2016 by snayeem

I wrote a java program:

 

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.client.Put;
import java.io.IOException;

public class M7Demo {

  public static void main(String[] args) throws IOException {
  Configuration conf = HBaseConfiguration.create();
  String tableName = "/env/user/ssukuma/poc/demo1";
    HTable table = new HTable(conf,tableName);
      
  Put p1 = new Put("student1".getBytes());

  byte[] account = "account".getBytes();
  byte[] address = "address".getBytes();

  p1.add(account,"name".getBytes(),"Alice".getBytes());
  p1.add(address,"street".getBytes(),"123 Ballmer Av".getBytes());
  p1.add(address,"zipcode".getBytes(),"12345".getBytes());
  p1.add(address,"state".getBytes(),"CA".getBytes());

  Put p2 = new Put("student2".getBytes());
  p2.add(account,"name".getBytes(),"Bob".getBytes());
  p2.add(address,"street".getBytes(),"1 Infinite Loop".getBytes());
  p2.add(address,"zipcode".getBytes(),"12345".getBytes());
  p2.add(address,"state".getBytes(),"CA".getBytes());

  table.put(p1);
  table.put(p2);
  table.close();
      
    }
  }

 

I have installed mapr client and have included all the dependencies. I am getting following error:

 

Exception in thread "main" java.io.IOException: java.lang.RuntimeException: Error occurred while instantiating com.mapr.fs.HTableImpl.
==> java.lang.UnsatisfiedLinkError: com.mapr.fs.jni.MapRClient.init(ILjava/lang/String;ZZILcom/mapr/fs/jni/MapRConstants$JniUsername;IIIII)I.
  at org.apache.hadoop.hbase.client.mapr.GenericHFactory.handleIOException(GenericHFactory.java:62)
  at org.apache.hadoop.hbase.client.HTable.initIfMapRTable(HTable.java:317)
  at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:155)
  at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:139)
  at M7Demo.main(M7Demo.java:16)
Caused by: java.lang.RuntimeException: Error occurred while instantiating com.mapr.fs.HTableImpl.
==> java.lang.UnsatisfiedLinkError: com.mapr.fs.jni.MapRClient.init(ILjava/lang/String;ZZILcom/mapr/fs/jni/MapRConstants$JniUsername;IIIII)I.
  at org.apache.hadoop.hbase.client.mapr.GenericHFactory.getImplementorInstance(GenericHFactory.java:40)
  at org.apache.hadoop.hbase.client.HTable.initIfMapRTable(HTable.java:312)
  ... 3 more
Caused by: java.lang.reflect.InvocationTargetException
  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
  at org.apache.hadoop.hbase.client.mapr.GenericHFactory.getImplementorInstance(GenericHFactory.java:37)
  ... 4 more
Caused by: java.lang.UnsatisfiedLinkError: com.mapr.fs.jni.MapRClient.init(ILjava/lang/String;ZZILcom/mapr/fs/jni/MapRConstants$JniUsername;IIIII)I
  at com.mapr.fs.jni.MapRClient.init(Native Method)
  at com.mapr.fs.MapRFileSystem.initConfig(MapRFileSystem.java:352)
  at com.mapr.fs.MapRFileSystem.initialize(MapRFileSystem.java:260)
  at com.mapr.fs.MapRHTable.init(MapRHTable.java:74)
  at com.mapr.fs.HTableImpl.<init>(HTableImpl.java:69)
  ... 9 more

 

I can access the same table via Hbase shell. Kindly help me with the same.

 

Thanks and Regards

Sanjeev Sukumaran

Outcomes