You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Liu Xianglong <sa...@hotmail.com> on 2009/10/20 17:05:18 UTC

java api error: connection to HMaster

My java code to create a Hbase table encounters errors, but the shell works well, through it I can create and read tables.

code:
HBaseConfiguration conf = new HBaseConfiguration(); 
HBaseAdmin admin = new HBaseAdmin(conf);


error information as follows
09/10/20 11:24:26 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:60000. Already tried 0 time(s).
09/10/20 11:24:27 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:60000. Already tried 1 time(s).
09/10/20 11:24:28 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:60000. Already tried 2 time(s).
09/10/20 11:24:29 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:60000. Already tried 3 time(s).
09/10/20 11:24:30 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:60000. Already tried 4 time(s).
09/10/20 11:24:31 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:60000. Already tried 5 time(s).
09/10/20 11:24:32 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:60000. Already tried 6 time(s).
09/10/20 11:24:33 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:60000. Already tried 7 time(s).
09/10/20 11:24:34 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:60000. Already tried 8 time(s).
09/10/20 11:24:35 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:60000. Already tried 9 time(s).
09/10/20 11:24:35 INFO client.HConnectionManager$TableServers: Attempt 0 of 10 failed with <java.net.ConnectException: Call to localhost/127.0.0.1:60000 failed on connection exception: java.net.ConnectException: Connection refused>. Retrying after sleep of 2000
Exception in thread "main" java.lang.IllegalAccessError: tried to access method org.apache.hadoop.ipc.Client.incCount()V from class org.apache.hadoop.ipc.HBaseClient
        at org.apache.hadoop.ipc.HBaseClient.incCount(HBaseClient.java:48)
        at org.apache.hadoop.hbase.ipc.HbaseRPC$ClientCache.getClient(HbaseRPC.java:187)
        at org.apache.hadoop.hbase.ipc.HbaseRPC$ClientCache.access$200(HbaseRPC.java:164)
        at org.apache.hadoop.hbase.ipc.HbaseRPC$Invoker.<init>(HbaseRPC.java:238)
        at org.apache.hadoop.hbase.ipc.HbaseRPC.getProxy(HbaseRPC.java:384)
        at org.apache.hadoop.hbase.ipc.HbaseRPC.getProxy(HbaseRPC.java:364)
        at org.apache.hadoop.hbase.ipc.HbaseRPC.getProxy(HbaseRPC.java:412)
        at org.apache.hadoop.hbase.client.HConnectionManager$TableServers.getMaster(HConnectionManager.java:188)
        at org.apache.hadoop.hbase.client.HBaseAdmin.<init>(HBaseAdmin.java:67)
        at Test.createTable(Test.java:24)
        at Test.main(Test.java:103)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:156)

I am confused why it connect localhost:60000, may my hbase configuration be right? Would someone can help me solve this problem? Thanks!


Best Wishes!
_____________________________________________________________
 
刘祥龙  Liu Xianglong

Re: java api error: connection to HMaster

Posted by Jean-Daniel Cryans <jd...@apache.org>.
Make sure you have the same jar that the server is running, as you can
see the error is about an RPC mismatch.

> I am confused why it connect localhost:60000, may my hbase configuration be right?

By default that's how it works, master listens on localhost on port 60000.

J-D

