无法使用HBase REST api

时间:2015-05-08 19:26:21

标签: python hbase google-cloud-bigtable

关注this example,运行测试脚本" python put_get_with_client.py"导致400错误(错误请求)。

  

错误的请求   java.lang.ClassCastException:org.apache.hadoop.hbase.client.BigtableConnection无法强制转换为org.apache.hadoop.hbase.client.ClusterConnection       在org.apache.hadoop.hbase.client.ConnectionManager.createConnection(ConnectionManager.java:410)       在org.apache.hadoop.hbase.client.ConnectionManager.createConnection(ConnectionManager.java:370)       在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)       在org.apache.hadoop.hbase.rest.RESTServlet.getAdmin(RESTServlet.java:102)       at org.apache.hadoop.hbase.rest.RootResource.getTableList(RootResource.java:64)       在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.Abs​​tractResourceMethodDispatchProvider $ 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)       在com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)       在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)       在com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)       在com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)       在com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)       在javax.servlet.http.HttpServlet.service(HttpServlet.java:820)       在org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)       在org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1221)       在org.apache.hadoop.hbase.rest.filter.GzipFilter.doFilter(GzipFilter.java:76)       在org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1212)       在org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)       在org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)       在org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)       在org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)       在org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)       在org.mortbay.jetty.Server.handle(Server.java:326)       在org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)       at org.mortbay.jetty.HttpConnection $ RequestHandler.headerComplete(HttpConnection.java:928)       在org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)       在org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)       在org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)       在org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)       在org.mortbay.thread.QueuedThreadPool $ PoolThread.run(QueuedThreadPool.java:582)

所以,我猜BigtableConnection没有实现ClusterConnection接口?这个例子是正确的吗?

1 个答案:

答案 0 :(得分:2)

正如上面的评论中所提到的,我们已经向Apache HBase项目提交了补丁以修复ReST和Thrift - 它们也被接受并集成。当我们等待发布时,我们已经发布了temporary fork of 1.0.1来帮助您解决这个问题。一旦这些更改合并,我们将删除此分支。