hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Thomsen <mikerthom...@gmail.com>
Subject NullPointerException thrown in the client driver when trying to scan
Date Wed, 06 Sep 2017 18:30:23 GMT
I wrote a simple Groovy script to test the connection:

@Grab(group='org.apache.hbase', module='hbase-client', version='1.1.5')
@Grab(group='org.hamcrest', module='hamcrest-core', version='1.2')
@Grab(group='org.apache.hbase', module='hbase-common', version='1.1.5')
@Grab(group='org.apache.hadoop', module='hadoop-common', version='2.7.2')
@Grab(group='org.apache.curator', module='curator-client',
version='3.2.0')
@Grab(group='org.apache.curator', module='curator-framework',
version='3.2.0')
@Grab(group='org.apache.curator', module='curator-recipes',
version='3.2.0')
@Grab(group='org.mortbay.jetty', module='jetty', version='6.1.26')
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.Result;
import org.apache.hadoop.hbase.client.ResultScanner;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.client.Admin
import org.apache.hadoop.hbase.client.Connection
import org.apache.hadoop.hbase.client.ConnectionFactory
import org.apache.hadoop.hbase.HTableDescriptor
import org.apache.hadoop.hbase.HColumnDescriptor
import org.apache.hadoop.hbase.TableName
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.hbase.security.visibility.Authorizations

def log = { msg ->
    println "${Calendar.instance.time}\t$msg"
}
Configuration conf = HBaseConfiguration.create();
log "Created configuration"
conf.addResource('/vagrant/workspace/hbase-config/hbase-site.xml')
Connection conn = ConnectionFactory.createConnection(conf);
log "Got conn"
Admin admin = conn.getAdmin();
log "Got admin"
def table = conn.getTable(TableName.valueOf('test_table'))
log "Got table"
assert table
def scan = new Scan()
scan.setAuthorizations(new Authorizations(["public", "private]))
try {
    def scanner = table.getScanner(scan)
    def fam = 'prop'.bytes
    def qual = 'msg'.bytes
    log "Got scanner, scanning..."
    scanner.each { result ->
        println new String(result.row)
        // println "\t" + new String(result.getValue(fam, qual))
    }
} catch (Exception ex) {
    ex.printStackTrace()
}

When I run it, this is the output:

Wed Sep 06 14:01:25 EDT 2017    Got conn
Wed Sep 06 14:01:25 EDT 2017    Got admin
Wed Sep 06 14:01:25 EDT 2017    Got table
java.lang.RuntimeException: java.lang.RuntimeException:
java.lang.NullPointerException
    at
org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithoutRetries(RpcRetryingCaller.java:218)
    at
org.apache.hadoop.hbase.client.ClientScanner.call(ClientScanner.java:326)
    at
org.apache.hadoop.hbase.client.ClientScanner.nextScanner(ClientScanner.java:301)
    at
org.apache.hadoop.hbase.client.ClientScanner.initializeScannerInConstruction(ClientScanner.java:166)
    at
org.apache.hadoop.hbase.client.ClientScanner.<init>(ClientScanner.java:161)
    at org.apache.hadoop.hbase.client.HTable.getScanner(HTable.java:797)
    at org.apache.hadoop.hbase.client.Table$getScanner.call(Unknown Source)
    at
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
    at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
    at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
    at hbase_test.run(hbase_test.groovy:41)
    at
groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:263)
    at groovy.lang.GroovyShell.run(GroovyShell.java:518)
    at groovy.lang.GroovyShell.run(GroovyShell.java:507)
    at groovy.ui.GroovyMain.processOnce(GroovyMain.java:653)
    at groovy.ui.GroovyMain.run(GroovyMain.java:384)
    at groovy.ui.GroovyMain.process(GroovyMain.java:370)
    at groovy.ui.GroovyMain.processArgs(GroovyMain.java:129)
    at groovy.ui.GroovyMain.main(GroovyMain.java:109)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at
org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:109)
    at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:131)
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
    at
org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithoutRetries(RpcRetryingCaller.java:218)
    at
org.apache.hadoop.hbase.client.ClientSmallReversedScanner.loadCache(ClientSmallReversedScanner.java:211)
    at
org.apache.hadoop.hbase.client.ClientSmallReversedScanner.next(ClientSmallReversedScanner.java:185)
    at
org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateRegionInMeta(ConnectionManager.java:1250)
    at
org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateRegion(ConnectionManager.java:1156)
    at
org.apache.hadoop.hbase.client.RpcRetryingCallerWithReadReplicas.getRegionLocations(RpcRetryingCallerWithReadReplicas.java:300)
    at
org.apache.hadoop.hbase.client.ScannerCallableWithReplicas.call(ScannerCallableWithReplicas.java:156)
    at
org.apache.hadoop.hbase.client.ScannerCallableWithReplicas.call(ScannerCallableWithReplicas.java:60)
    at
org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithoutRetries(RpcRetryingCaller.java:210)
    ... 24 more
Caused by: java.lang.NullPointerException
    at
org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.getMetaReplicaNodes(ZooKeeperWatcher.java:463)
    at
org.apache.hadoop.hbase.zookeeper.MetaTableLocator.blockUntilAvailable(MetaTableLocator.java:563)
    at
org.apache.hadoop.hbase.client.ZooKeeperRegistry.getMetaRegionLocation(ZooKeeperRegistry.java:61)
    at
org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateMeta(ConnectionManager.java:1186)
    at
org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateRegion(ConnectionManager.java:1153)
    at
org.apache.hadoop.hbase.client.RpcRetryingCallerWithReadReplicas.getRegionLocations(RpcRetryingCallerWithReadReplicas.java:300)
    at
org.apache.hadoop.hbase.client.ScannerCallableWithReplicas.call(ScannerCallableWithReplicas.java:156)
    at
org.apache.hadoop.hbase.client.ScannerCallableWithReplicas.call(ScannerCallableWithReplicas.java:60)
    at
org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithoutRetries(RpcRetryingCaller.java:210)

I am running this from the HortonWorks sandbox, and I am using the client
configuration that Ambari generated. I checked the Docker command, and I
did map ports 60000, 60010, 60020, 60030 and 2181 so I'm not sure why it
wouldn't be able to run a scanner.

Any ideas?

Thanks,

Mike

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message