2009/10/20 Liu Xianglong <sa...@hotmail.com>:
> My java code to create a Hbase table encounters errors, but the shell works well, through it I can create and read tables.
>
> code:
> HBaseConfiguration conf = new HBaseConfiguration();
> HBaseAdmin admin = new HBaseAdmin(conf);
>
>
> error information as follows
> 09/10/20 11:24:26 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:60000. Already tried 0 time(s).
> 09/10/20 11:24:27 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:60000. Already tried 1 time(s).
> 09/10/20 11:24:28 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:60000. Already tried 2 time(s).
> 09/10/20 11:24:29 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:60000. Already tried 3 time(s).
> 09/10/20 11:24:30 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:60000. Already tried 4 time(s).
> 09/10/20 11:24:31 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:60000. Already tried 5 time(s).
> 09/10/20 11:24:32 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:60000. Already tried 6 time(s).
> 09/10/20 11:24:33 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:60000. Already tried 7 time(s).
> 09/10/20 11:24:34 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:60000. Already tried 8 time(s).
> 09/10/20 11:24:35 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:60000. Already tried 9 time(s).
> 09/10/20 11:24:35 INFO client.HConnectionManager$TableServers: Attempt 0 of 10 failed with <java.net.ConnectException: Call to localhost/127.0.0.1:60000 failed on connection exception: java.net.ConnectException: Connection refused>. Retrying after sleep of 2000
> Exception in thread "main" java.lang.IllegalAccessError: tried to access method org.apache.hadoop.ipc.Client.incCount()V from class org.apache.hadoop.ipc.HBaseClient
>        at org.apache.hadoop.ipc.HBaseClient.incCount(HBaseClient.java:48)
>        at org.apache.hadoop.hbase.ipc.HbaseRPC$ClientCache.getClient(HbaseRPC.java:187)
>        at org.apache.hadoop.hbase.ipc.HbaseRPC$ClientCache.access$200(HbaseRPC.java:164)
>        at org.apache.hadoop.hbase.ipc.HbaseRPC$Invoker.<init>(HbaseRPC.java:238)
>        at org.apache.hadoop.hbase.ipc.HbaseRPC.getProxy(HbaseRPC.java:384)
>        at org.apache.hadoop.hbase.ipc.HbaseRPC.getProxy(HbaseRPC.java:364)
>        at org.apache.hadoop.hbase.ipc.HbaseRPC.getProxy(HbaseRPC.java:412)
>        at org.apache.hadoop.hbase.client.HConnectionManager$TableServers.getMaster(HConnectionManager.java:188)
>        at org.apache.hadoop.hbase.client.HBaseAdmin.<init>(HBaseAdmin.java:67)
>        at Test.createTable(Test.java:24)
>        at Test.main(Test.java:103)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at org.apache.hadoop.util.RunJar.main(RunJar.java:156)
>
> I am confused why it connect localhost:60000, may my hbase configuration be right? Would someone can help me solve this problem? Thanks!
>
>
> Best Wishes!
> _____________________________________________________________
>
> 刘祥龙  Liu Xianglong
>

Re: java api error: connection to HMaster

Posted by Tatsuya Kawano <ta...@modolab.info>.
Hi Liu,

Did you try the stuff that Stack suggested in another thread? What was
the result? You'd better to try that, otherwise nobody will be able to
solve your problem. (We can't figure out the cause of the problem by
just looking at the client log you provided. We need more information
from you.)  So please try that.

Also, can you tell us about your environment?

1. HBase version?

2. Distribution mode -- Standalone?  Pseudo Distribution?  Full Distribution?

3. Where are you trying to run your Java program? From the same
machine that HBase master is running on? or from a different machine?

4. What's in your configuration file (hbase-site.xml)?

