Hbase API stuck in table.get (row),

I am writing an Hbase Java client using my own hbase APIs.

I could connect to hbase and run various requests using the Hbase client I created. I started the hbase client using the "hbase classpath" command. Which resolves all the dependencies.

Now we want this hbase client to be part of a project that has it as one of its components. Therefore, integrating it, we must run it as part of the war file of the project (we need to run it as part of the recreation API). I added hbase-site.xml. hdfs-site.xml and core-site.xml as a resource and set as a resource for the configuration object.

Configuration conf = HBaseConfiguration.create() URL hbaseUrl=HbaseManagerServiceImpl.class.getClassLoader().getResource("hbase-site.xml"); conf.addResource(hbaseUrl.toString()); URL hdfsUrl=HbaseManagerServiceImpl.class.getClassLoader().getResource("hdfs-site.xml"); conf.addResource(hdfsUrl.toString()); URL coreUrl=HbaseManagerServiceImpl.class.getClassLoader().getResource("core-site.xml"); conf.addResource(coreUrl.toString()); 

when I tried to add only the core-site.xml I received an error saying "includes failed," which file was present on this host, so added that the file is also in a resource that is older than solve my problem.

 HTable table = new HTable(conf , "tableName"); 

I was able to successfully scan and get string operations and get the result.

 Scan scanTable = new Scan(); Get row = new Get(key); 

But when I try to do "Result rowData = table.get (row);"

My code is stuck and does not show any errors.

I can run the same code with the "hbase classpath" command. Do I also need to set the $ HADOOP_CLASSPATH and $ HBASE_CLASSPATH variables, I run my code through the berth web server.

The following is the error tracing:

 java.io.InterruptedIOException: Giving up trying to location region in meta: thread is interrupted. at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:1391) at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:1169) at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:1123) at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getRegionLocation(HConnectionManager.java:964) at org.apache.hadoop.hbase.client.RegionServerCallable.prepare(RegionServerCallable.java:72) at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithRetries(RpcRetryingCaller.java:113) at org.apache.hadoop.hbase.client.HTable.get(HTable.java:780) at com.connectApi.hbase_api.hbaseHelper.readTableData(hbaseHelper.java:148) at com.yahoo.oe.core.services.impl.HbaseManagerServiceImpl.test(HbaseManagerServiceImpl.java:169) at com.yahoo.oe.ws.impl.OEEndPointImpl.testHBase(OEEndPointImpl.java:175) 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:497) 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.RightHandPathRule.accept(RightHandPathRule.java:147) 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:790) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:322) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationProcessingFilter.doFilter(OAuth2AuthenticationProcessingFilter.java:131) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:184) at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:155) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at yjava.servlet.filter.YHdrsFilter.doFilter(YHdrsFilter.java:73) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at yjava.cookie.CookieDataFilter.doFilter(CookieDataFilter.java:133) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at yjava.servlet.filter.DoNotTrackFilter.doFilter(DoNotTrackFilter.java:114) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at yjava.remote.ip.RemoteIPFilter.doFilter(RemoteIPFilter.java:98) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at yjava.security.yiv.servlet.InputValidationFilter.doFilter(InputValidationFilter.java:234) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at org.eclipse.jetty.servlets.UserAgentFilter.doFilter(UserAgentFilter.java:83) at org.eclipse.jetty.servlets.GzipFilter.doFilter(GzipFilter.java:365) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215) at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) at org.eclipse.jetty.server.handler.StatisticsHandler.handle(StatisticsHandler.java:159) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) at org.eclipse.jetty.server.Server.handle(Server.java:499) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257) at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555) at java.lang.Thread.run(Thread.java:745) Exception !!!!java.io.InterruptedIOException: Giving up trying to location region in meta: thread is interrupted. java.lang.reflect.InvocationTargetException 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:497) at org.apache.commons.daemon.support.DaemonLoader.stop(DaemonLoader.java:200) Caused by: java.util.concurrent.TimeoutException at org.eclipse.jetty.util.FutureCallback.get(FutureCallback.java:128) at org.eclipse.jetty.util.FutureCallback.get(FutureCallback.java:30) at org.eclipse.jetty.server.Server.doStop(Server.java:426) at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89) at yjava.servlet.container.jetty.JettyDaemon.stop(JettyDaemon.java:47) ... 5 more 
+5
source share
2 answers

I can solve this problem now. hbase-site.xml and other * -site.xml were not correctly entered into the java code, so I had to make the following changes.

 URL hbaseSite=HbaseManagerServiceImpl.class.getClassLoader().getResource("hbase-site.xml"); InputStream inputHbase = new URL(hbaseSite.toString()).openStream(); conf.addResource(inputHbase); 

I checked if the correct XML file was entered. I tried to print the contents of the input files.

  String inputLine; while ((inputLine = in.readLine()) != null) System.out.println(inputLine); in.close(); 
+2
source

First you check the clientPort in the hbase-site.xml file:

 <property> <name>hbase.zookeeper.property.clientPort</name> <value>2222</value> </property> 

And in the java program: you must install clientPort in the same way as in the hbase-site.xml file:

 Configuration config = HBaseConfiguration.create(); config.set("hbase.zookeeper.property.clientPort", "2222"); 

0
source

All Articles