Unable to connect to Google Bigtable using HBase REST api

2024/10/12 12:31:58

Following this example, running the test script "python put_get_with_client.py" results in a 400 error (Bad Request).

Bad requestjava.lang.ClassCastException: org.apache.hadoop.hbase.client.BigtableConnection cannot be cast to org.apache.hadoop.hbase.client.ClusterConnectionat org.apache.hadoop.hbase.client.ConnectionManager.createConnection(ConnectionManager.java:410)at org.apache.hadoop.hbase.client.ConnectionManager.createConnection(ConnectionManager.java:370)at org.apache.hadoop.hbase.client.HConnectionManager.createConnection(HConnectionManager.java:197)at org.apache.hadoop.hbase.util.ConnectionCache.getCurrentConnection(ConnectionCache.java:170)at org.apache.hadoop.hbase.util.ConnectionCache.getAdmin(ConnectionCache.java:124)at org.apache.hadoop.hbase.rest.RESTServlet.getAdmin(RESTServlet.java:102)at org.apache.hadoop.hbase.rest.RootResource.getTableList(RootResource.java:64)at org.apache.hadoop.hbase.rest.RootResource.get(RootResource.java:80)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:606)at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1221)at org.apache.hadoop.hbase.rest.filter.GzipFilter.doFilter(GzipFilter.java:76)at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)at org.mortbay.jetty.Server.handle(Server.java:326)at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:928)at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

So, I guess BigtableConnection does not implement the ClusterConnection interface? Is the example correct?

Answer

As mentioned in the comments above, we have submitted patches to the Apache HBase project to fix ReST and Thrift -- they've also been accepted and integrated. While we wait for a release which incorporates them to be release, we've released a temporary fork of 1.0.1 to help you work with this. We will be removing this fork as soon as these changes are incorporated.

https://en.xdnf.cn/q/118199.html

Related Q&A

HTML form button to run PHP to execute Python script

I am building an HTML document that is meant to run locally. On it is a button that I would like to have run a Python script when clicked. Im trying to use a PHP-generated button. Theres no input or ou…

Python - finding time slots

I am writing a small Python script to find time available slots based off calendar appointments. I was able to reuse the code on the post here: (Python - Algorithm find time slots).It does seem to wor…

ReportLab - error when creating a table

This is the first time Ive used ReportLab, I have tried to edit an existing script that does exactly what I want to do, but I get the following error, when I try and run the script.Script - import os, …

Secure login with Python credentials from user database

I like to create a secure login with Python but need to check the user table from a database, so that multiple users can log in with their own password. Mainly like this, works like a charm but not sec…

count number of names in list in python [duplicate]

This question already has answers here:How to count the frequency of the elements in an unordered list? [duplicate](33 answers)Closed 6 years ago.i have one list wich has names in it:names = [test,hal…

tensorflow logits and labels must be same size

Im quite new to tensorflow and python, and currently trying to modify the MNIST for expert tutorial for a 240x320x3 image. I have 2 .py scripttfrecord_reeader.pyimport tensorflow as tf import numpy as…

How to call an action when a button is clicked in Tkinter

I am experimenting with Tkinter for the first time, and am trying to call a function when a button is clicked. This is part of my code. mt is referring to a label that I have made dynamic by attachin…

Access range of elements from an array Python

Considering the following dataset:>>> data[:10] array([(T, 2, 8, 3, 5, 1, 8, 13, 0, 6, 6, 10, 8, 0, 8, 0, 8),(I, 5, 12, 3, 7, 2, 10, 5, 5, 4, 13, 3, 9, 2, 8, 4, 10),(D, 4, 11, …

Python - Remove extended ascii

Okay, so I am new to the whole python world so bear with me. Background: We are trying to offload logs into mongo to be able to query and search for them quicker. The device already prints them in a de…

Selenium - Python - Select dropdown meun option - No ID or Name

I am trying to select and element in a dropdown menu:The HTML is:<div class="col-lg-6"><select data-bind="options: indicator_type_list,value: indicatorType,optionsCaption: Choos…