Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
HBase, mail # user - connecting Hbase using java


+
Alok Singh Mahor 2013-03-30, 14:02
+
Ted Yu 2013-03-30, 14:49
+
Mohammad Tariq 2013-03-30, 15:25
+
Stephen Boesch 2013-03-30, 15:29
+
Alok Singh Mahor 2013-03-31, 03:00
+
Ted Yu 2013-03-31, 03:39
+
Alok Singh Mahor 2013-03-31, 10:48
+
Ted Yu 2013-03-31, 14:37
+
Alok Singh Mahor 2013-03-31, 16:46
+
Ted Yu 2013-03-31, 19:04
+
Alok Singh Mahor 2013-03-31, 20:51
+
Alok Singh Mahor 2013-04-03, 16:37
+
Andrea Gazzarini 2013-04-03, 16:59
+
Harsha 2013-04-03, 21:20
+
Alok Singh Mahor 2013-04-03, 23:03
+
Jean-Marc Spaggiari 2013-04-04, 00:24
+
Alok Singh Mahor 2013-04-04, 09:04
+
Jean-Marc Spaggiari 2013-04-04, 12:06
+
Alok Singh Mahor 2013-04-04, 13:13
+
Jean-Marc Spaggiari 2013-04-04, 13:38
+
Alok Singh Mahor 2013-04-04, 14:37
Copy link to this message
-
Re: connecting Hbase using java
Jean-Marc Spaggiari 2013-04-04, 14:41
Alok,

I definitively recommand you to use an IDE to test your code. That
will help you a lot.

Again, here, you are simply missing the classpath for you "java" command.

JM

2013/4/4 Alok Singh Mahor <[EMAIL PROTECTED]>:
> wow I am not getting any error now while compiling using (javac -classpath
> `~/packages/hbase-0.94.6/bin/hbase classpath` MyLittleHBaseClient.java)
>
> but this time I am getting runtime error
>
> alok@alok:~/exp/hbase/exp$ javac -classpath
> `~/packages/hbase-0.94.6/bin/hbase classpath` MyLittleHBaseClient.java
> alok@alok:~/exp/hbase/exp$ java MyLittleHBaseClient
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/apache/hadoop/hbase/HBaseConfiguration
>         at MyLittleHBaseClient.main(MyLittleHBaseClient.java:15)
> Caused by: java.lang.ClassNotFoundException:
> org.apache.hadoop.hbase.HBaseConfiguration
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
>         ... 1 more
> alok@alok:~/exp/hbase/exp$
>
> you can see the code I am compiling at http://paste.ubuntu.com/5676812/
>
> hadoop and hbase are running and I before running I had create table in
> Hbase shell
>
> hbase(main):001:0> create 'myTable', 'myColumnFamily'
> 0 row(s) in 2.3800 seconds
>
> hbase(main):002:0> scan 'myTable'
> ROW
> COLUMN+CELL
>
> 0 row(s) in 0.1020 seconds
>
>
>
>
> On Thu, Apr 4, 2013 at 7:08 PM, Jean-Marc Spaggiari <[EMAIL PROTECTED]
>> wrote:
>
>> org.apache.hadoop.conf.Configuration is missing from the imports...
>>
>> 2013/4/4 Alok Singh Mahor <[EMAIL PROTECTED]>:
>> > thanks again JM :)
>> > you gave very important clue.
>> >
>> > now am trying example code in
>> >
>> http://hbase.apache.org/0.94/apidocs/org/apache/hadoop/hbase/client/package-summary.html#package_description
>> >
>> > using the command
>> > alok@alok:~/exp/hbase/exp$ javac -classpath
>> > `~/packages/hbase-0.94.6/bin/hbase classpath` MyLittleHBaseClient.java
>> >
>> > I am getting only one error this time. that I could not figure out. so I
>> > still need help. please look on he error
>> >
>> > <error>
>> > alok@alok:~/exp/hbase/exp$ javac -classpath
>> > `~/packages/hbase-0.94.6/bin/hbase classpath` MyLittleHBaseClient.java
>> > MyLittleHBaseClient.java:21: error: cannot find symbol
>> >     Configuration config = HBaseConfiguration.create();
>> >     ^
>> >   symbol:   class Configuration
>> >   location: class MyLittleHBaseClient
>> > 1 error
>> > </error>
>> >
>> >
>> >
>> > On Thu, Apr 4, 2013 at 5:36 PM, Jean-Marc Spaggiari <
>> [EMAIL PROTECTED]
>> >> wrote:
>> >
>> >> Ok.
>> >>
>> >> Classpath looks good.
>> >>
>> >> Few points:
>> >> - org.apache.hadoop.hbase.client.Scanner doesn't exist for 0.94.6.
>> >> - org.apache.hadoop.hbase.io.BatchUpdate doesn't exist for 0.94.6.
>> >> - org.apache.hadoop.hbase.io.Cell doesn't exist for 0.94.6.
>> >> - etc.
>> >>
>> >> http://hbase.apache.org/0.94/apidocs/index.html
>> >>
>> >> You might want to review you source code.
>> >>
>> >> JM
>> >>
>> >>
>> >> 2013/4/4 Alok Singh Mahor <[EMAIL PROTECTED]>:
>> >> > thanks Jean, output of ~/packages/hbase-0.94.6/bin/hbase classpath is
>> >> >
>> >> > alok@alok:~/exp/hbase/exp$ ~/packages/hbase-0.94.6/bin/hbase
>> classpath
>> >> >
>> >>
>> /home/alok/packages/hbase-0.94.6/bin/../conf:/usr/lib/jvm/default-java/lib/tools.jar:/home/alok/packages/hbase-0.94.6/bin/..:/home/alok/packages/hbase-0.94.6/bin/../hbase-0.94.6.jar:/home/alok/packages/hbase-0.94.6/bin/../hbase-0.94.6-tests.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/activation-1.1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/asm-3.1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/avro-1.5.3.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/avro-ipc-1.5.3.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/commons-beanutils-1.7.0.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/commons-beanutils-core-1.8.0.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/commons-cli-1.2.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/commons-codec-1.4.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/commons-collections-3.2.1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/commons-configuration-1.6.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/commons-digester-1.8.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/commons-el-1.0.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/commons-httpclient-3.1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/commons-io-2.1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/commons-lang-2.5.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/commons-logging-1.1.1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/commons-math-2.1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/commons-net-1.4.1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/core-3.1.1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/guava-11.0.2.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/hadoop-core-1.0.4.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/high-scale-lib-1.1.1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/httpclient-4.1.2.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/httpcore-4.1.3.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jackson-core-asl-1.8.8.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jackson-jaxrs-1.8.8.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jackson-mapper-asl-1.8.8.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jackson-xc-1.8.8.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jamon-runtime-2.3.1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jasper-compiler-5.5.23.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jasper-runtime-5.5.23.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jax
+
Alok Singh Mahor 2013-04-04, 14:50
+
Jean-Marc Spaggiari 2013-04-04, 15:13
+
Alok Singh Mahor 2013-04-05, 03:38
+
Jean-Marc Spaggiari 2013-04-05, 11:47