5. So you can't run HBaseAdmin to create tables. How about regular
operations like inserting record to the database (HTable#put() )? Is
it working?

6. Why do you think it's wrong to connect to localhost:60000? Do you
think "localhost" part is wrong? or do you think "60000" part is
wrong?

> I am confused why it connect localhost:60000, may my hbase configuration be right? Would someone can help me solve this problem? Thanks!


Thank you,

-- 
Tatsuya Kawano (Mr.)
Tokyo, Japan




2009/10/21 Liu Xianglong <sa...@hotmail.com>:
> My java code to create a Hbase table encounters errors, but the shell works well, through it I can create and read tables.
>
> code:
> HBaseConfiguration conf = new HBaseConfiguration();
> HBaseAdmin admin = new HBaseAdmin(conf);
>
>
> error information as follows
> 09/10/20 11:24:26 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:60000. Already tried 0 time(s).
> 09/10/20 11:24:27 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:60000. Already tried 1 time(s).
> 09/10/20 11:24:28 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:60000. Already tried 2 time(s).
> 09/10/20 11:24:29 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:60000. Already tried 3 time(s).
> 09/10/20 11:24:30 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:60000. Already tried 4 time(s).
> 09/10/20 11:24:31 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:60000. Already tried 5 time(s).
> 09/10/20 11:24:32 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:60000. Already tried 6 time(s).
> 09/10/20 11:24:33 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:60000. Already tried 7 time(s).
> 09/10/20 11:24:34 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:60000. Already tried 8 time(s).
> 09/10/20 11:24:35 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:60000. Already tried 9 time(s).
> 09/10/20 11:24:35 INFO client.HConnectionManager$TableServers: Attempt 0 of 10 failed with <java.net.ConnectException: Call to localhost/127.0.0.1:60000 failed on connection exception: java.net.ConnectException: Connection refused>. Retrying after sleep of 2000
> Exception in thread "main" java.lang.IllegalAccessError: tried to access method org.apache.hadoop.ipc.Client.incCount()V from class org.apache.hadoop.ipc.HBaseClient
>        at org.apache.hadoop.ipc.HBaseClient.incCount(HBaseClient.java:48)
>        at org.apache.hadoop.hbase.ipc.HbaseRPC$ClientCache.getClient(HbaseRPC.java:187)
>        at org.apache.hadoop.hbase.ipc.HbaseRPC$ClientCache.access$200(HbaseRPC.java:164)
>        at org.apache.hadoop.hbase.ipc.HbaseRPC$Invoker.<init>(HbaseRPC.java:238)
>        at org.apache.hadoop.hbase.ipc.HbaseRPC.getProxy(HbaseRPC.java:384)
>        at org.apache.hadoop.hbase.ipc.HbaseRPC.getProxy(HbaseRPC.java:364)
>        at org.apache.hadoop.hbase.ipc.HbaseRPC.getProxy(HbaseRPC.java:412)
>        at org.apache.hadoop.hbase.client.HConnectionManager$TableServers.getMaster(HConnectionManager.java:188)
>        at org.apache.hadoop.hbase.client.HBaseAdmin.<init>(HBaseAdmin.java:67)
>        at Test.createTable(Test.java:24)
>        at Test.main(Test.java:103)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at org.apache.hadoop.util.RunJar.main(RunJar.java:156)
>
> I am confused why it connect localhost:60000, may my hbase configuration be right? Would someone can help me solve this problem? Thanks!
>
>
> Best Wishes!
> _____________________________________________________________
>
> 刘祥龙  Liu Xianglong
>

Re: java api error: connection to HMaster

Posted by Doss_IPH <do...@intellipowerhive.com>.
Hi all,
 The below code will explain to connect hbase server using hbase api. you
have to add library both hadoop-0.19.0 and hbase-0.19.3 in you classpath. 

I have created small sample UI application using HBase. I have given source
also you can refer it. 

For more details access URL:
http://intellipowerhive.com/products.php

/**
 * @author Arockia Doss S
 * @email doss@intellipowerhive.com
 * @url http://www.intellipowerhive.com,http://www.dossinfotech.com
 * @comments You can use and modify this page for your usage.
 */

package com.iph.hbase.conf;

import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.HBaseConfiguration;

public class IPHConfiguration  implements java.io.Serializable {
    
    //IP and Home Directory has to be modified according to your environment
    private static final String hbaseMasterValue = "172.21.1.53";
    private static final String hbaseHomeDirectory = "/home/hbase-0.19.3/";
            
    //It is not modified code.
    private static final int hbaseMasterPort = 60000;
    private static final String hbaseMasterName = "hbase.master";
    private static final String hbaseSite =
hbaseHomeDirectory+"conf/hbase-site.xml";
    private static final String hbaseDefault =
hbaseHomeDirectory+"conf/hbase-default.xml";
    
    public static HBaseConfiguration getConf() {
        HBaseConfiguration conf = new HBaseConfiguration();
        conf.set(hbaseMasterName, hbaseMasterValue + ":" + hbaseMasterPort);
        Path hbaseSitePath = new Path(hbaseSite);
        Path hbaseDefaultPath = new Path(hbaseDefault);
        conf.addResource(hbaseSitePath);
        conf.addResource(hbaseDefaultPath);
        return conf;
    }
}
-- 
View this message in context: http://www.nabble.com/java-api-error%3A-connection-to-HMaster-tp25976824p25986326.html
Sent from the HBase User mailing list archive at Nabble.com.


RE: Sample application on HBase

Posted by Doss_IPH <do...@intellipowerhive.com>.
I will update to  hbase.0.20.x. as soon as possible.

This is my own interesting to develop applications using this platform. But,
I need support for this to further developing more.

No license for this.. 


Patterson, Josh wrote:
> 
> This seems to be like a web based "enterprise manager" for hbase. I've
> played with the "out of the box" web console for hbase 0.20 and this is
> a nice compliment to actually play with columns and rows. This might be
> something, or at least the inspiration for something, to add into a
> stock hbase install so you could peak at data, take a look around in the
> data, etc (if something like this isn't already in there that I didn't
> see...)
> 
> Josh Patterson
> TVA
> http://jpatterson.floe.tv
> 
> -----Original Message-----
> From: saint.ack@gmail.com [mailto:saint.ack@gmail.com] On Behalf Of
> stack
> Sent: Wednesday, October 21, 2009 1:34 PM
> To: hbase-user@hadoop.apache.org
> Subject: Re: Sample application on HBase
> 
> This looks interesting.   Can you update it to run against 0.20.x?  It
> does
> not have a license.  You might want to add one.
> Thanks,
> St.Ack
> 
> On Tue, Oct 20, 2009 at 9:29 PM, Doss_IPH <do...@intellipowerhive.com>
> wrote:
> 
>>
>> Hi friends
>> I have developed sample small application using Hbase which can be run
> in
>> application server using IDE(Netbeans or eclipse). for more details
> you can
>> download source this site.
>> http://intellipowerhive.com/products.php  Download
>> --
>> View this message in context:
>>
> http://www.nabble.com/java-api-error%3A-connection-to-HMaster-tp25976824
> p25986376.html
>> Sent from the HBase User mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/java-api-error%3A-connection-to-HMaster-tp25976824p26004000.html
Sent from the HBase User mailing list archive at Nabble.com.


RE: Sample application on HBase

Posted by Doss_IPH <do...@intellipowerhive.com>.
I will update to  hbase.0.20.x. as soon as possible.

This is my own interesting to develop applications using this platform. But,
I need support for this to further developing more.

No license for this.. 


Patterson, Josh wrote:
> 
> This seems to be like a web based "enterprise manager" for hbase. I've
> played with the "out of the box" web console for hbase 0.20 and this is
> a nice compliment to actually play with columns and rows. This might be
> something, or at least the inspiration for something, to add into a
> stock hbase install so you could peak at data, take a look around in the
> data, etc (if something like this isn't already in there that I didn't
> see...)
> 
> Josh Patterson
> TVA
> http://jpatterson.floe.tv
> 
> -----Original Message-----
> From: saint.ack@gmail.com [mailto:saint.ack@gmail.com] On Behalf Of
> stack
> Sent: Wednesday, October 21, 2009 1:34 PM
> To: hbase-user@hadoop.apache.org
> Subject: Re: Sample application on HBase
> 
> This looks interesting.   Can you update it to run against 0.20.x?  It
> does
> not have a license.  You might want to add one.
> Thanks,
> St.Ack
> 
> On Tue, Oct 20, 2009 at 9:29 PM, Doss_IPH <do...@intellipowerhive.com>
> wrote:
> 
>>
>> Hi friends
>> I have developed sample small application using Hbase which can be run
> in
>> application server using IDE(Netbeans or eclipse). for more details
> you can
>> download source this site.
>> http://intellipowerhive.com/products.php  Download
>> --
>> View this message in context:
>>
> http://www.nabble.com/java-api-error%3A-connection-to-HMaster-tp25976824
> p25986376.html
>> Sent from the HBase User mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/java-api-error%3A-connection-to-HMaster-tp25976824p26003971.html
Sent from the HBase User mailing list archive at Nabble.com.


RE: Sample application on HBase

Posted by "Patterson, Josh" <jp...@tva.gov>.
This seems to be like a web based "enterprise manager" for hbase. I've
played with the "out of the box" web console for hbase 0.20 and this is
a nice compliment to actually play with columns and rows. This might be
something, or at least the inspiration for something, to add into a
stock hbase install so you could peak at data, take a look around in the
data, etc (if something like this isn't already in there that I didn't
see...)

Josh Patterson
TVA
http://jpatterson.floe.tv

-----Original Message-----
From: saint.ack@gmail.com [mailto:saint.ack@gmail.com] On Behalf Of
stack
Sent: Wednesday, October 21, 2009 1:34 PM
To: hbase-user@hadoop.apache.org
Subject: Re: Sample application on HBase

This looks interesting.   Can you update it to run against 0.20.x?  It
does
not have a license.  You might want to add one.
Thanks,
St.Ack

On Tue, Oct 20, 2009 at 9:29 PM, Doss_IPH <do...@intellipowerhive.com>
wrote:

>
> Hi friends
> I have developed sample small application using Hbase which can be run
in
> application server using IDE(Netbeans or eclipse). for more details
you can
> download source this site.
> http://intellipowerhive.com/products.php  Download
> --
> View this message in context:
>
http://www.nabble.com/java-api-error%3A-connection-to-HMaster-tp25976824
p25986376.html
> Sent from the HBase User mailing list archive at Nabble.com.
>
>

Re: Sample application on HBase

Posted by stack <st...@duboce.net>.
This looks interesting.   Can you update it to run against 0.20.x?  It does
not have a license.  You might want to add one.
Thanks,
St.Ack

On Tue, Oct 20, 2009 at 9:29 PM, Doss_IPH <do...@intellipowerhive.com> wrote:

>
> Hi friends
> I have developed sample small application using Hbase which can be run in
> application server using IDE(Netbeans or eclipse). for more details you can
> download source this site.
> http://intellipowerhive.com/products.php  Download
> --
> View this message in context:
> http://www.nabble.com/java-api-error%3A-connection-to-HMaster-tp25976824p25986376.html
> Sent from the HBase User mailing list archive at Nabble.com.
>
>

Sample application on HBase

Posted by Doss_IPH <do...@intellipowerhive.com>.
Hi friends
I have developed sample small application using Hbase which can be run in
application server using IDE(Netbeans or eclipse). for more details you can
download source this site.
http://intellipowerhive.com/products.php  Download 
-- 
View this message in context: http://www.nabble.com/java-api-error%3A-connection-to-HMaster-tp25976824p25986376.html
Sent from the HBase User mailing list archive at Nabble.com.