You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Alok Singh Mahor <al...@gmail.com> on 2013/04/03 18:37:14 UTC

Re: connecting Hbase using java

Hi all,
today I start afresh a Example code on
http://blog.rajeevsharma.in/2009/06/using-hbase-in-java-0193.html
but I guess luck is not with me.
I run
javac -classpath
~/packages/hbase-0.94.6/hbase-0.94.6.jar:~/packages/hbase-0.94.6/lib/*:~/packages/hadoop-1.1.2/*.jar:~/packages/hadoop-1.1.2/lib/*.jar
HBaseExample.java -verbose

please tell me what else I need to add in path to resolve these errors

thank you


alok@alok:~/exp/hbase/exp$ javac -classpath
~/packages/hbase-0.94.6/hbase-0.94.6.jar:~/packages/hbase-0.94.6/lib/*:~/packages/hadoop-1.1.2/*.jar:~/packages/hadoop-1.1.2/lib/*.jar
HBaseExample.java -verbose
[parsing started RegularFileObject[HBaseExample.java]]
[parsing completed 29ms]
[search path for source files:
/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar,~/packages/hbase-0.94.6/lib/*,~/packages/hadoop-1.1.2/*.jar,~/packages/hadoop-1.1.2/lib/*.jar]
[search path for class files:
/usr/lib/jvm/java-7-openjdk-i386/jre/lib/resources.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/rt.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/sunrsasign.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jsse.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jce.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/charsets.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/netx.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/plugin.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/rhino.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jfr.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/classes,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/zipfs.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/sunjce_provider.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/sunpkcs11.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/pulse-java.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/dnsns.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/java-atk-wrapper.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/localedata.jar,/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar,~/packages/hbase-0.94.6/lib/*,~/packages/hadoop-1.1.2/*.jar,~/packages/hadoop-1.1.2/lib/*.jar]
[loading
ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/IOException.class)]]
HBaseExample.java:2: error: package org.apache.hadoop.fs does not exist
import org.apache.hadoop.fs.Path;
                           ^
[loading
ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/HBaseConfiguration.class)]]
[loading
ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/client/HTable.class)]]
HBaseExample.java:5: error: cannot find symbol
import org.apache.hadoop.hbase.client.Scanner;
                                     ^
  symbol:   class Scanner
  location: package org.apache.hadoop.hbase.client
HBaseExample.java:6: error: cannot find symbol
import org.apache.hadoop.hbase.io.BatchUpdate;
                                 ^
  symbol:   class BatchUpdate
  location: package org.apache.hadoop.hbase.io
HBaseExample.java:7: error: cannot find symbol
import org.apache.hadoop.hbase.io.Cell;
                                 ^
  symbol:   class Cell
  location: package org.apache.hadoop.hbase.io
HBaseExample.java:8: error: cannot find symbol
import org.apache.hadoop.hbase.io.RowResult;
                                 ^
  symbol:   class RowResult
  location: package org.apache.hadoop.hbase.io
[loading
ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/util/Bytes.class)]]
[loading
ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Object.class)]]
[loading
ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/String.class)]]
[checking HBaseExample]
[loading
ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/AutoCloseable.class)]]
[loading
ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Exception.class)]]
[loading
ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Throwable.class)]]
HBaseExample.java:16: error: cannot find symbol
        conf.addResource(new Path("/opt/hbase-0.19.3/conf/hbase-site.xml"));
                             ^
  symbol:   class Path
  location: class HBaseExample
HBaseExample.java:16: error: cannot access Configuration
        conf.addResource(new Path("/opt/hbase-0.19.3/conf/hbase-site.xml"));
            ^
  class file for org.apache.hadoop.conf.Configuration not found
HBaseExample.java:20: error: cannot find symbol
        BatchUpdate batchUpdate = new BatchUpdate("test_row1");
        ^
  symbol:   class BatchUpdate
  location: class HBaseExample
HBaseExample.java:20: error: cannot find symbol
        BatchUpdate batchUpdate = new BatchUpdate("test_row1");
                                      ^
  symbol:   class BatchUpdate
  location: class HBaseExample
[loading
ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/math/BigDecimal.class)]]
[loading
ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/nio/ByteBuffer.class)]]
HBaseExample.java:25: error: cannot find symbol
        Cell cell = table.get("test_row1", "columnfamily1:column1");
        ^
  symbol:   class Cell
  location: class HBaseExample
[loading
ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/util/List.class)]]
HBaseExample.java:25: error: no suitable method found for get(String,String)
        Cell cell = table.get("test_row1", "columnfamily1:column1");
                         ^
    method HTable.get(List<Get>) is not applicable
      (actual and formal argument lists differ in length)
    method HTable.get(Get) is not applicable
      (actual and formal argument lists differ in length)
[loading
ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/System.class)]]
[loading
ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/PrintStream.class)]]
[loading
ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/FilterOutputStream.class)]]
[loading
ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/OutputStream.class)]]
HBaseExample.java:31: error: cannot find symbol
        RowResult singleRow = table.getRow(Bytes.toBytes("test_row1"));
        ^
  symbol:   class RowResult
  location: class HBaseExample
HBaseExample.java:31: error: cannot find symbol
        RowResult singleRow = table.getRow(Bytes.toBytes("test_row1"));
                                   ^
  symbol:   method getRow(byte[])
  location: variable table of type HTable
HBaseExample.java:32: error: cannot find symbol
        Cell cell = singleRow.get(Bytes.toBytes("columnfamily1:column1"));
        ^
  symbol:   class Cell
  location: class HBaseExample
HBaseExample.java:42: error: cannot find symbol
        Scanner scanner = table.getScanner(
        ^
  symbol:   class Scanner
  location: class HBaseExample
[loading
ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/client/Scan.class)]]
HBaseExample.java:42: error: no suitable method found for
getScanner(String[])
        Scanner scanner = table.getScanner(
                               ^
    method HTable.getScanner(byte[],byte[]) is not applicable
      (actual and formal argument lists differ in length)
    method HTable.getScanner(byte[]) is not applicable
      (actual argument String[] cannot be converted to byte[] by method
invocation conversion)
    method HTable.getScanner(Scan) is not applicable
      (actual argument String[] cannot be converted to Scan by method
invocation conversion)
HBaseExample.java:46: error: cannot find symbol
        RowResult rowResult = scanner.next();
        ^
  symbol:   class RowResult
  location: class HBaseExample
HBaseExample.java:55: error: cannot find symbol
        for (RowResult result : scanner) {
             ^
  symbol:   class RowResult
  location: class HBaseExample
[total 461ms]
Note: HBaseExample.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
18 errors

Re: connecting Hbase using java

Posted by Jean-Marc Spaggiari <je...@spaggiari.org>.
I guess your hostname is alok, right?

Add a line line:
192.168.1.1      alok

in your hosts file by replacing the IP with your local IP.

JM

2013/4/4 Alok Singh Mahor <al...@gmail.com>:
> sorry, actually I was copy pasting code and modifying. so I missed changing
> name of CF.
> still I am getting some error. I tried to get something from log on google
> but didnt get anything useful. I guess there is some configuration problem
> in my hbase-site.xml
>
> please look at the error at http://paste.ubuntu.com/5678610/
> what is the problem at line no. 23 ?
>
> content of /etc/hosts is
>
> 127.0.0.1       localhost
> #127.0.0.1      alok
> # The following lines are desirable for IPv6 capable hosts
> ::1     ip6-localhost ip6-loopback
> fe00::0 ip6-localnet
> ff00::0 ip6-mcastprefix
> ff02::1 ip6-allnodes
> ff02::2 ip6-allrouters
>
>
>
>
>
> On Thu, Apr 4, 2013 at 8:43 PM, Jean-Marc Spaggiari <jean-marc@spaggiari.org
>> wrote:
>
>> Alok,
>>
>> Can you take a deeper look in your code and your logs before asking
>> someone to solve that for you? ;)
>>
>> Your CF is called "myColumnFamily" and not "myLittleFamily".
>>
>> Also, I will recommand you to read some HBase related books where you
>> will learn that column familly names need to be as small as
>> possible... one byte is the best.
>>
>> JM
>>
>> 2013/4/4 Alok Singh Mahor <al...@gmail.com>:
>> > yes thank you so much jean, I will switch to eclipse.
>> >
>> > now I tried with (java -classpath `~/packages/hbase-0.94.6/bin/hbase
>> > classpath` MyLittleHBaseClient)
>> >
>> > code is running but I guess now I have some problem with my hbase and
>> hadoop
>> >
>> > I am getting output that you can see at http://paste.ubuntu.com/5676866/
>> > could you please figure out where things are wrong now?
>> > thanks again, your reply are helping me learning basic things.
>> >
>> >
>> >
>> > On Thu, Apr 4, 2013 at 8:11 PM, Jean-Marc Spaggiari <
>> jean-marc@spaggiari.org
>> >> wrote:
>> >
>> >> 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 <al...@gmail.com>:
>> >> > 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 <
>> >> jean-marc@spaggiari.org
>> >> >> wrote:
>> >> >
>> >> >> org.apache.hadoop.conf.Configuration is missing from the imports...
>> >> >>
>> >> >> 2013/4/4 Alok Singh Mahor <al...@gmail.com>:
>> >> >> > 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 <
>> >> >> jean-marc@spaggiari.org
>> >> >> >> 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 <al...@gmail.com>:
>> >> >> >> > 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/jaxb-api-2.1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jaxb-impl-2.2.3-1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jersey-core-1.8.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jersey-json-1.8.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jersey-server-1.8.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jettison-1.1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jetty-6.1.26.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jetty-util-6.1.26.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jruby-complete-1.6.5.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jsp-2.1-6.1.14.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jsp-api-2.1-6.1.14.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jsr305-1.3.9.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/junit-4.10-HBASE-1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/libthrift-0.8.0.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/log4j-1.2.16.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/metrics-core-2.1.2.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/netty-3.2.4.Final.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/protobuf-java-2.4.0a.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/servlet-api-2.5-6.1.14.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/slf4j-api-1.4.3.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/slf4j-log4j12-1.4.3.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/snappy-java-1.0.3.2.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/stax-api-1.0.1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/velocity-1.7.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/xmlenc-0.52.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/zookeeper-3.4.5.jar:
>> >> >> >> >
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > On Thu, Apr 4, 2013 at 5:54 AM, Jean-Marc Spaggiari <
>> >> >> >> jean-marc@spaggiari.org
>> >> >> >> >> wrote:
>> >> >> >> >
>> >> >> >> >> What's the output of ~/packages/hbase-0.94.6/bin/hbase
>> classpath?
>> >> >> >> >>
>> >> >> >> >> 2013/4/3 Alok Singh Mahor <al...@gmail.com>:
>> >> >> >> >> > thank you Harsha
>> >> >> >> >> > with your advice I used command to compile that example code
>> >> >> >> >> > alok@alok:~/exp/hbase/exp$ javac -classpath
>> >> >> >> >> > `~/packages/hbase-0.94.6/bin/hbase classpath`
>> HBaseExample.java
>> >> >> >> >> >
>> >> >> >> >> > so errors reduced to 15 from 18
>> >> >> >> >> > could you please what else I have to add
>> >> >> >> >> >
>> >> >> >> >> > please see the error
>> >> >> >> >> >
>> >> >> >> >> > alok@alok:~/exp/hbase/exp$ javac -classpath
>> >> >> >> >> > `~/packages/hbase-0.94.6/bin/hbase classpath`
>> HBaseExample.java
>> >> >> >> >> > HBaseExample.java:5: error: cannot find symbol
>> >> >> >> >> > import org.apache.hadoop.hbase.client.Scanner;
>> >> >> >> >> >                                      ^
>> >> >> >> >> >   symbol:   class Scanner
>> >> >> >> >> >   location: package org.apache.hadoop.hbase.client
>> >> >> >> >> > HBaseExample.java:6: error: cannot find symbol
>> >> >> >> >> > import org.apache.hadoop.hbase.io.BatchUpdate;
>> >> >> >> >> >                                  ^
>> >> >> >> >> >   symbol:   class BatchUpdate
>> >> >> >> >> >   location: package org.apache.hadoop.hbase.io
>> >> >> >> >> > HBaseExample.java:7: error: cannot find symbol
>> >> >> >> >> > import org.apache.hadoop.hbase.io.Cell;
>> >> >> >> >> >                                  ^
>> >> >> >> >> >   symbol:   class Cell
>> >> >> >> >> >   location: package org.apache.hadoop.hbase.io
>> >> >> >> >> > HBaseExample.java:8: error: cannot find symbol
>> >> >> >> >> > import org.apache.hadoop.hbase.io.RowResult;
>> >> >> >> >> >                                  ^
>> >> >> >> >> >   symbol:   class RowResult
>> >> >> >> >> >   location: package org.apache.hadoop.hbase.io
>> >> >> >> >> > HBaseExample.java:20: error: cannot find symbol
>> >> >> >> >> >         BatchUpdate batchUpdate = new
>> BatchUpdate("test_row1");
>> >> >> >> >> >         ^
>> >> >> >> >> >   symbol:   class BatchUpdate
>> >> >> >> >> >   location: class HBaseExample
>> >> >> >> >> > HBaseExample.java:20: error: cannot find symbol
>> >> >> >> >> >         BatchUpdate batchUpdate = new
>> BatchUpdate("test_row1");
>> >> >> >> >> >                                       ^
>> >> >> >> >> >   symbol:   class BatchUpdate
>> >> >> >> >> >   location: class HBaseExample
>> >> >> >> >> > HBaseExample.java:25: error: cannot find symbol
>> >> >> >> >> >         Cell cell = table.get("test_row1",
>> >> >> "columnfamily1:column1");
>> >> >> >> >> >         ^
>> >> >> >> >> >   symbol:   class Cell
>> >> >> >> >> >   location: class HBaseExample
>> >> >> >> >> > HBaseExample.java:25: error: no suitable method found for
>> >> >> >> >> get(String,String)
>> >> >> >> >> >         Cell cell = table.get("test_row1",
>> >> >> "columnfamily1:column1");
>> >> >> >> >> >                          ^
>> >> >> >> >> >     method HTable.get(List<Get>) is not applicable
>> >> >> >> >> >       (actual and formal argument lists differ in length)
>> >> >> >> >> >     method HTable.get(Get) is not applicable
>> >> >> >> >> >       (actual and formal argument lists differ in length)
>> >> >> >> >> > HBaseExample.java:31: error: cannot find symbol
>> >> >> >> >> >         RowResult singleRow =
>> >> >> >> table.getRow(Bytes.toBytes("test_row1"));
>> >> >> >> >> >         ^
>> >> >> >> >> >   symbol:   class RowResult
>> >> >> >> >> >   location: class HBaseExample
>> >> >> >> >> > HBaseExample.java:31: error: cannot find symbol
>> >> >> >> >> >         RowResult singleRow =
>> >> >> >> table.getRow(Bytes.toBytes("test_row1"));
>> >> >> >> >> >                                    ^
>> >> >> >> >> >   symbol:   method getRow(byte[])
>> >> >> >> >> >   location: variable table of type HTable
>> >> >> >> >> > HBaseExample.java:32: error: cannot find symbol
>> >> >> >> >> >         Cell cell =
>> >> >> >> >> singleRow.get(Bytes.toBytes("columnfamily1:column1"));
>> >> >> >> >> >         ^
>> >> >> >> >> >   symbol:   class Cell
>> >> >> >> >> >   location: class HBaseExample
>> >> >> >> >> > HBaseExample.java:42: error: cannot find symbol
>> >> >> >> >> >         Scanner scanner = table.getScanner(
>> >> >> >> >> >         ^
>> >> >> >> >> >   symbol:   class Scanner
>> >> >> >> >> >   location: class HBaseExample
>> >> >> >> >> > HBaseExample.java:42: error: no suitable method found for
>> >> >> >> >> > getScanner(String[])
>> >> >> >> >> >         Scanner scanner = table.getScanner(
>> >> >> >> >> >                                ^
>> >> >> >> >> >     method HTable.getScanner(byte[],byte[]) is not applicable
>> >> >> >> >> >       (actual and formal argument lists differ in length)
>> >> >> >> >> >     method HTable.getScanner(byte[]) is not applicable
>> >> >> >> >> >       (actual argument String[] cannot be converted to
>> byte[] by
>> >> >> >> method
>> >> >> >> >> > invocation conversion)
>> >> >> >> >> >     method HTable.getScanner(Scan) is not applicable
>> >> >> >> >> >       (actual argument String[] cannot be converted to Scan
>> by
>> >> >> method
>> >> >> >> >> > invocation conversion)
>> >> >> >> >> > HBaseExample.java:46: error: cannot find symbol
>> >> >> >> >> >         RowResult rowResult = scanner.next();
>> >> >> >> >> >         ^
>> >> >> >> >> >   symbol:   class RowResult
>> >> >> >> >> >   location: class HBaseExample
>> >> >> >> >> > HBaseExample.java:55: error: cannot find symbol
>> >> >> >> >> >         for (RowResult result : scanner) {
>> >> >> >> >> >              ^
>> >> >> >> >> >   symbol:   class RowResult
>> >> >> >> >> >   location: class HBaseExample
>> >> >> >> >> > Note: HBaseExample.java uses or overrides a deprecated API.
>> >> >> >> >> > Note: Recompile with -Xlint:deprecation for details.
>> >> >> >> >> > 15 errors
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> > On Thu, Apr 4, 2013 at 2:50 AM, Harsha <ha...@defun.org>
>> >> wrote:
>> >> >> >> >> >
>> >> >> >> >> >> Alok,
>> >> >> >> >> >>     run "hbase classpath" and try putting everything in it
>> in
>> >> >> class
>> >> >> >> >> path.
>> >> >> >> >> >> -Harsha
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >> --
>> >> >> >> >> >> Harsha
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >> On Wednesday, April 3, 2013 at 9:59 AM, Andrea Gazzarini
>> wrote:
>> >> >> >> >> >>
>> >> >> >> >> >> > I don't have my laptop with me at the momemt and honestly
>> >> last
>> >> >> >> time I
>> >> >> >> >> >> > ran a javac from command line it was about ten years ago
>> but
>> >> my
>> >> >> >> >> >> > questions is : are you sure you can use wildcard this way?
>> >> >> >> >> >> > If I remember well, prior to JDK 1.6 you could not use
>> >> >> widlcards at
>> >> >> >> >> all,
>> >> >> >> >> >> > and starting from 1.6 you can use *only* wildcard, without
>> >> the
>> >> >> >> ".jar"
>> >> >> >> >> >> suffix
>> >> >> >> >> >> >
>> >> >> >> >> >> > Best,
>> >> >> >> >> >> > Andrea
>> >> >> >> >> >> >
>> >> >> >> >> >> >
>> >> >> >> >> >> > On 04/03/2013 06:37 PM, Alok Singh Mahor wrote:
>> >> >> >> >> >> > > Hi all,
>> >> >> >> >> >> > > today I start afresh a Example code on
>> >> >> >> >> >> > >
>> >> >> >> http://blog.rajeevsharma.in/2009/06/using-hbase-in-java-0193.html
>> >> >> >> >> >> > > but I guess luck is not with me.
>> >> >> >> >> >> > > I run
>> >> >> >> >> >> > > javac -classpath
>> >> >> >> >> >> > >
>> >> >> >> >> >>
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> ~/packages/hbase-0.94.6/hbase-0.94.6.jar:~/packages/hbase-0.94.6/lib/*:~/packages/hadoop-1.1.2/*.jar:~/packages/hadoop-1.1.2/lib/*.jar
>> >> >> >> >> >> > > HBaseExample.java -verbose
>> >> >> >> >> >> > >
>> >> >> >> >> >> > > please tell me what else I need to add in path to
>> resolve
>> >> >> these
>> >> >> >> >> errors
>> >> >> >> >> >> > >
>> >> >> >> >> >> > > thank you
>> >> >> >> >> >> > >
>> >> >> >> >> >> > >
>> >> >> >> >> >> > > alok@alok:~/exp/hbase/exp$ javac -classpath
>> >> >> >> >> >> > >
>> >> >> >> >> >>
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> ~/packages/hbase-0.94.6/hbase-0.94.6.jar:~/packages/hbase-0.94.6/lib/*:~/packages/hadoop-1.1.2/*.jar:~/packages/hadoop-1.1.2/lib/*.jar
>> >> >> >> >> >> > > HBaseExample.java -verbose
>> >> >> >> >> >> > > [parsing started RegularFileObject[HBaseExample.java]]
>> >> >> >> >> >> > > [parsing completed 29ms]
>> >> >> >> >> >> > > [search path for source files:
>> >> >> >> >> >> > >
>> >> >> >> >> >>
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> /home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar,~/packages/hbase-0.94.6/lib/*,~/packages/hadoop-1.1.2/*.jar,~/packages/hadoop-1.1.2/lib/*.jar]
>> >> >> >> >> >> > > [search path for class files:
>> >> >> >> >> >> > >
>> >> >> >> >> >>
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> /usr/lib/jvm/java-7-openjdk-i386/jre/lib/resources.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/rt.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/sunrsasign.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jsse.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jce.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/charsets.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/netx.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/plugin.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/rhino.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jfr.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/classes,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/zipfs.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/sunjce_provider.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/sunpkcs11.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/pulse-java.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/dnsns.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/java-atk-wrapper.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/localedata.jar,/home/alok/pack
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> ages/hbase-0.94.6/hbase-0.94.6.jar,~/packages/hbase-0.94.6/lib/*,~/packages/hadoop-1.1.2/*.jar,~/packages/hadoop-1.1.2/lib/*.jar]
>> >> >> >> >> >> > > [loading
>> >> >> >> >> >> > >
>> >> >> >> >> >>
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/IOException.class)]]
>> >> >> >> >> >> > > HBaseExample.java:2: error: package org.apache.hadoop.fs
>> >> does
>> >> >> not
>> >> >> >> >> exist
>> >> >> >> >> >> > > import org.apache.hadoop.fs.Path;
>> >> >> >> >> >> > > ^
>> >> >> >> >> >> > > [loading
>> >> >> >> >> >> > >
>> >> >> >> >> >>
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/HBaseConfiguration.class)]]
>> >> >> >> >> >> > > [loading
>> >> >> >> >> >> > >
>> >> >> >> >> >>
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/client/HTable.class)]]
>> >> >> >> >> >> > > HBaseExample.java:5: error: cannot find symbol
>> >> >> >> >> >> > > import org.apache.hadoop.hbase.client.Scanner;
>> >> >> >> >> >> > > ^
>> >> >> >> >> >> > > symbol: class Scanner
>> >> >> >> >> >> > > location: package org.apache.hadoop.hbase.client
>> >> >> >> >> >> > > HBaseExample.java:6: error: cannot find symbol
>> >> >> >> >> >> > > import org.apache.hadoop.hbase.io.BatchUpdate;
>> >> >> >> >> >> > > ^
>> >> >> >> >> >> > > symbol: class BatchUpdate
>> >> >> >> >> >> > > location: package org.apache.hadoop.hbase.io (
>> >> >> >> >> >> http://org.apache.hadoop.hbase.io)
>> >> >> >> >> >> > > HBaseExample.java:7: error: cannot find symbol
>> >> >> >> >> >> > > import org.apache.hadoop.hbase.io.Cell;
>> >> >> >> >> >> > > ^
>> >> >> >> >> >> > > symbol: class Cell
>> >> >> >> >> >> > > location: package org.apache.hadoop.hbase.io (
>> >> >> >> >> >> http://org.apache.hadoop.hbase.io)
>> >> >> >> >> >> > > HBaseExample.java:8: error: cannot find symbol
>> >> >> >> >> >> > > import org.apache.hadoop.hbase.io.RowResult;
>> >> >> >> >> >> > > ^
>> >> >> >> >> >> > > symbol: class RowResult
>> >> >> >> >> >> > > location: package org.apache.hadoop.hbase.io (
>> >> >> >> >> >> http://org.apache.hadoop.hbase.io)
>> >> >> >> >> >> > > [loading
>> >> >> >> >> >> > >
>> >> >> >> >> >>
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/util/Bytes.class)]]
>> >> >> >> >> >> > > [loading
>> >> >> >> >> >> > >
>> >> >> >> >> >>
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Object.class)]]
>> >> >> >> >> >> > > [loading
>> >> >> >> >> >> > >
>> >> >> >> >> >>
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/String.class)]]
>> >> >> >> >> >> > > [checking HBaseExample]
>> >> >> >> >> >> > > [loading
>> >> >> >> >> >> > >
>> >> >> >> >> >>
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/AutoCloseable.class)]]
>> >> >> >> >> >> > > [loading
>> >> >> >> >> >> > >
>> >> >> >> >> >>
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Exception.class)]]
>> >> >> >> >> >> > > [loading
>> >> >> >> >> >> > >
>> >> >> >> >> >>
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Throwable.class)]]
>> >> >> >> >> >> > > HBaseExample.java:16: error: cannot find symbol
>> >> >> >> >> >> > > conf.addResource(new
>> >> >> >> Path("/opt/hbase-0.19.3/conf/hbase-site.xml"));
>> >> >> >> >> >> > > ^
>> >> >> >> >> >> > > symbol: class Path
>> >> >> >> >> >> > > location: class HBaseExample
>> >> >> >> >> >> > > HBaseExample.java:16: error: cannot access Configuration
>> >> >> >> >> >> > > conf.addResource(new
>> >> >> >> Path("/opt/hbase-0.19.3/conf/hbase-site.xml"));
>> >> >> >> >> >> > > ^
>> >> >> >> >> >> > > class file for org.apache.hadoop.conf.Configuration not
>> >> found
>> >> >> >> >> >> > > HBaseExample.java:20: error: cannot find symbol
>> >> >> >> >> >> > > BatchUpdate batchUpdate = new BatchUpdate("test_row1");
>> >> >> >> >> >> > > ^
>> >> >> >> >> >> > > symbol: class BatchUpdate
>> >> >> >> >> >> > > location: class HBaseExample
>> >> >> >> >> >> > > HBaseExample.java:20: error: cannot find symbol
>> >> >> >> >> >> > > BatchUpdate batchUpdate = new BatchUpdate("test_row1");
>> >> >> >> >> >> > > ^
>> >> >> >> >> >> > > symbol: class BatchUpdate
>> >> >> >> >> >> > > location: class HBaseExample
>> >> >> >> >> >> > > [loading
>> >> >> >> >> >> > >
>> >> >> >> >> >>
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/math/BigDecimal.class)]]
>> >> >> >> >> >> > > [loading
>> >> >> >> >> >> > >
>> >> >> >> >> >>
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/nio/ByteBuffer.class)]]
>> >> >> >> >> >> > > HBaseExample.java:25: error: cannot find symbol
>> >> >> >> >> >> > > Cell cell = table.get("test_row1",
>> >> "columnfamily1:column1");
>> >> >> >> >> >> > > ^
>> >> >> >> >> >> > > symbol: class Cell
>> >> >> >> >> >> > > location: class HBaseExample
>> >> >> >> >> >> > > [loading
>> >> >> >> >> >> > >
>> >> >> >> >> >>
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/util/List.class)]]
>> >> >> >> >> >> > > HBaseExample.java:25: error: no suitable method found
>> for
>> >> >> >> >> >> get(String,String)
>> >> >> >> >> >> > > Cell cell = table.get("test_row1",
>> >> "columnfamily1:column1");
>> >> >> >> >> >> > > ^
>> >> >> >> >> >> > > method HTable.get(List<Get>) is not applicable
>> >> >> >> >> >> > > (actual and formal argument lists differ in length)
>> >> >> >> >> >> > > method HTable.get(Get) is not applicable
>> >> >> >> >> >> > > (actual and formal argument lists differ in length)
>> >> >> >> >> >> > > [loading
>> >> >> >> >> >> > >
>> >> >> >> >> >>
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/System.class)]]
>> >> >> >> >> >> > > [loading
>> >> >> >> >> >> > >
>> >> >> >> >> >>
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/PrintStream.class)]]
>> >> >> >> >> >> > > [loading
>> >> >> >> >> >> > >
>> >> >> >> >> >>
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/FilterOutputStream.class)]]
>> >> >> >> >> >> > > [loading
>> >> >> >> >> >> > >
>> >> >> >> >> >>
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/OutputStream.class)]]
>> >> >> >> >> >> > > HBaseExample.java:31: error: cannot find symbol
>> >> >> >> >> >> > > RowResult singleRow =
>> >> >> table.getRow(Bytes.toBytes("test_row1"));
>> >> >> >> >> >> > > ^
>> >> >> >> >> >> > > symbol: class RowResult
>> >> >> >> >> >> > > location: class HBaseExample
>> >> >> >> >> >> > > HBaseExample.java:31: error: cannot find symbol
>> >> >> >> >> >> > > RowResult singleRow =
>> >> >> table.getRow(Bytes.toBytes("test_row1"));
>> >> >> >> >> >> > > ^
>> >> >> >> >> >> > > symbol: method getRow(byte[])
>> >> >> >> >> >> > > location: variable table of type HTable
>> >> >> >> >> >> > > HBaseExample.java:32: error: cannot find symbol
>> >> >> >> >> >> > > Cell cell =
>> >> >> >> singleRow.get(Bytes.toBytes("columnfamily1:column1"));
>> >> >> >> >> >> > > ^
>> >> >> >> >> >> > > symbol: class Cell
>> >> >> >> >> >> > > location: class HBaseExample
>> >> >> >> >> >> > > HBaseExample.java:42: error: cannot find symbol
>> >> >> >> >> >> > > Scanner scanner = table.getScanner(
>> >> >> >> >> >> > > ^
>> >> >> >> >> >> > > symbol: class Scanner
>> >> >> >> >> >> > > location: class HBaseExample
>> >> >> >> >> >> > > [loading
>> >> >> >> >> >> > >
>> >> >> >> >> >>
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/client/Scan.class)]]
>> >> >> >> >> >> > > HBaseExample.java:42: error: no suitable method found
>> for
>> >> >> >> >> >> > > getScanner(String[])
>> >> >> >> >> >> > > Scanner scanner = table.getScanner(
>> >> >> >> >> >> > > ^
>> >> >> >> >> >> > > method HTable.getScanner(byte[],byte[]) is not
>> applicable
>> >> >> >> >> >> > > (actual and formal argument lists differ in length)
>> >> >> >> >> >> > > method HTable.getScanner(byte[]) is not applicable
>> >> >> >> >> >> > > (actual argument String[] cannot be converted to byte[]
>> by
>> >> >> method
>> >> >> >> >> >> > > invocation conversion)
>> >> >> >> >> >> > > method HTable.getScanner(Scan) is not applicable
>> >> >> >> >> >> > > (actual argument String[] cannot be converted to Scan by
>> >> >> method
>> >> >> >> >> >> > > invocation conversion)
>> >> >> >> >> >> > > HBaseExample.java:46: error: cannot find symbol
>> >> >> >> >> >> > > RowResult rowResult = scanner.next();
>> >> >> >> >> >> > > ^
>> >> >> >> >> >> > > symbol: class RowResult
>> >> >> >> >> >> > > location: class HBaseExample
>> >> >> >> >> >> > > HBaseExample.java:55: error: cannot find symbol
>> >> >> >> >> >> > > for (RowResult result : scanner) {
>> >> >> >> >> >> > > ^
>> >> >> >> >> >> > > symbol: class RowResult
>> >> >> >> >> >> > > location: class HBaseExample
>> >> >> >> >> >> > > [total 461ms]
>> >> >> >> >> >> > > Note: HBaseExample.java uses or overrides a deprecated
>> API.
>> >> >> >> >> >> > > Note: Recompile with -Xlint:deprecation for details.
>> >> >> >> >> >> > > 18 errors
>> >> >> >> >> >> > >
>> >> >> >> >> >> >
>> >> >> >> >> >> >
>> >> >> >> >> >> >
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>>

Re: connecting Hbase using java

Posted by Alok Singh Mahor <al...@gmail.com>.
sorry, actually I was copy pasting code and modifying. so I missed changing
name of CF.
still I am getting some error. I tried to get something from log on google
but didnt get anything useful. I guess there is some configuration problem
in my hbase-site.xml

please look at the error at http://paste.ubuntu.com/5678610/
what is the problem at line no. 23 ?

content of /etc/hosts is

127.0.0.1       localhost
#127.0.0.1      alok
# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters





On Thu, Apr 4, 2013 at 8:43 PM, Jean-Marc Spaggiari <jean-marc@spaggiari.org
> wrote:

> Alok,
>
> Can you take a deeper look in your code and your logs before asking
> someone to solve that for you? ;)
>
> Your CF is called "myColumnFamily" and not "myLittleFamily".
>
> Also, I will recommand you to read some HBase related books where you
> will learn that column familly names need to be as small as
> possible... one byte is the best.
>
> JM
>
> 2013/4/4 Alok Singh Mahor <al...@gmail.com>:
> > yes thank you so much jean, I will switch to eclipse.
> >
> > now I tried with (java -classpath `~/packages/hbase-0.94.6/bin/hbase
> > classpath` MyLittleHBaseClient)
> >
> > code is running but I guess now I have some problem with my hbase and
> hadoop
> >
> > I am getting output that you can see at http://paste.ubuntu.com/5676866/
> > could you please figure out where things are wrong now?
> > thanks again, your reply are helping me learning basic things.
> >
> >
> >
> > On Thu, Apr 4, 2013 at 8:11 PM, Jean-Marc Spaggiari <
> jean-marc@spaggiari.org
> >> wrote:
> >
> >> 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 <al...@gmail.com>:
> >> > 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 <
> >> jean-marc@spaggiari.org
> >> >> wrote:
> >> >
> >> >> org.apache.hadoop.conf.Configuration is missing from the imports...
> >> >>
> >> >> 2013/4/4 Alok Singh Mahor <al...@gmail.com>:
> >> >> > 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 <
> >> >> jean-marc@spaggiari.org
> >> >> >> 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 <al...@gmail.com>:
> >> >> >> > 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/jaxb-api-2.1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jaxb-impl-2.2.3-1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jersey-core-1.8.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jersey-json-1.8.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jersey-server-1.8.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jettison-1.1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jetty-6.1.26.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jetty-util-6.1.26.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jruby-complete-1.6.5.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jsp-2.1-6.1.14.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jsp-api-2.1-6.1.14.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jsr305-1.3.9.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/junit-4.10-HBASE-1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/libthrift-0.8.0.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/log4j-1.2.16.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/metrics-core-2.1.2.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/netty-3.2.4.Final.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/protobuf-java-2.4.0a.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/servlet-api-2.5-6.1.14.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/slf4j-api-1.4.3.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/slf4j-log4j12-1.4.3.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/snappy-java-1.0.3.2.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/stax-api-1.0.1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/velocity-1.7.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/xmlenc-0.52.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/zookeeper-3.4.5.jar:
> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >> >> > On Thu, Apr 4, 2013 at 5:54 AM, Jean-Marc Spaggiari <
> >> >> >> jean-marc@spaggiari.org
> >> >> >> >> wrote:
> >> >> >> >
> >> >> >> >> What's the output of ~/packages/hbase-0.94.6/bin/hbase
> classpath?
> >> >> >> >>
> >> >> >> >> 2013/4/3 Alok Singh Mahor <al...@gmail.com>:
> >> >> >> >> > thank you Harsha
> >> >> >> >> > with your advice I used command to compile that example code
> >> >> >> >> > alok@alok:~/exp/hbase/exp$ javac -classpath
> >> >> >> >> > `~/packages/hbase-0.94.6/bin/hbase classpath`
> HBaseExample.java
> >> >> >> >> >
> >> >> >> >> > so errors reduced to 15 from 18
> >> >> >> >> > could you please what else I have to add
> >> >> >> >> >
> >> >> >> >> > please see the error
> >> >> >> >> >
> >> >> >> >> > alok@alok:~/exp/hbase/exp$ javac -classpath
> >> >> >> >> > `~/packages/hbase-0.94.6/bin/hbase classpath`
> HBaseExample.java
> >> >> >> >> > HBaseExample.java:5: error: cannot find symbol
> >> >> >> >> > import org.apache.hadoop.hbase.client.Scanner;
> >> >> >> >> >                                      ^
> >> >> >> >> >   symbol:   class Scanner
> >> >> >> >> >   location: package org.apache.hadoop.hbase.client
> >> >> >> >> > HBaseExample.java:6: error: cannot find symbol
> >> >> >> >> > import org.apache.hadoop.hbase.io.BatchUpdate;
> >> >> >> >> >                                  ^
> >> >> >> >> >   symbol:   class BatchUpdate
> >> >> >> >> >   location: package org.apache.hadoop.hbase.io
> >> >> >> >> > HBaseExample.java:7: error: cannot find symbol
> >> >> >> >> > import org.apache.hadoop.hbase.io.Cell;
> >> >> >> >> >                                  ^
> >> >> >> >> >   symbol:   class Cell
> >> >> >> >> >   location: package org.apache.hadoop.hbase.io
> >> >> >> >> > HBaseExample.java:8: error: cannot find symbol
> >> >> >> >> > import org.apache.hadoop.hbase.io.RowResult;
> >> >> >> >> >                                  ^
> >> >> >> >> >   symbol:   class RowResult
> >> >> >> >> >   location: package org.apache.hadoop.hbase.io
> >> >> >> >> > HBaseExample.java:20: error: cannot find symbol
> >> >> >> >> >         BatchUpdate batchUpdate = new
> BatchUpdate("test_row1");
> >> >> >> >> >         ^
> >> >> >> >> >   symbol:   class BatchUpdate
> >> >> >> >> >   location: class HBaseExample
> >> >> >> >> > HBaseExample.java:20: error: cannot find symbol
> >> >> >> >> >         BatchUpdate batchUpdate = new
> BatchUpdate("test_row1");
> >> >> >> >> >                                       ^
> >> >> >> >> >   symbol:   class BatchUpdate
> >> >> >> >> >   location: class HBaseExample
> >> >> >> >> > HBaseExample.java:25: error: cannot find symbol
> >> >> >> >> >         Cell cell = table.get("test_row1",
> >> >> "columnfamily1:column1");
> >> >> >> >> >         ^
> >> >> >> >> >   symbol:   class Cell
> >> >> >> >> >   location: class HBaseExample
> >> >> >> >> > HBaseExample.java:25: error: no suitable method found for
> >> >> >> >> get(String,String)
> >> >> >> >> >         Cell cell = table.get("test_row1",
> >> >> "columnfamily1:column1");
> >> >> >> >> >                          ^
> >> >> >> >> >     method HTable.get(List<Get>) is not applicable
> >> >> >> >> >       (actual and formal argument lists differ in length)
> >> >> >> >> >     method HTable.get(Get) is not applicable
> >> >> >> >> >       (actual and formal argument lists differ in length)
> >> >> >> >> > HBaseExample.java:31: error: cannot find symbol
> >> >> >> >> >         RowResult singleRow =
> >> >> >> table.getRow(Bytes.toBytes("test_row1"));
> >> >> >> >> >         ^
> >> >> >> >> >   symbol:   class RowResult
> >> >> >> >> >   location: class HBaseExample
> >> >> >> >> > HBaseExample.java:31: error: cannot find symbol
> >> >> >> >> >         RowResult singleRow =
> >> >> >> table.getRow(Bytes.toBytes("test_row1"));
> >> >> >> >> >                                    ^
> >> >> >> >> >   symbol:   method getRow(byte[])
> >> >> >> >> >   location: variable table of type HTable
> >> >> >> >> > HBaseExample.java:32: error: cannot find symbol
> >> >> >> >> >         Cell cell =
> >> >> >> >> singleRow.get(Bytes.toBytes("columnfamily1:column1"));
> >> >> >> >> >         ^
> >> >> >> >> >   symbol:   class Cell
> >> >> >> >> >   location: class HBaseExample
> >> >> >> >> > HBaseExample.java:42: error: cannot find symbol
> >> >> >> >> >         Scanner scanner = table.getScanner(
> >> >> >> >> >         ^
> >> >> >> >> >   symbol:   class Scanner
> >> >> >> >> >   location: class HBaseExample
> >> >> >> >> > HBaseExample.java:42: error: no suitable method found for
> >> >> >> >> > getScanner(String[])
> >> >> >> >> >         Scanner scanner = table.getScanner(
> >> >> >> >> >                                ^
> >> >> >> >> >     method HTable.getScanner(byte[],byte[]) is not applicable
> >> >> >> >> >       (actual and formal argument lists differ in length)
> >> >> >> >> >     method HTable.getScanner(byte[]) is not applicable
> >> >> >> >> >       (actual argument String[] cannot be converted to
> byte[] by
> >> >> >> method
> >> >> >> >> > invocation conversion)
> >> >> >> >> >     method HTable.getScanner(Scan) is not applicable
> >> >> >> >> >       (actual argument String[] cannot be converted to Scan
> by
> >> >> method
> >> >> >> >> > invocation conversion)
> >> >> >> >> > HBaseExample.java:46: error: cannot find symbol
> >> >> >> >> >         RowResult rowResult = scanner.next();
> >> >> >> >> >         ^
> >> >> >> >> >   symbol:   class RowResult
> >> >> >> >> >   location: class HBaseExample
> >> >> >> >> > HBaseExample.java:55: error: cannot find symbol
> >> >> >> >> >         for (RowResult result : scanner) {
> >> >> >> >> >              ^
> >> >> >> >> >   symbol:   class RowResult
> >> >> >> >> >   location: class HBaseExample
> >> >> >> >> > Note: HBaseExample.java uses or overrides a deprecated API.
> >> >> >> >> > Note: Recompile with -Xlint:deprecation for details.
> >> >> >> >> > 15 errors
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> > On Thu, Apr 4, 2013 at 2:50 AM, Harsha <ha...@defun.org>
> >> wrote:
> >> >> >> >> >
> >> >> >> >> >> Alok,
> >> >> >> >> >>     run "hbase classpath" and try putting everything in it
> in
> >> >> class
> >> >> >> >> path.
> >> >> >> >> >> -Harsha
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >> --
> >> >> >> >> >> Harsha
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >> On Wednesday, April 3, 2013 at 9:59 AM, Andrea Gazzarini
> wrote:
> >> >> >> >> >>
> >> >> >> >> >> > I don't have my laptop with me at the momemt and honestly
> >> last
> >> >> >> time I
> >> >> >> >> >> > ran a javac from command line it was about ten years ago
> but
> >> my
> >> >> >> >> >> > questions is : are you sure you can use wildcard this way?
> >> >> >> >> >> > If I remember well, prior to JDK 1.6 you could not use
> >> >> widlcards at
> >> >> >> >> all,
> >> >> >> >> >> > and starting from 1.6 you can use *only* wildcard, without
> >> the
> >> >> >> ".jar"
> >> >> >> >> >> suffix
> >> >> >> >> >> >
> >> >> >> >> >> > Best,
> >> >> >> >> >> > Andrea
> >> >> >> >> >> >
> >> >> >> >> >> >
> >> >> >> >> >> > On 04/03/2013 06:37 PM, Alok Singh Mahor wrote:
> >> >> >> >> >> > > Hi all,
> >> >> >> >> >> > > today I start afresh a Example code on
> >> >> >> >> >> > >
> >> >> >> http://blog.rajeevsharma.in/2009/06/using-hbase-in-java-0193.html
> >> >> >> >> >> > > but I guess luck is not with me.
> >> >> >> >> >> > > I run
> >> >> >> >> >> > > javac -classpath
> >> >> >> >> >> > >
> >> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> ~/packages/hbase-0.94.6/hbase-0.94.6.jar:~/packages/hbase-0.94.6/lib/*:~/packages/hadoop-1.1.2/*.jar:~/packages/hadoop-1.1.2/lib/*.jar
> >> >> >> >> >> > > HBaseExample.java -verbose
> >> >> >> >> >> > >
> >> >> >> >> >> > > please tell me what else I need to add in path to
> resolve
> >> >> these
> >> >> >> >> errors
> >> >> >> >> >> > >
> >> >> >> >> >> > > thank you
> >> >> >> >> >> > >
> >> >> >> >> >> > >
> >> >> >> >> >> > > alok@alok:~/exp/hbase/exp$ javac -classpath
> >> >> >> >> >> > >
> >> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> ~/packages/hbase-0.94.6/hbase-0.94.6.jar:~/packages/hbase-0.94.6/lib/*:~/packages/hadoop-1.1.2/*.jar:~/packages/hadoop-1.1.2/lib/*.jar
> >> >> >> >> >> > > HBaseExample.java -verbose
> >> >> >> >> >> > > [parsing started RegularFileObject[HBaseExample.java]]
> >> >> >> >> >> > > [parsing completed 29ms]
> >> >> >> >> >> > > [search path for source files:
> >> >> >> >> >> > >
> >> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> /home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar,~/packages/hbase-0.94.6/lib/*,~/packages/hadoop-1.1.2/*.jar,~/packages/hadoop-1.1.2/lib/*.jar]
> >> >> >> >> >> > > [search path for class files:
> >> >> >> >> >> > >
> >> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> /usr/lib/jvm/java-7-openjdk-i386/jre/lib/resources.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/rt.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/sunrsasign.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jsse.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jce.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/charsets.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/netx.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/plugin.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/rhino.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jfr.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/classes,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/zipfs.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/sunjce_provider.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/sunpkcs11.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/pulse-java.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/dnsns.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/java-atk-wrapper.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/localedata.jar,/home/alok/pack
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> ages/hbase-0.94.6/hbase-0.94.6.jar,~/packages/hbase-0.94.6/lib/*,~/packages/hadoop-1.1.2/*.jar,~/packages/hadoop-1.1.2/lib/*.jar]
> >> >> >> >> >> > > [loading
> >> >> >> >> >> > >
> >> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/IOException.class)]]
> >> >> >> >> >> > > HBaseExample.java:2: error: package org.apache.hadoop.fs
> >> does
> >> >> not
> >> >> >> >> exist
> >> >> >> >> >> > > import org.apache.hadoop.fs.Path;
> >> >> >> >> >> > > ^
> >> >> >> >> >> > > [loading
> >> >> >> >> >> > >
> >> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/HBaseConfiguration.class)]]
> >> >> >> >> >> > > [loading
> >> >> >> >> >> > >
> >> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/client/HTable.class)]]
> >> >> >> >> >> > > HBaseExample.java:5: error: cannot find symbol
> >> >> >> >> >> > > import org.apache.hadoop.hbase.client.Scanner;
> >> >> >> >> >> > > ^
> >> >> >> >> >> > > symbol: class Scanner
> >> >> >> >> >> > > location: package org.apache.hadoop.hbase.client
> >> >> >> >> >> > > HBaseExample.java:6: error: cannot find symbol
> >> >> >> >> >> > > import org.apache.hadoop.hbase.io.BatchUpdate;
> >> >> >> >> >> > > ^
> >> >> >> >> >> > > symbol: class BatchUpdate
> >> >> >> >> >> > > location: package org.apache.hadoop.hbase.io (
> >> >> >> >> >> http://org.apache.hadoop.hbase.io)
> >> >> >> >> >> > > HBaseExample.java:7: error: cannot find symbol
> >> >> >> >> >> > > import org.apache.hadoop.hbase.io.Cell;
> >> >> >> >> >> > > ^
> >> >> >> >> >> > > symbol: class Cell
> >> >> >> >> >> > > location: package org.apache.hadoop.hbase.io (
> >> >> >> >> >> http://org.apache.hadoop.hbase.io)
> >> >> >> >> >> > > HBaseExample.java:8: error: cannot find symbol
> >> >> >> >> >> > > import org.apache.hadoop.hbase.io.RowResult;
> >> >> >> >> >> > > ^
> >> >> >> >> >> > > symbol: class RowResult
> >> >> >> >> >> > > location: package org.apache.hadoop.hbase.io (
> >> >> >> >> >> http://org.apache.hadoop.hbase.io)
> >> >> >> >> >> > > [loading
> >> >> >> >> >> > >
> >> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/util/Bytes.class)]]
> >> >> >> >> >> > > [loading
> >> >> >> >> >> > >
> >> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Object.class)]]
> >> >> >> >> >> > > [loading
> >> >> >> >> >> > >
> >> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/String.class)]]
> >> >> >> >> >> > > [checking HBaseExample]
> >> >> >> >> >> > > [loading
> >> >> >> >> >> > >
> >> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/AutoCloseable.class)]]
> >> >> >> >> >> > > [loading
> >> >> >> >> >> > >
> >> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Exception.class)]]
> >> >> >> >> >> > > [loading
> >> >> >> >> >> > >
> >> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Throwable.class)]]
> >> >> >> >> >> > > HBaseExample.java:16: error: cannot find symbol
> >> >> >> >> >> > > conf.addResource(new
> >> >> >> Path("/opt/hbase-0.19.3/conf/hbase-site.xml"));
> >> >> >> >> >> > > ^
> >> >> >> >> >> > > symbol: class Path
> >> >> >> >> >> > > location: class HBaseExample
> >> >> >> >> >> > > HBaseExample.java:16: error: cannot access Configuration
> >> >> >> >> >> > > conf.addResource(new
> >> >> >> Path("/opt/hbase-0.19.3/conf/hbase-site.xml"));
> >> >> >> >> >> > > ^
> >> >> >> >> >> > > class file for org.apache.hadoop.conf.Configuration not
> >> found
> >> >> >> >> >> > > HBaseExample.java:20: error: cannot find symbol
> >> >> >> >> >> > > BatchUpdate batchUpdate = new BatchUpdate("test_row1");
> >> >> >> >> >> > > ^
> >> >> >> >> >> > > symbol: class BatchUpdate
> >> >> >> >> >> > > location: class HBaseExample
> >> >> >> >> >> > > HBaseExample.java:20: error: cannot find symbol
> >> >> >> >> >> > > BatchUpdate batchUpdate = new BatchUpdate("test_row1");
> >> >> >> >> >> > > ^
> >> >> >> >> >> > > symbol: class BatchUpdate
> >> >> >> >> >> > > location: class HBaseExample
> >> >> >> >> >> > > [loading
> >> >> >> >> >> > >
> >> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/math/BigDecimal.class)]]
> >> >> >> >> >> > > [loading
> >> >> >> >> >> > >
> >> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/nio/ByteBuffer.class)]]
> >> >> >> >> >> > > HBaseExample.java:25: error: cannot find symbol
> >> >> >> >> >> > > Cell cell = table.get("test_row1",
> >> "columnfamily1:column1");
> >> >> >> >> >> > > ^
> >> >> >> >> >> > > symbol: class Cell
> >> >> >> >> >> > > location: class HBaseExample
> >> >> >> >> >> > > [loading
> >> >> >> >> >> > >
> >> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/util/List.class)]]
> >> >> >> >> >> > > HBaseExample.java:25: error: no suitable method found
> for
> >> >> >> >> >> get(String,String)
> >> >> >> >> >> > > Cell cell = table.get("test_row1",
> >> "columnfamily1:column1");
> >> >> >> >> >> > > ^
> >> >> >> >> >> > > method HTable.get(List<Get>) is not applicable
> >> >> >> >> >> > > (actual and formal argument lists differ in length)
> >> >> >> >> >> > > method HTable.get(Get) is not applicable
> >> >> >> >> >> > > (actual and formal argument lists differ in length)
> >> >> >> >> >> > > [loading
> >> >> >> >> >> > >
> >> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/System.class)]]
> >> >> >> >> >> > > [loading
> >> >> >> >> >> > >
> >> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/PrintStream.class)]]
> >> >> >> >> >> > > [loading
> >> >> >> >> >> > >
> >> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/FilterOutputStream.class)]]
> >> >> >> >> >> > > [loading
> >> >> >> >> >> > >
> >> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/OutputStream.class)]]
> >> >> >> >> >> > > HBaseExample.java:31: error: cannot find symbol
> >> >> >> >> >> > > RowResult singleRow =
> >> >> table.getRow(Bytes.toBytes("test_row1"));
> >> >> >> >> >> > > ^
> >> >> >> >> >> > > symbol: class RowResult
> >> >> >> >> >> > > location: class HBaseExample
> >> >> >> >> >> > > HBaseExample.java:31: error: cannot find symbol
> >> >> >> >> >> > > RowResult singleRow =
> >> >> table.getRow(Bytes.toBytes("test_row1"));
> >> >> >> >> >> > > ^
> >> >> >> >> >> > > symbol: method getRow(byte[])
> >> >> >> >> >> > > location: variable table of type HTable
> >> >> >> >> >> > > HBaseExample.java:32: error: cannot find symbol
> >> >> >> >> >> > > Cell cell =
> >> >> >> singleRow.get(Bytes.toBytes("columnfamily1:column1"));
> >> >> >> >> >> > > ^
> >> >> >> >> >> > > symbol: class Cell
> >> >> >> >> >> > > location: class HBaseExample
> >> >> >> >> >> > > HBaseExample.java:42: error: cannot find symbol
> >> >> >> >> >> > > Scanner scanner = table.getScanner(
> >> >> >> >> >> > > ^
> >> >> >> >> >> > > symbol: class Scanner
> >> >> >> >> >> > > location: class HBaseExample
> >> >> >> >> >> > > [loading
> >> >> >> >> >> > >
> >> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/client/Scan.class)]]
> >> >> >> >> >> > > HBaseExample.java:42: error: no suitable method found
> for
> >> >> >> >> >> > > getScanner(String[])
> >> >> >> >> >> > > Scanner scanner = table.getScanner(
> >> >> >> >> >> > > ^
> >> >> >> >> >> > > method HTable.getScanner(byte[],byte[]) is not
> applicable
> >> >> >> >> >> > > (actual and formal argument lists differ in length)
> >> >> >> >> >> > > method HTable.getScanner(byte[]) is not applicable
> >> >> >> >> >> > > (actual argument String[] cannot be converted to byte[]
> by
> >> >> method
> >> >> >> >> >> > > invocation conversion)
> >> >> >> >> >> > > method HTable.getScanner(Scan) is not applicable
> >> >> >> >> >> > > (actual argument String[] cannot be converted to Scan by
> >> >> method
> >> >> >> >> >> > > invocation conversion)
> >> >> >> >> >> > > HBaseExample.java:46: error: cannot find symbol
> >> >> >> >> >> > > RowResult rowResult = scanner.next();
> >> >> >> >> >> > > ^
> >> >> >> >> >> > > symbol: class RowResult
> >> >> >> >> >> > > location: class HBaseExample
> >> >> >> >> >> > > HBaseExample.java:55: error: cannot find symbol
> >> >> >> >> >> > > for (RowResult result : scanner) {
> >> >> >> >> >> > > ^
> >> >> >> >> >> > > symbol: class RowResult
> >> >> >> >> >> > > location: class HBaseExample
> >> >> >> >> >> > > [total 461ms]
> >> >> >> >> >> > > Note: HBaseExample.java uses or overrides a deprecated
> API.
> >> >> >> >> >> > > Note: Recompile with -Xlint:deprecation for details.
> >> >> >> >> >> > > 18 errors
> >> >> >> >> >> > >
> >> >> >> >> >> >
> >> >> >> >> >> >
> >> >> >> >> >> >
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >>
> >>
>

Re: connecting Hbase using java

Posted by Jean-Marc Spaggiari <je...@spaggiari.org>.
Alok,

Can you take a deeper look in your code and your logs before asking
someone to solve that for you? ;)

Your CF is called "myColumnFamily" and not "myLittleFamily".

Also, I will recommand you to read some HBase related books where you
will learn that column familly names need to be as small as
possible... one byte is the best.

JM

2013/4/4 Alok Singh Mahor <al...@gmail.com>:
> yes thank you so much jean, I will switch to eclipse.
>
> now I tried with (java -classpath `~/packages/hbase-0.94.6/bin/hbase
> classpath` MyLittleHBaseClient)
>
> code is running but I guess now I have some problem with my hbase and hadoop
>
> I am getting output that you can see at http://paste.ubuntu.com/5676866/
> could you please figure out where things are wrong now?
> thanks again, your reply are helping me learning basic things.
>
>
>
> On Thu, Apr 4, 2013 at 8:11 PM, Jean-Marc Spaggiari <jean-marc@spaggiari.org
>> wrote:
>
>> 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 <al...@gmail.com>:
>> > 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 <
>> jean-marc@spaggiari.org
>> >> wrote:
>> >
>> >> org.apache.hadoop.conf.Configuration is missing from the imports...
>> >>
>> >> 2013/4/4 Alok Singh Mahor <al...@gmail.com>:
>> >> > 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 <
>> >> jean-marc@spaggiari.org
>> >> >> 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 <al...@gmail.com>:
>> >> >> > 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/jaxb-api-2.1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jaxb-impl-2.2.3-1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jersey-core-1.8.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jersey-json-1.8.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jersey-server-1.8.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jettison-1.1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jetty-6.1.26.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jetty-util-6.1.26.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jruby-complete-1.6.5.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jsp-2.1-6.1.14.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jsp-api-2.1-6.1.14.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jsr305-1.3.9.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/junit-4.10-HBASE-1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/libthrift-0.8.0.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/log4j-1.2.16.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/metrics-core-2.1.2.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/netty-3.2.4.Final.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/protobuf-java-2.4.0a.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/servlet-api-2.5-6.1.14.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/slf4j-api-1.4.3.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/slf4j-log4j12-1.4.3.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/snappy-java-1.0.3.2.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/stax-api-1.0.1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/velocity-1.7.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/xmlenc-0.52.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/zookeeper-3.4.5.jar:
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > On Thu, Apr 4, 2013 at 5:54 AM, Jean-Marc Spaggiari <
>> >> >> jean-marc@spaggiari.org
>> >> >> >> wrote:
>> >> >> >
>> >> >> >> What's the output of ~/packages/hbase-0.94.6/bin/hbase classpath?
>> >> >> >>
>> >> >> >> 2013/4/3 Alok Singh Mahor <al...@gmail.com>:
>> >> >> >> > thank you Harsha
>> >> >> >> > with your advice I used command to compile that example code
>> >> >> >> > alok@alok:~/exp/hbase/exp$ javac -classpath
>> >> >> >> > `~/packages/hbase-0.94.6/bin/hbase classpath` HBaseExample.java
>> >> >> >> >
>> >> >> >> > so errors reduced to 15 from 18
>> >> >> >> > could you please what else I have to add
>> >> >> >> >
>> >> >> >> > please see the error
>> >> >> >> >
>> >> >> >> > alok@alok:~/exp/hbase/exp$ javac -classpath
>> >> >> >> > `~/packages/hbase-0.94.6/bin/hbase classpath` HBaseExample.java
>> >> >> >> > HBaseExample.java:5: error: cannot find symbol
>> >> >> >> > import org.apache.hadoop.hbase.client.Scanner;
>> >> >> >> >                                      ^
>> >> >> >> >   symbol:   class Scanner
>> >> >> >> >   location: package org.apache.hadoop.hbase.client
>> >> >> >> > HBaseExample.java:6: error: cannot find symbol
>> >> >> >> > import org.apache.hadoop.hbase.io.BatchUpdate;
>> >> >> >> >                                  ^
>> >> >> >> >   symbol:   class BatchUpdate
>> >> >> >> >   location: package org.apache.hadoop.hbase.io
>> >> >> >> > HBaseExample.java:7: error: cannot find symbol
>> >> >> >> > import org.apache.hadoop.hbase.io.Cell;
>> >> >> >> >                                  ^
>> >> >> >> >   symbol:   class Cell
>> >> >> >> >   location: package org.apache.hadoop.hbase.io
>> >> >> >> > HBaseExample.java:8: error: cannot find symbol
>> >> >> >> > import org.apache.hadoop.hbase.io.RowResult;
>> >> >> >> >                                  ^
>> >> >> >> >   symbol:   class RowResult
>> >> >> >> >   location: package org.apache.hadoop.hbase.io
>> >> >> >> > HBaseExample.java:20: error: cannot find symbol
>> >> >> >> >         BatchUpdate batchUpdate = new BatchUpdate("test_row1");
>> >> >> >> >         ^
>> >> >> >> >   symbol:   class BatchUpdate
>> >> >> >> >   location: class HBaseExample
>> >> >> >> > HBaseExample.java:20: error: cannot find symbol
>> >> >> >> >         BatchUpdate batchUpdate = new BatchUpdate("test_row1");
>> >> >> >> >                                       ^
>> >> >> >> >   symbol:   class BatchUpdate
>> >> >> >> >   location: class HBaseExample
>> >> >> >> > HBaseExample.java:25: error: cannot find symbol
>> >> >> >> >         Cell cell = table.get("test_row1",
>> >> "columnfamily1:column1");
>> >> >> >> >         ^
>> >> >> >> >   symbol:   class Cell
>> >> >> >> >   location: class HBaseExample
>> >> >> >> > HBaseExample.java:25: error: no suitable method found for
>> >> >> >> get(String,String)
>> >> >> >> >         Cell cell = table.get("test_row1",
>> >> "columnfamily1:column1");
>> >> >> >> >                          ^
>> >> >> >> >     method HTable.get(List<Get>) is not applicable
>> >> >> >> >       (actual and formal argument lists differ in length)
>> >> >> >> >     method HTable.get(Get) is not applicable
>> >> >> >> >       (actual and formal argument lists differ in length)
>> >> >> >> > HBaseExample.java:31: error: cannot find symbol
>> >> >> >> >         RowResult singleRow =
>> >> >> table.getRow(Bytes.toBytes("test_row1"));
>> >> >> >> >         ^
>> >> >> >> >   symbol:   class RowResult
>> >> >> >> >   location: class HBaseExample
>> >> >> >> > HBaseExample.java:31: error: cannot find symbol
>> >> >> >> >         RowResult singleRow =
>> >> >> table.getRow(Bytes.toBytes("test_row1"));
>> >> >> >> >                                    ^
>> >> >> >> >   symbol:   method getRow(byte[])
>> >> >> >> >   location: variable table of type HTable
>> >> >> >> > HBaseExample.java:32: error: cannot find symbol
>> >> >> >> >         Cell cell =
>> >> >> >> singleRow.get(Bytes.toBytes("columnfamily1:column1"));
>> >> >> >> >         ^
>> >> >> >> >   symbol:   class Cell
>> >> >> >> >   location: class HBaseExample
>> >> >> >> > HBaseExample.java:42: error: cannot find symbol
>> >> >> >> >         Scanner scanner = table.getScanner(
>> >> >> >> >         ^
>> >> >> >> >   symbol:   class Scanner
>> >> >> >> >   location: class HBaseExample
>> >> >> >> > HBaseExample.java:42: error: no suitable method found for
>> >> >> >> > getScanner(String[])
>> >> >> >> >         Scanner scanner = table.getScanner(
>> >> >> >> >                                ^
>> >> >> >> >     method HTable.getScanner(byte[],byte[]) is not applicable
>> >> >> >> >       (actual and formal argument lists differ in length)
>> >> >> >> >     method HTable.getScanner(byte[]) is not applicable
>> >> >> >> >       (actual argument String[] cannot be converted to byte[] by
>> >> >> method
>> >> >> >> > invocation conversion)
>> >> >> >> >     method HTable.getScanner(Scan) is not applicable
>> >> >> >> >       (actual argument String[] cannot be converted to Scan by
>> >> method
>> >> >> >> > invocation conversion)
>> >> >> >> > HBaseExample.java:46: error: cannot find symbol
>> >> >> >> >         RowResult rowResult = scanner.next();
>> >> >> >> >         ^
>> >> >> >> >   symbol:   class RowResult
>> >> >> >> >   location: class HBaseExample
>> >> >> >> > HBaseExample.java:55: error: cannot find symbol
>> >> >> >> >         for (RowResult result : scanner) {
>> >> >> >> >              ^
>> >> >> >> >   symbol:   class RowResult
>> >> >> >> >   location: class HBaseExample
>> >> >> >> > Note: HBaseExample.java uses or overrides a deprecated API.
>> >> >> >> > Note: Recompile with -Xlint:deprecation for details.
>> >> >> >> > 15 errors
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > On Thu, Apr 4, 2013 at 2:50 AM, Harsha <ha...@defun.org>
>> wrote:
>> >> >> >> >
>> >> >> >> >> Alok,
>> >> >> >> >>     run "hbase classpath" and try putting everything in it in
>> >> class
>> >> >> >> path.
>> >> >> >> >> -Harsha
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >> --
>> >> >> >> >> Harsha
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >> On Wednesday, April 3, 2013 at 9:59 AM, Andrea Gazzarini wrote:
>> >> >> >> >>
>> >> >> >> >> > I don't have my laptop with me at the momemt and honestly
>> last
>> >> >> time I
>> >> >> >> >> > ran a javac from command line it was about ten years ago but
>> my
>> >> >> >> >> > questions is : are you sure you can use wildcard this way?
>> >> >> >> >> > If I remember well, prior to JDK 1.6 you could not use
>> >> widlcards at
>> >> >> >> all,
>> >> >> >> >> > and starting from 1.6 you can use *only* wildcard, without
>> the
>> >> >> ".jar"
>> >> >> >> >> suffix
>> >> >> >> >> >
>> >> >> >> >> > Best,
>> >> >> >> >> > Andrea
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> > On 04/03/2013 06:37 PM, Alok Singh Mahor wrote:
>> >> >> >> >> > > Hi all,
>> >> >> >> >> > > today I start afresh a Example code on
>> >> >> >> >> > >
>> >> >> http://blog.rajeevsharma.in/2009/06/using-hbase-in-java-0193.html
>> >> >> >> >> > > but I guess luck is not with me.
>> >> >> >> >> > > I run
>> >> >> >> >> > > javac -classpath
>> >> >> >> >> > >
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> ~/packages/hbase-0.94.6/hbase-0.94.6.jar:~/packages/hbase-0.94.6/lib/*:~/packages/hadoop-1.1.2/*.jar:~/packages/hadoop-1.1.2/lib/*.jar
>> >> >> >> >> > > HBaseExample.java -verbose
>> >> >> >> >> > >
>> >> >> >> >> > > please tell me what else I need to add in path to resolve
>> >> these
>> >> >> >> errors
>> >> >> >> >> > >
>> >> >> >> >> > > thank you
>> >> >> >> >> > >
>> >> >> >> >> > >
>> >> >> >> >> > > alok@alok:~/exp/hbase/exp$ javac -classpath
>> >> >> >> >> > >
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> ~/packages/hbase-0.94.6/hbase-0.94.6.jar:~/packages/hbase-0.94.6/lib/*:~/packages/hadoop-1.1.2/*.jar:~/packages/hadoop-1.1.2/lib/*.jar
>> >> >> >> >> > > HBaseExample.java -verbose
>> >> >> >> >> > > [parsing started RegularFileObject[HBaseExample.java]]
>> >> >> >> >> > > [parsing completed 29ms]
>> >> >> >> >> > > [search path for source files:
>> >> >> >> >> > >
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> /home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar,~/packages/hbase-0.94.6/lib/*,~/packages/hadoop-1.1.2/*.jar,~/packages/hadoop-1.1.2/lib/*.jar]
>> >> >> >> >> > > [search path for class files:
>> >> >> >> >> > >
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> /usr/lib/jvm/java-7-openjdk-i386/jre/lib/resources.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/rt.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/sunrsasign.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jsse.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jce.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/charsets.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/netx.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/plugin.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/rhino.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jfr.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/classes,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/zipfs.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/sunjce_provider.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/sunpkcs11.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/pulse-java.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/dnsns.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/java-atk-wrapper.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/localedata.jar,/home/alok/pack
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> ages/hbase-0.94.6/hbase-0.94.6.jar,~/packages/hbase-0.94.6/lib/*,~/packages/hadoop-1.1.2/*.jar,~/packages/hadoop-1.1.2/lib/*.jar]
>> >> >> >> >> > > [loading
>> >> >> >> >> > >
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/IOException.class)]]
>> >> >> >> >> > > HBaseExample.java:2: error: package org.apache.hadoop.fs
>> does
>> >> not
>> >> >> >> exist
>> >> >> >> >> > > import org.apache.hadoop.fs.Path;
>> >> >> >> >> > > ^
>> >> >> >> >> > > [loading
>> >> >> >> >> > >
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/HBaseConfiguration.class)]]
>> >> >> >> >> > > [loading
>> >> >> >> >> > >
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/client/HTable.class)]]
>> >> >> >> >> > > HBaseExample.java:5: error: cannot find symbol
>> >> >> >> >> > > import org.apache.hadoop.hbase.client.Scanner;
>> >> >> >> >> > > ^
>> >> >> >> >> > > symbol: class Scanner
>> >> >> >> >> > > location: package org.apache.hadoop.hbase.client
>> >> >> >> >> > > HBaseExample.java:6: error: cannot find symbol
>> >> >> >> >> > > import org.apache.hadoop.hbase.io.BatchUpdate;
>> >> >> >> >> > > ^
>> >> >> >> >> > > symbol: class BatchUpdate
>> >> >> >> >> > > location: package org.apache.hadoop.hbase.io (
>> >> >> >> >> http://org.apache.hadoop.hbase.io)
>> >> >> >> >> > > HBaseExample.java:7: error: cannot find symbol
>> >> >> >> >> > > import org.apache.hadoop.hbase.io.Cell;
>> >> >> >> >> > > ^
>> >> >> >> >> > > symbol: class Cell
>> >> >> >> >> > > location: package org.apache.hadoop.hbase.io (
>> >> >> >> >> http://org.apache.hadoop.hbase.io)
>> >> >> >> >> > > HBaseExample.java:8: error: cannot find symbol
>> >> >> >> >> > > import org.apache.hadoop.hbase.io.RowResult;
>> >> >> >> >> > > ^
>> >> >> >> >> > > symbol: class RowResult
>> >> >> >> >> > > location: package org.apache.hadoop.hbase.io (
>> >> >> >> >> http://org.apache.hadoop.hbase.io)
>> >> >> >> >> > > [loading
>> >> >> >> >> > >
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/util/Bytes.class)]]
>> >> >> >> >> > > [loading
>> >> >> >> >> > >
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Object.class)]]
>> >> >> >> >> > > [loading
>> >> >> >> >> > >
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/String.class)]]
>> >> >> >> >> > > [checking HBaseExample]
>> >> >> >> >> > > [loading
>> >> >> >> >> > >
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/AutoCloseable.class)]]
>> >> >> >> >> > > [loading
>> >> >> >> >> > >
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Exception.class)]]
>> >> >> >> >> > > [loading
>> >> >> >> >> > >
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Throwable.class)]]
>> >> >> >> >> > > HBaseExample.java:16: error: cannot find symbol
>> >> >> >> >> > > conf.addResource(new
>> >> >> Path("/opt/hbase-0.19.3/conf/hbase-site.xml"));
>> >> >> >> >> > > ^
>> >> >> >> >> > > symbol: class Path
>> >> >> >> >> > > location: class HBaseExample
>> >> >> >> >> > > HBaseExample.java:16: error: cannot access Configuration
>> >> >> >> >> > > conf.addResource(new
>> >> >> Path("/opt/hbase-0.19.3/conf/hbase-site.xml"));
>> >> >> >> >> > > ^
>> >> >> >> >> > > class file for org.apache.hadoop.conf.Configuration not
>> found
>> >> >> >> >> > > HBaseExample.java:20: error: cannot find symbol
>> >> >> >> >> > > BatchUpdate batchUpdate = new BatchUpdate("test_row1");
>> >> >> >> >> > > ^
>> >> >> >> >> > > symbol: class BatchUpdate
>> >> >> >> >> > > location: class HBaseExample
>> >> >> >> >> > > HBaseExample.java:20: error: cannot find symbol
>> >> >> >> >> > > BatchUpdate batchUpdate = new BatchUpdate("test_row1");
>> >> >> >> >> > > ^
>> >> >> >> >> > > symbol: class BatchUpdate
>> >> >> >> >> > > location: class HBaseExample
>> >> >> >> >> > > [loading
>> >> >> >> >> > >
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/math/BigDecimal.class)]]
>> >> >> >> >> > > [loading
>> >> >> >> >> > >
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/nio/ByteBuffer.class)]]
>> >> >> >> >> > > HBaseExample.java:25: error: cannot find symbol
>> >> >> >> >> > > Cell cell = table.get("test_row1",
>> "columnfamily1:column1");
>> >> >> >> >> > > ^
>> >> >> >> >> > > symbol: class Cell
>> >> >> >> >> > > location: class HBaseExample
>> >> >> >> >> > > [loading
>> >> >> >> >> > >
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/util/List.class)]]
>> >> >> >> >> > > HBaseExample.java:25: error: no suitable method found for
>> >> >> >> >> get(String,String)
>> >> >> >> >> > > Cell cell = table.get("test_row1",
>> "columnfamily1:column1");
>> >> >> >> >> > > ^
>> >> >> >> >> > > method HTable.get(List<Get>) is not applicable
>> >> >> >> >> > > (actual and formal argument lists differ in length)
>> >> >> >> >> > > method HTable.get(Get) is not applicable
>> >> >> >> >> > > (actual and formal argument lists differ in length)
>> >> >> >> >> > > [loading
>> >> >> >> >> > >
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/System.class)]]
>> >> >> >> >> > > [loading
>> >> >> >> >> > >
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/PrintStream.class)]]
>> >> >> >> >> > > [loading
>> >> >> >> >> > >
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/FilterOutputStream.class)]]
>> >> >> >> >> > > [loading
>> >> >> >> >> > >
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/OutputStream.class)]]
>> >> >> >> >> > > HBaseExample.java:31: error: cannot find symbol
>> >> >> >> >> > > RowResult singleRow =
>> >> table.getRow(Bytes.toBytes("test_row1"));
>> >> >> >> >> > > ^
>> >> >> >> >> > > symbol: class RowResult
>> >> >> >> >> > > location: class HBaseExample
>> >> >> >> >> > > HBaseExample.java:31: error: cannot find symbol
>> >> >> >> >> > > RowResult singleRow =
>> >> table.getRow(Bytes.toBytes("test_row1"));
>> >> >> >> >> > > ^
>> >> >> >> >> > > symbol: method getRow(byte[])
>> >> >> >> >> > > location: variable table of type HTable
>> >> >> >> >> > > HBaseExample.java:32: error: cannot find symbol
>> >> >> >> >> > > Cell cell =
>> >> >> singleRow.get(Bytes.toBytes("columnfamily1:column1"));
>> >> >> >> >> > > ^
>> >> >> >> >> > > symbol: class Cell
>> >> >> >> >> > > location: class HBaseExample
>> >> >> >> >> > > HBaseExample.java:42: error: cannot find symbol
>> >> >> >> >> > > Scanner scanner = table.getScanner(
>> >> >> >> >> > > ^
>> >> >> >> >> > > symbol: class Scanner
>> >> >> >> >> > > location: class HBaseExample
>> >> >> >> >> > > [loading
>> >> >> >> >> > >
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/client/Scan.class)]]
>> >> >> >> >> > > HBaseExample.java:42: error: no suitable method found for
>> >> >> >> >> > > getScanner(String[])
>> >> >> >> >> > > Scanner scanner = table.getScanner(
>> >> >> >> >> > > ^
>> >> >> >> >> > > method HTable.getScanner(byte[],byte[]) is not applicable
>> >> >> >> >> > > (actual and formal argument lists differ in length)
>> >> >> >> >> > > method HTable.getScanner(byte[]) is not applicable
>> >> >> >> >> > > (actual argument String[] cannot be converted to byte[] by
>> >> method
>> >> >> >> >> > > invocation conversion)
>> >> >> >> >> > > method HTable.getScanner(Scan) is not applicable
>> >> >> >> >> > > (actual argument String[] cannot be converted to Scan by
>> >> method
>> >> >> >> >> > > invocation conversion)
>> >> >> >> >> > > HBaseExample.java:46: error: cannot find symbol
>> >> >> >> >> > > RowResult rowResult = scanner.next();
>> >> >> >> >> > > ^
>> >> >> >> >> > > symbol: class RowResult
>> >> >> >> >> > > location: class HBaseExample
>> >> >> >> >> > > HBaseExample.java:55: error: cannot find symbol
>> >> >> >> >> > > for (RowResult result : scanner) {
>> >> >> >> >> > > ^
>> >> >> >> >> > > symbol: class RowResult
>> >> >> >> >> > > location: class HBaseExample
>> >> >> >> >> > > [total 461ms]
>> >> >> >> >> > > Note: HBaseExample.java uses or overrides a deprecated API.
>> >> >> >> >> > > Note: Recompile with -Xlint:deprecation for details.
>> >> >> >> >> > > 18 errors
>> >> >> >> >> > >
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>>

Re: connecting Hbase using java

Posted by Alok Singh Mahor <al...@gmail.com>.
yes thank you so much jean, I will switch to eclipse.

now I tried with (java -classpath `~/packages/hbase-0.94.6/bin/hbase
classpath` MyLittleHBaseClient)

code is running but I guess now I have some problem with my hbase and hadoop

I am getting output that you can see at http://paste.ubuntu.com/5676866/
could you please figure out where things are wrong now?
thanks again, your reply are helping me learning basic things.



On Thu, Apr 4, 2013 at 8:11 PM, Jean-Marc Spaggiari <jean-marc@spaggiari.org
> wrote:

> 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 <al...@gmail.com>:
> > 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 <
> jean-marc@spaggiari.org
> >> wrote:
> >
> >> org.apache.hadoop.conf.Configuration is missing from the imports...
> >>
> >> 2013/4/4 Alok Singh Mahor <al...@gmail.com>:
> >> > 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 <
> >> jean-marc@spaggiari.org
> >> >> 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 <al...@gmail.com>:
> >> >> > 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/jaxb-api-2.1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jaxb-impl-2.2.3-1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jersey-core-1.8.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jersey-json-1.8.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jersey-server-1.8.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jettison-1.1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jetty-6.1.26.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jetty-util-6.1.26.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jruby-complete-1.6.5.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jsp-2.1-6.1.14.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jsp-api-2.1-6.1.14.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jsr305-1.3.9.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/junit-4.10-HBASE-1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/libthrift-0.8.0.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/log4j-1.2.16.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/metrics-core-2.1.2.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/netty-3.2.4.Final.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/protobuf-java-2.4.0a.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/servlet-api-2.5-6.1.14.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/slf4j-api-1.4.3.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/slf4j-log4j12-1.4.3.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/snappy-java-1.0.3.2.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/stax-api-1.0.1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/velocity-1.7.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/xmlenc-0.52.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/zookeeper-3.4.5.jar:
> >> >> >
> >> >> >
> >> >> >
> >> >> > On Thu, Apr 4, 2013 at 5:54 AM, Jean-Marc Spaggiari <
> >> >> jean-marc@spaggiari.org
> >> >> >> wrote:
> >> >> >
> >> >> >> What's the output of ~/packages/hbase-0.94.6/bin/hbase classpath?
> >> >> >>
> >> >> >> 2013/4/3 Alok Singh Mahor <al...@gmail.com>:
> >> >> >> > thank you Harsha
> >> >> >> > with your advice I used command to compile that example code
> >> >> >> > alok@alok:~/exp/hbase/exp$ javac -classpath
> >> >> >> > `~/packages/hbase-0.94.6/bin/hbase classpath` HBaseExample.java
> >> >> >> >
> >> >> >> > so errors reduced to 15 from 18
> >> >> >> > could you please what else I have to add
> >> >> >> >
> >> >> >> > please see the error
> >> >> >> >
> >> >> >> > alok@alok:~/exp/hbase/exp$ javac -classpath
> >> >> >> > `~/packages/hbase-0.94.6/bin/hbase classpath` HBaseExample.java
> >> >> >> > HBaseExample.java:5: error: cannot find symbol
> >> >> >> > import org.apache.hadoop.hbase.client.Scanner;
> >> >> >> >                                      ^
> >> >> >> >   symbol:   class Scanner
> >> >> >> >   location: package org.apache.hadoop.hbase.client
> >> >> >> > HBaseExample.java:6: error: cannot find symbol
> >> >> >> > import org.apache.hadoop.hbase.io.BatchUpdate;
> >> >> >> >                                  ^
> >> >> >> >   symbol:   class BatchUpdate
> >> >> >> >   location: package org.apache.hadoop.hbase.io
> >> >> >> > HBaseExample.java:7: error: cannot find symbol
> >> >> >> > import org.apache.hadoop.hbase.io.Cell;
> >> >> >> >                                  ^
> >> >> >> >   symbol:   class Cell
> >> >> >> >   location: package org.apache.hadoop.hbase.io
> >> >> >> > HBaseExample.java:8: error: cannot find symbol
> >> >> >> > import org.apache.hadoop.hbase.io.RowResult;
> >> >> >> >                                  ^
> >> >> >> >   symbol:   class RowResult
> >> >> >> >   location: package org.apache.hadoop.hbase.io
> >> >> >> > HBaseExample.java:20: error: cannot find symbol
> >> >> >> >         BatchUpdate batchUpdate = new BatchUpdate("test_row1");
> >> >> >> >         ^
> >> >> >> >   symbol:   class BatchUpdate
> >> >> >> >   location: class HBaseExample
> >> >> >> > HBaseExample.java:20: error: cannot find symbol
> >> >> >> >         BatchUpdate batchUpdate = new BatchUpdate("test_row1");
> >> >> >> >                                       ^
> >> >> >> >   symbol:   class BatchUpdate
> >> >> >> >   location: class HBaseExample
> >> >> >> > HBaseExample.java:25: error: cannot find symbol
> >> >> >> >         Cell cell = table.get("test_row1",
> >> "columnfamily1:column1");
> >> >> >> >         ^
> >> >> >> >   symbol:   class Cell
> >> >> >> >   location: class HBaseExample
> >> >> >> > HBaseExample.java:25: error: no suitable method found for
> >> >> >> get(String,String)
> >> >> >> >         Cell cell = table.get("test_row1",
> >> "columnfamily1:column1");
> >> >> >> >                          ^
> >> >> >> >     method HTable.get(List<Get>) is not applicable
> >> >> >> >       (actual and formal argument lists differ in length)
> >> >> >> >     method HTable.get(Get) is not applicable
> >> >> >> >       (actual and formal argument lists differ in length)
> >> >> >> > HBaseExample.java:31: error: cannot find symbol
> >> >> >> >         RowResult singleRow =
> >> >> table.getRow(Bytes.toBytes("test_row1"));
> >> >> >> >         ^
> >> >> >> >   symbol:   class RowResult
> >> >> >> >   location: class HBaseExample
> >> >> >> > HBaseExample.java:31: error: cannot find symbol
> >> >> >> >         RowResult singleRow =
> >> >> table.getRow(Bytes.toBytes("test_row1"));
> >> >> >> >                                    ^
> >> >> >> >   symbol:   method getRow(byte[])
> >> >> >> >   location: variable table of type HTable
> >> >> >> > HBaseExample.java:32: error: cannot find symbol
> >> >> >> >         Cell cell =
> >> >> >> singleRow.get(Bytes.toBytes("columnfamily1:column1"));
> >> >> >> >         ^
> >> >> >> >   symbol:   class Cell
> >> >> >> >   location: class HBaseExample
> >> >> >> > HBaseExample.java:42: error: cannot find symbol
> >> >> >> >         Scanner scanner = table.getScanner(
> >> >> >> >         ^
> >> >> >> >   symbol:   class Scanner
> >> >> >> >   location: class HBaseExample
> >> >> >> > HBaseExample.java:42: error: no suitable method found for
> >> >> >> > getScanner(String[])
> >> >> >> >         Scanner scanner = table.getScanner(
> >> >> >> >                                ^
> >> >> >> >     method HTable.getScanner(byte[],byte[]) is not applicable
> >> >> >> >       (actual and formal argument lists differ in length)
> >> >> >> >     method HTable.getScanner(byte[]) is not applicable
> >> >> >> >       (actual argument String[] cannot be converted to byte[] by
> >> >> method
> >> >> >> > invocation conversion)
> >> >> >> >     method HTable.getScanner(Scan) is not applicable
> >> >> >> >       (actual argument String[] cannot be converted to Scan by
> >> method
> >> >> >> > invocation conversion)
> >> >> >> > HBaseExample.java:46: error: cannot find symbol
> >> >> >> >         RowResult rowResult = scanner.next();
> >> >> >> >         ^
> >> >> >> >   symbol:   class RowResult
> >> >> >> >   location: class HBaseExample
> >> >> >> > HBaseExample.java:55: error: cannot find symbol
> >> >> >> >         for (RowResult result : scanner) {
> >> >> >> >              ^
> >> >> >> >   symbol:   class RowResult
> >> >> >> >   location: class HBaseExample
> >> >> >> > Note: HBaseExample.java uses or overrides a deprecated API.
> >> >> >> > Note: Recompile with -Xlint:deprecation for details.
> >> >> >> > 15 errors
> >> >> >> >
> >> >> >> >
> >> >> >> > On Thu, Apr 4, 2013 at 2:50 AM, Harsha <ha...@defun.org>
> wrote:
> >> >> >> >
> >> >> >> >> Alok,
> >> >> >> >>     run "hbase classpath" and try putting everything in it in
> >> class
> >> >> >> path.
> >> >> >> >> -Harsha
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> --
> >> >> >> >> Harsha
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> On Wednesday, April 3, 2013 at 9:59 AM, Andrea Gazzarini wrote:
> >> >> >> >>
> >> >> >> >> > I don't have my laptop with me at the momemt and honestly
> last
> >> >> time I
> >> >> >> >> > ran a javac from command line it was about ten years ago but
> my
> >> >> >> >> > questions is : are you sure you can use wildcard this way?
> >> >> >> >> > If I remember well, prior to JDK 1.6 you could not use
> >> widlcards at
> >> >> >> all,
> >> >> >> >> > and starting from 1.6 you can use *only* wildcard, without
> the
> >> >> ".jar"
> >> >> >> >> suffix
> >> >> >> >> >
> >> >> >> >> > Best,
> >> >> >> >> > Andrea
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> > On 04/03/2013 06:37 PM, Alok Singh Mahor wrote:
> >> >> >> >> > > Hi all,
> >> >> >> >> > > today I start afresh a Example code on
> >> >> >> >> > >
> >> >> http://blog.rajeevsharma.in/2009/06/using-hbase-in-java-0193.html
> >> >> >> >> > > but I guess luck is not with me.
> >> >> >> >> > > I run
> >> >> >> >> > > javac -classpath
> >> >> >> >> > >
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> ~/packages/hbase-0.94.6/hbase-0.94.6.jar:~/packages/hbase-0.94.6/lib/*:~/packages/hadoop-1.1.2/*.jar:~/packages/hadoop-1.1.2/lib/*.jar
> >> >> >> >> > > HBaseExample.java -verbose
> >> >> >> >> > >
> >> >> >> >> > > please tell me what else I need to add in path to resolve
> >> these
> >> >> >> errors
> >> >> >> >> > >
> >> >> >> >> > > thank you
> >> >> >> >> > >
> >> >> >> >> > >
> >> >> >> >> > > alok@alok:~/exp/hbase/exp$ javac -classpath
> >> >> >> >> > >
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> ~/packages/hbase-0.94.6/hbase-0.94.6.jar:~/packages/hbase-0.94.6/lib/*:~/packages/hadoop-1.1.2/*.jar:~/packages/hadoop-1.1.2/lib/*.jar
> >> >> >> >> > > HBaseExample.java -verbose
> >> >> >> >> > > [parsing started RegularFileObject[HBaseExample.java]]
> >> >> >> >> > > [parsing completed 29ms]
> >> >> >> >> > > [search path for source files:
> >> >> >> >> > >
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> /home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar,~/packages/hbase-0.94.6/lib/*,~/packages/hadoop-1.1.2/*.jar,~/packages/hadoop-1.1.2/lib/*.jar]
> >> >> >> >> > > [search path for class files:
> >> >> >> >> > >
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> /usr/lib/jvm/java-7-openjdk-i386/jre/lib/resources.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/rt.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/sunrsasign.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jsse.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jce.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/charsets.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/netx.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/plugin.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/rhino.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jfr.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/classes,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/zipfs.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/sunjce_provider.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/sunpkcs11.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/pulse-java.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/dnsns.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/java-atk-wrapper.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/localedata.jar,/home/alok/pack
> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> ages/hbase-0.94.6/hbase-0.94.6.jar,~/packages/hbase-0.94.6/lib/*,~/packages/hadoop-1.1.2/*.jar,~/packages/hadoop-1.1.2/lib/*.jar]
> >> >> >> >> > > [loading
> >> >> >> >> > >
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/IOException.class)]]
> >> >> >> >> > > HBaseExample.java:2: error: package org.apache.hadoop.fs
> does
> >> not
> >> >> >> exist
> >> >> >> >> > > import org.apache.hadoop.fs.Path;
> >> >> >> >> > > ^
> >> >> >> >> > > [loading
> >> >> >> >> > >
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/HBaseConfiguration.class)]]
> >> >> >> >> > > [loading
> >> >> >> >> > >
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/client/HTable.class)]]
> >> >> >> >> > > HBaseExample.java:5: error: cannot find symbol
> >> >> >> >> > > import org.apache.hadoop.hbase.client.Scanner;
> >> >> >> >> > > ^
> >> >> >> >> > > symbol: class Scanner
> >> >> >> >> > > location: package org.apache.hadoop.hbase.client
> >> >> >> >> > > HBaseExample.java:6: error: cannot find symbol
> >> >> >> >> > > import org.apache.hadoop.hbase.io.BatchUpdate;
> >> >> >> >> > > ^
> >> >> >> >> > > symbol: class BatchUpdate
> >> >> >> >> > > location: package org.apache.hadoop.hbase.io (
> >> >> >> >> http://org.apache.hadoop.hbase.io)
> >> >> >> >> > > HBaseExample.java:7: error: cannot find symbol
> >> >> >> >> > > import org.apache.hadoop.hbase.io.Cell;
> >> >> >> >> > > ^
> >> >> >> >> > > symbol: class Cell
> >> >> >> >> > > location: package org.apache.hadoop.hbase.io (
> >> >> >> >> http://org.apache.hadoop.hbase.io)
> >> >> >> >> > > HBaseExample.java:8: error: cannot find symbol
> >> >> >> >> > > import org.apache.hadoop.hbase.io.RowResult;
> >> >> >> >> > > ^
> >> >> >> >> > > symbol: class RowResult
> >> >> >> >> > > location: package org.apache.hadoop.hbase.io (
> >> >> >> >> http://org.apache.hadoop.hbase.io)
> >> >> >> >> > > [loading
> >> >> >> >> > >
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/util/Bytes.class)]]
> >> >> >> >> > > [loading
> >> >> >> >> > >
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Object.class)]]
> >> >> >> >> > > [loading
> >> >> >> >> > >
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/String.class)]]
> >> >> >> >> > > [checking HBaseExample]
> >> >> >> >> > > [loading
> >> >> >> >> > >
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/AutoCloseable.class)]]
> >> >> >> >> > > [loading
> >> >> >> >> > >
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Exception.class)]]
> >> >> >> >> > > [loading
> >> >> >> >> > >
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Throwable.class)]]
> >> >> >> >> > > HBaseExample.java:16: error: cannot find symbol
> >> >> >> >> > > conf.addResource(new
> >> >> Path("/opt/hbase-0.19.3/conf/hbase-site.xml"));
> >> >> >> >> > > ^
> >> >> >> >> > > symbol: class Path
> >> >> >> >> > > location: class HBaseExample
> >> >> >> >> > > HBaseExample.java:16: error: cannot access Configuration
> >> >> >> >> > > conf.addResource(new
> >> >> Path("/opt/hbase-0.19.3/conf/hbase-site.xml"));
> >> >> >> >> > > ^
> >> >> >> >> > > class file for org.apache.hadoop.conf.Configuration not
> found
> >> >> >> >> > > HBaseExample.java:20: error: cannot find symbol
> >> >> >> >> > > BatchUpdate batchUpdate = new BatchUpdate("test_row1");
> >> >> >> >> > > ^
> >> >> >> >> > > symbol: class BatchUpdate
> >> >> >> >> > > location: class HBaseExample
> >> >> >> >> > > HBaseExample.java:20: error: cannot find symbol
> >> >> >> >> > > BatchUpdate batchUpdate = new BatchUpdate("test_row1");
> >> >> >> >> > > ^
> >> >> >> >> > > symbol: class BatchUpdate
> >> >> >> >> > > location: class HBaseExample
> >> >> >> >> > > [loading
> >> >> >> >> > >
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/math/BigDecimal.class)]]
> >> >> >> >> > > [loading
> >> >> >> >> > >
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/nio/ByteBuffer.class)]]
> >> >> >> >> > > HBaseExample.java:25: error: cannot find symbol
> >> >> >> >> > > Cell cell = table.get("test_row1",
> "columnfamily1:column1");
> >> >> >> >> > > ^
> >> >> >> >> > > symbol: class Cell
> >> >> >> >> > > location: class HBaseExample
> >> >> >> >> > > [loading
> >> >> >> >> > >
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/util/List.class)]]
> >> >> >> >> > > HBaseExample.java:25: error: no suitable method found for
> >> >> >> >> get(String,String)
> >> >> >> >> > > Cell cell = table.get("test_row1",
> "columnfamily1:column1");
> >> >> >> >> > > ^
> >> >> >> >> > > method HTable.get(List<Get>) is not applicable
> >> >> >> >> > > (actual and formal argument lists differ in length)
> >> >> >> >> > > method HTable.get(Get) is not applicable
> >> >> >> >> > > (actual and formal argument lists differ in length)
> >> >> >> >> > > [loading
> >> >> >> >> > >
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/System.class)]]
> >> >> >> >> > > [loading
> >> >> >> >> > >
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/PrintStream.class)]]
> >> >> >> >> > > [loading
> >> >> >> >> > >
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/FilterOutputStream.class)]]
> >> >> >> >> > > [loading
> >> >> >> >> > >
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/OutputStream.class)]]
> >> >> >> >> > > HBaseExample.java:31: error: cannot find symbol
> >> >> >> >> > > RowResult singleRow =
> >> table.getRow(Bytes.toBytes("test_row1"));
> >> >> >> >> > > ^
> >> >> >> >> > > symbol: class RowResult
> >> >> >> >> > > location: class HBaseExample
> >> >> >> >> > > HBaseExample.java:31: error: cannot find symbol
> >> >> >> >> > > RowResult singleRow =
> >> table.getRow(Bytes.toBytes("test_row1"));
> >> >> >> >> > > ^
> >> >> >> >> > > symbol: method getRow(byte[])
> >> >> >> >> > > location: variable table of type HTable
> >> >> >> >> > > HBaseExample.java:32: error: cannot find symbol
> >> >> >> >> > > Cell cell =
> >> >> singleRow.get(Bytes.toBytes("columnfamily1:column1"));
> >> >> >> >> > > ^
> >> >> >> >> > > symbol: class Cell
> >> >> >> >> > > location: class HBaseExample
> >> >> >> >> > > HBaseExample.java:42: error: cannot find symbol
> >> >> >> >> > > Scanner scanner = table.getScanner(
> >> >> >> >> > > ^
> >> >> >> >> > > symbol: class Scanner
> >> >> >> >> > > location: class HBaseExample
> >> >> >> >> > > [loading
> >> >> >> >> > >
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/client/Scan.class)]]
> >> >> >> >> > > HBaseExample.java:42: error: no suitable method found for
> >> >> >> >> > > getScanner(String[])
> >> >> >> >> > > Scanner scanner = table.getScanner(
> >> >> >> >> > > ^
> >> >> >> >> > > method HTable.getScanner(byte[],byte[]) is not applicable
> >> >> >> >> > > (actual and formal argument lists differ in length)
> >> >> >> >> > > method HTable.getScanner(byte[]) is not applicable
> >> >> >> >> > > (actual argument String[] cannot be converted to byte[] by
> >> method
> >> >> >> >> > > invocation conversion)
> >> >> >> >> > > method HTable.getScanner(Scan) is not applicable
> >> >> >> >> > > (actual argument String[] cannot be converted to Scan by
> >> method
> >> >> >> >> > > invocation conversion)
> >> >> >> >> > > HBaseExample.java:46: error: cannot find symbol
> >> >> >> >> > > RowResult rowResult = scanner.next();
> >> >> >> >> > > ^
> >> >> >> >> > > symbol: class RowResult
> >> >> >> >> > > location: class HBaseExample
> >> >> >> >> > > HBaseExample.java:55: error: cannot find symbol
> >> >> >> >> > > for (RowResult result : scanner) {
> >> >> >> >> > > ^
> >> >> >> >> > > symbol: class RowResult
> >> >> >> >> > > location: class HBaseExample
> >> >> >> >> > > [total 461ms]
> >> >> >> >> > > Note: HBaseExample.java uses or overrides a deprecated API.
> >> >> >> >> > > Note: Recompile with -Xlint:deprecation for details.
> >> >> >> >> > > 18 errors
> >> >> >> >> > >
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >>
> >>
>

Re: connecting Hbase using java

Posted by Jean-Marc Spaggiari <je...@spaggiari.org>.
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 <al...@gmail.com>:
> 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 <jean-marc@spaggiari.org
>> wrote:
>
>> org.apache.hadoop.conf.Configuration is missing from the imports...
>>
>> 2013/4/4 Alok Singh Mahor <al...@gmail.com>:
>> > 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 <
>> jean-marc@spaggiari.org
>> >> 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 <al...@gmail.com>:
>> >> > 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/jaxb-api-2.1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jaxb-impl-2.2.3-1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jersey-core-1.8.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jersey-json-1.8.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jersey-server-1.8.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jettison-1.1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jetty-6.1.26.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jetty-util-6.1.26.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jruby-complete-1.6.5.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jsp-2.1-6.1.14.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jsp-api-2.1-6.1.14.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jsr305-1.3.9.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/junit-4.10-HBASE-1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/libthrift-0.8.0.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/log4j-1.2.16.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/metrics-core-2.1.2.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/netty-3.2.4.Final.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/protobuf-java-2.4.0a.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/servlet-api-2.5-6.1.14.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/slf4j-api-1.4.3.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/slf4j-log4j12-1.4.3.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/snappy-java-1.0.3.2.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/stax-api-1.0.1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/velocity-1.7.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/xmlenc-0.52.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/zookeeper-3.4.5.jar:
>> >> >
>> >> >
>> >> >
>> >> > On Thu, Apr 4, 2013 at 5:54 AM, Jean-Marc Spaggiari <
>> >> jean-marc@spaggiari.org
>> >> >> wrote:
>> >> >
>> >> >> What's the output of ~/packages/hbase-0.94.6/bin/hbase classpath?
>> >> >>
>> >> >> 2013/4/3 Alok Singh Mahor <al...@gmail.com>:
>> >> >> > thank you Harsha
>> >> >> > with your advice I used command to compile that example code
>> >> >> > alok@alok:~/exp/hbase/exp$ javac -classpath
>> >> >> > `~/packages/hbase-0.94.6/bin/hbase classpath` HBaseExample.java
>> >> >> >
>> >> >> > so errors reduced to 15 from 18
>> >> >> > could you please what else I have to add
>> >> >> >
>> >> >> > please see the error
>> >> >> >
>> >> >> > alok@alok:~/exp/hbase/exp$ javac -classpath
>> >> >> > `~/packages/hbase-0.94.6/bin/hbase classpath` HBaseExample.java
>> >> >> > HBaseExample.java:5: error: cannot find symbol
>> >> >> > import org.apache.hadoop.hbase.client.Scanner;
>> >> >> >                                      ^
>> >> >> >   symbol:   class Scanner
>> >> >> >   location: package org.apache.hadoop.hbase.client
>> >> >> > HBaseExample.java:6: error: cannot find symbol
>> >> >> > import org.apache.hadoop.hbase.io.BatchUpdate;
>> >> >> >                                  ^
>> >> >> >   symbol:   class BatchUpdate
>> >> >> >   location: package org.apache.hadoop.hbase.io
>> >> >> > HBaseExample.java:7: error: cannot find symbol
>> >> >> > import org.apache.hadoop.hbase.io.Cell;
>> >> >> >                                  ^
>> >> >> >   symbol:   class Cell
>> >> >> >   location: package org.apache.hadoop.hbase.io
>> >> >> > HBaseExample.java:8: error: cannot find symbol
>> >> >> > import org.apache.hadoop.hbase.io.RowResult;
>> >> >> >                                  ^
>> >> >> >   symbol:   class RowResult
>> >> >> >   location: package org.apache.hadoop.hbase.io
>> >> >> > HBaseExample.java:20: error: cannot find symbol
>> >> >> >         BatchUpdate batchUpdate = new BatchUpdate("test_row1");
>> >> >> >         ^
>> >> >> >   symbol:   class BatchUpdate
>> >> >> >   location: class HBaseExample
>> >> >> > HBaseExample.java:20: error: cannot find symbol
>> >> >> >         BatchUpdate batchUpdate = new BatchUpdate("test_row1");
>> >> >> >                                       ^
>> >> >> >   symbol:   class BatchUpdate
>> >> >> >   location: class HBaseExample
>> >> >> > HBaseExample.java:25: error: cannot find symbol
>> >> >> >         Cell cell = table.get("test_row1",
>> "columnfamily1:column1");
>> >> >> >         ^
>> >> >> >   symbol:   class Cell
>> >> >> >   location: class HBaseExample
>> >> >> > HBaseExample.java:25: error: no suitable method found for
>> >> >> get(String,String)
>> >> >> >         Cell cell = table.get("test_row1",
>> "columnfamily1:column1");
>> >> >> >                          ^
>> >> >> >     method HTable.get(List<Get>) is not applicable
>> >> >> >       (actual and formal argument lists differ in length)
>> >> >> >     method HTable.get(Get) is not applicable
>> >> >> >       (actual and formal argument lists differ in length)
>> >> >> > HBaseExample.java:31: error: cannot find symbol
>> >> >> >         RowResult singleRow =
>> >> table.getRow(Bytes.toBytes("test_row1"));
>> >> >> >         ^
>> >> >> >   symbol:   class RowResult
>> >> >> >   location: class HBaseExample
>> >> >> > HBaseExample.java:31: error: cannot find symbol
>> >> >> >         RowResult singleRow =
>> >> table.getRow(Bytes.toBytes("test_row1"));
>> >> >> >                                    ^
>> >> >> >   symbol:   method getRow(byte[])
>> >> >> >   location: variable table of type HTable
>> >> >> > HBaseExample.java:32: error: cannot find symbol
>> >> >> >         Cell cell =
>> >> >> singleRow.get(Bytes.toBytes("columnfamily1:column1"));
>> >> >> >         ^
>> >> >> >   symbol:   class Cell
>> >> >> >   location: class HBaseExample
>> >> >> > HBaseExample.java:42: error: cannot find symbol
>> >> >> >         Scanner scanner = table.getScanner(
>> >> >> >         ^
>> >> >> >   symbol:   class Scanner
>> >> >> >   location: class HBaseExample
>> >> >> > HBaseExample.java:42: error: no suitable method found for
>> >> >> > getScanner(String[])
>> >> >> >         Scanner scanner = table.getScanner(
>> >> >> >                                ^
>> >> >> >     method HTable.getScanner(byte[],byte[]) is not applicable
>> >> >> >       (actual and formal argument lists differ in length)
>> >> >> >     method HTable.getScanner(byte[]) is not applicable
>> >> >> >       (actual argument String[] cannot be converted to byte[] by
>> >> method
>> >> >> > invocation conversion)
>> >> >> >     method HTable.getScanner(Scan) is not applicable
>> >> >> >       (actual argument String[] cannot be converted to Scan by
>> method
>> >> >> > invocation conversion)
>> >> >> > HBaseExample.java:46: error: cannot find symbol
>> >> >> >         RowResult rowResult = scanner.next();
>> >> >> >         ^
>> >> >> >   symbol:   class RowResult
>> >> >> >   location: class HBaseExample
>> >> >> > HBaseExample.java:55: error: cannot find symbol
>> >> >> >         for (RowResult result : scanner) {
>> >> >> >              ^
>> >> >> >   symbol:   class RowResult
>> >> >> >   location: class HBaseExample
>> >> >> > Note: HBaseExample.java uses or overrides a deprecated API.
>> >> >> > Note: Recompile with -Xlint:deprecation for details.
>> >> >> > 15 errors
>> >> >> >
>> >> >> >
>> >> >> > On Thu, Apr 4, 2013 at 2:50 AM, Harsha <ha...@defun.org> wrote:
>> >> >> >
>> >> >> >> Alok,
>> >> >> >>     run "hbase classpath" and try putting everything in it in
>> class
>> >> >> path.
>> >> >> >> -Harsha
>> >> >> >>
>> >> >> >>
>> >> >> >> --
>> >> >> >> Harsha
>> >> >> >>
>> >> >> >>
>> >> >> >> On Wednesday, April 3, 2013 at 9:59 AM, Andrea Gazzarini wrote:
>> >> >> >>
>> >> >> >> > I don't have my laptop with me at the momemt and honestly last
>> >> time I
>> >> >> >> > ran a javac from command line it was about ten years ago but my
>> >> >> >> > questions is : are you sure you can use wildcard this way?
>> >> >> >> > If I remember well, prior to JDK 1.6 you could not use
>> widlcards at
>> >> >> all,
>> >> >> >> > and starting from 1.6 you can use *only* wildcard, without the
>> >> ".jar"
>> >> >> >> suffix
>> >> >> >> >
>> >> >> >> > Best,
>> >> >> >> > Andrea
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > On 04/03/2013 06:37 PM, Alok Singh Mahor wrote:
>> >> >> >> > > Hi all,
>> >> >> >> > > today I start afresh a Example code on
>> >> >> >> > >
>> >> http://blog.rajeevsharma.in/2009/06/using-hbase-in-java-0193.html
>> >> >> >> > > but I guess luck is not with me.
>> >> >> >> > > I run
>> >> >> >> > > javac -classpath
>> >> >> >> > >
>> >> >> >>
>> >> >>
>> >>
>> ~/packages/hbase-0.94.6/hbase-0.94.6.jar:~/packages/hbase-0.94.6/lib/*:~/packages/hadoop-1.1.2/*.jar:~/packages/hadoop-1.1.2/lib/*.jar
>> >> >> >> > > HBaseExample.java -verbose
>> >> >> >> > >
>> >> >> >> > > please tell me what else I need to add in path to resolve
>> these
>> >> >> errors
>> >> >> >> > >
>> >> >> >> > > thank you
>> >> >> >> > >
>> >> >> >> > >
>> >> >> >> > > alok@alok:~/exp/hbase/exp$ javac -classpath
>> >> >> >> > >
>> >> >> >>
>> >> >>
>> >>
>> ~/packages/hbase-0.94.6/hbase-0.94.6.jar:~/packages/hbase-0.94.6/lib/*:~/packages/hadoop-1.1.2/*.jar:~/packages/hadoop-1.1.2/lib/*.jar
>> >> >> >> > > HBaseExample.java -verbose
>> >> >> >> > > [parsing started RegularFileObject[HBaseExample.java]]
>> >> >> >> > > [parsing completed 29ms]
>> >> >> >> > > [search path for source files:
>> >> >> >> > >
>> >> >> >>
>> >> >>
>> >>
>> /home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar,~/packages/hbase-0.94.6/lib/*,~/packages/hadoop-1.1.2/*.jar,~/packages/hadoop-1.1.2/lib/*.jar]
>> >> >> >> > > [search path for class files:
>> >> >> >> > >
>> >> >> >>
>> >> >>
>> >>
>> /usr/lib/jvm/java-7-openjdk-i386/jre/lib/resources.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/rt.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/sunrsasign.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jsse.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jce.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/charsets.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/netx.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/plugin.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/rhino.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jfr.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/classes,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/zipfs.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/sunjce_provider.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/sunpkcs11.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/pulse-java.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/dnsns.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/java-atk-wrapper.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/localedata.jar,/home/alok/pack
>> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> ages/hbase-0.94.6/hbase-0.94.6.jar,~/packages/hbase-0.94.6/lib/*,~/packages/hadoop-1.1.2/*.jar,~/packages/hadoop-1.1.2/lib/*.jar]
>> >> >> >> > > [loading
>> >> >> >> > >
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/IOException.class)]]
>> >> >> >> > > HBaseExample.java:2: error: package org.apache.hadoop.fs does
>> not
>> >> >> exist
>> >> >> >> > > import org.apache.hadoop.fs.Path;
>> >> >> >> > > ^
>> >> >> >> > > [loading
>> >> >> >> > >
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/HBaseConfiguration.class)]]
>> >> >> >> > > [loading
>> >> >> >> > >
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/client/HTable.class)]]
>> >> >> >> > > HBaseExample.java:5: error: cannot find symbol
>> >> >> >> > > import org.apache.hadoop.hbase.client.Scanner;
>> >> >> >> > > ^
>> >> >> >> > > symbol: class Scanner
>> >> >> >> > > location: package org.apache.hadoop.hbase.client
>> >> >> >> > > HBaseExample.java:6: error: cannot find symbol
>> >> >> >> > > import org.apache.hadoop.hbase.io.BatchUpdate;
>> >> >> >> > > ^
>> >> >> >> > > symbol: class BatchUpdate
>> >> >> >> > > location: package org.apache.hadoop.hbase.io (
>> >> >> >> http://org.apache.hadoop.hbase.io)
>> >> >> >> > > HBaseExample.java:7: error: cannot find symbol
>> >> >> >> > > import org.apache.hadoop.hbase.io.Cell;
>> >> >> >> > > ^
>> >> >> >> > > symbol: class Cell
>> >> >> >> > > location: package org.apache.hadoop.hbase.io (
>> >> >> >> http://org.apache.hadoop.hbase.io)
>> >> >> >> > > HBaseExample.java:8: error: cannot find symbol
>> >> >> >> > > import org.apache.hadoop.hbase.io.RowResult;
>> >> >> >> > > ^
>> >> >> >> > > symbol: class RowResult
>> >> >> >> > > location: package org.apache.hadoop.hbase.io (
>> >> >> >> http://org.apache.hadoop.hbase.io)
>> >> >> >> > > [loading
>> >> >> >> > >
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/util/Bytes.class)]]
>> >> >> >> > > [loading
>> >> >> >> > >
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Object.class)]]
>> >> >> >> > > [loading
>> >> >> >> > >
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/String.class)]]
>> >> >> >> > > [checking HBaseExample]
>> >> >> >> > > [loading
>> >> >> >> > >
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/AutoCloseable.class)]]
>> >> >> >> > > [loading
>> >> >> >> > >
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Exception.class)]]
>> >> >> >> > > [loading
>> >> >> >> > >
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Throwable.class)]]
>> >> >> >> > > HBaseExample.java:16: error: cannot find symbol
>> >> >> >> > > conf.addResource(new
>> >> Path("/opt/hbase-0.19.3/conf/hbase-site.xml"));
>> >> >> >> > > ^
>> >> >> >> > > symbol: class Path
>> >> >> >> > > location: class HBaseExample
>> >> >> >> > > HBaseExample.java:16: error: cannot access Configuration
>> >> >> >> > > conf.addResource(new
>> >> Path("/opt/hbase-0.19.3/conf/hbase-site.xml"));
>> >> >> >> > > ^
>> >> >> >> > > class file for org.apache.hadoop.conf.Configuration not found
>> >> >> >> > > HBaseExample.java:20: error: cannot find symbol
>> >> >> >> > > BatchUpdate batchUpdate = new BatchUpdate("test_row1");
>> >> >> >> > > ^
>> >> >> >> > > symbol: class BatchUpdate
>> >> >> >> > > location: class HBaseExample
>> >> >> >> > > HBaseExample.java:20: error: cannot find symbol
>> >> >> >> > > BatchUpdate batchUpdate = new BatchUpdate("test_row1");
>> >> >> >> > > ^
>> >> >> >> > > symbol: class BatchUpdate
>> >> >> >> > > location: class HBaseExample
>> >> >> >> > > [loading
>> >> >> >> > >
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/math/BigDecimal.class)]]
>> >> >> >> > > [loading
>> >> >> >> > >
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/nio/ByteBuffer.class)]]
>> >> >> >> > > HBaseExample.java:25: error: cannot find symbol
>> >> >> >> > > Cell cell = table.get("test_row1", "columnfamily1:column1");
>> >> >> >> > > ^
>> >> >> >> > > symbol: class Cell
>> >> >> >> > > location: class HBaseExample
>> >> >> >> > > [loading
>> >> >> >> > >
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/util/List.class)]]
>> >> >> >> > > HBaseExample.java:25: error: no suitable method found for
>> >> >> >> get(String,String)
>> >> >> >> > > Cell cell = table.get("test_row1", "columnfamily1:column1");
>> >> >> >> > > ^
>> >> >> >> > > method HTable.get(List<Get>) is not applicable
>> >> >> >> > > (actual and formal argument lists differ in length)
>> >> >> >> > > method HTable.get(Get) is not applicable
>> >> >> >> > > (actual and formal argument lists differ in length)
>> >> >> >> > > [loading
>> >> >> >> > >
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/System.class)]]
>> >> >> >> > > [loading
>> >> >> >> > >
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/PrintStream.class)]]
>> >> >> >> > > [loading
>> >> >> >> > >
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/FilterOutputStream.class)]]
>> >> >> >> > > [loading
>> >> >> >> > >
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/OutputStream.class)]]
>> >> >> >> > > HBaseExample.java:31: error: cannot find symbol
>> >> >> >> > > RowResult singleRow =
>> table.getRow(Bytes.toBytes("test_row1"));
>> >> >> >> > > ^
>> >> >> >> > > symbol: class RowResult
>> >> >> >> > > location: class HBaseExample
>> >> >> >> > > HBaseExample.java:31: error: cannot find symbol
>> >> >> >> > > RowResult singleRow =
>> table.getRow(Bytes.toBytes("test_row1"));
>> >> >> >> > > ^
>> >> >> >> > > symbol: method getRow(byte[])
>> >> >> >> > > location: variable table of type HTable
>> >> >> >> > > HBaseExample.java:32: error: cannot find symbol
>> >> >> >> > > Cell cell =
>> >> singleRow.get(Bytes.toBytes("columnfamily1:column1"));
>> >> >> >> > > ^
>> >> >> >> > > symbol: class Cell
>> >> >> >> > > location: class HBaseExample
>> >> >> >> > > HBaseExample.java:42: error: cannot find symbol
>> >> >> >> > > Scanner scanner = table.getScanner(
>> >> >> >> > > ^
>> >> >> >> > > symbol: class Scanner
>> >> >> >> > > location: class HBaseExample
>> >> >> >> > > [loading
>> >> >> >> > >
>> >> >> >>
>> >> >>
>> >>
>> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/client/Scan.class)]]
>> >> >> >> > > HBaseExample.java:42: error: no suitable method found for
>> >> >> >> > > getScanner(String[])
>> >> >> >> > > Scanner scanner = table.getScanner(
>> >> >> >> > > ^
>> >> >> >> > > method HTable.getScanner(byte[],byte[]) is not applicable
>> >> >> >> > > (actual and formal argument lists differ in length)
>> >> >> >> > > method HTable.getScanner(byte[]) is not applicable
>> >> >> >> > > (actual argument String[] cannot be converted to byte[] by
>> method
>> >> >> >> > > invocation conversion)
>> >> >> >> > > method HTable.getScanner(Scan) is not applicable
>> >> >> >> > > (actual argument String[] cannot be converted to Scan by
>> method
>> >> >> >> > > invocation conversion)
>> >> >> >> > > HBaseExample.java:46: error: cannot find symbol
>> >> >> >> > > RowResult rowResult = scanner.next();
>> >> >> >> > > ^
>> >> >> >> > > symbol: class RowResult
>> >> >> >> > > location: class HBaseExample
>> >> >> >> > > HBaseExample.java:55: error: cannot find symbol
>> >> >> >> > > for (RowResult result : scanner) {
>> >> >> >> > > ^
>> >> >> >> > > symbol: class RowResult
>> >> >> >> > > location: class HBaseExample
>> >> >> >> > > [total 461ms]
>> >> >> >> > > Note: HBaseExample.java uses or overrides a deprecated API.
>> >> >> >> > > Note: Recompile with -Xlint:deprecation for details.
>> >> >> >> > > 18 errors
>> >> >> >> > >
>> >> >> >> >
>> >> >> >> >
>> >> >> >> >
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>>

Re: connecting Hbase using java

Posted by Alok Singh Mahor <al...@gmail.com>.
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 <jean-marc@spaggiari.org
> wrote:

> org.apache.hadoop.conf.Configuration is missing from the imports...
>
> 2013/4/4 Alok Singh Mahor <al...@gmail.com>:
> > 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 <
> jean-marc@spaggiari.org
> >> 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 <al...@gmail.com>:
> >> > 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/jaxb-api-2.1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jaxb-impl-2.2.3-1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jersey-core-1.8.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jersey-json-1.8.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jersey-server-1.8.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jettison-1.1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jetty-6.1.26.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jetty-util-6.1.26.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jruby-complete-1.6.5.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jsp-2.1-6.1.14.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jsp-api-2.1-6.1.14.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jsr305-1.3.9.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/junit-4.10-HBASE-1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/libthrift-0.8.0.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/log4j-1.2.16.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/metrics-core-2.1.2.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/netty-3.2.4.Final.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/protobuf-java-2.4.0a.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/servlet-api-2.5-6.1.14.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/slf4j-api-1.4.3.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/slf4j-log4j12-1.4.3.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/snappy-java-1.0.3.2.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/stax-api-1.0.1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/velocity-1.7.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/xmlenc-0.52.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/zookeeper-3.4.5.jar:
> >> >
> >> >
> >> >
> >> > On Thu, Apr 4, 2013 at 5:54 AM, Jean-Marc Spaggiari <
> >> jean-marc@spaggiari.org
> >> >> wrote:
> >> >
> >> >> What's the output of ~/packages/hbase-0.94.6/bin/hbase classpath?
> >> >>
> >> >> 2013/4/3 Alok Singh Mahor <al...@gmail.com>:
> >> >> > thank you Harsha
> >> >> > with your advice I used command to compile that example code
> >> >> > alok@alok:~/exp/hbase/exp$ javac -classpath
> >> >> > `~/packages/hbase-0.94.6/bin/hbase classpath` HBaseExample.java
> >> >> >
> >> >> > so errors reduced to 15 from 18
> >> >> > could you please what else I have to add
> >> >> >
> >> >> > please see the error
> >> >> >
> >> >> > alok@alok:~/exp/hbase/exp$ javac -classpath
> >> >> > `~/packages/hbase-0.94.6/bin/hbase classpath` HBaseExample.java
> >> >> > HBaseExample.java:5: error: cannot find symbol
> >> >> > import org.apache.hadoop.hbase.client.Scanner;
> >> >> >                                      ^
> >> >> >   symbol:   class Scanner
> >> >> >   location: package org.apache.hadoop.hbase.client
> >> >> > HBaseExample.java:6: error: cannot find symbol
> >> >> > import org.apache.hadoop.hbase.io.BatchUpdate;
> >> >> >                                  ^
> >> >> >   symbol:   class BatchUpdate
> >> >> >   location: package org.apache.hadoop.hbase.io
> >> >> > HBaseExample.java:7: error: cannot find symbol
> >> >> > import org.apache.hadoop.hbase.io.Cell;
> >> >> >                                  ^
> >> >> >   symbol:   class Cell
> >> >> >   location: package org.apache.hadoop.hbase.io
> >> >> > HBaseExample.java:8: error: cannot find symbol
> >> >> > import org.apache.hadoop.hbase.io.RowResult;
> >> >> >                                  ^
> >> >> >   symbol:   class RowResult
> >> >> >   location: package org.apache.hadoop.hbase.io
> >> >> > HBaseExample.java:20: error: cannot find symbol
> >> >> >         BatchUpdate batchUpdate = new BatchUpdate("test_row1");
> >> >> >         ^
> >> >> >   symbol:   class BatchUpdate
> >> >> >   location: class HBaseExample
> >> >> > HBaseExample.java:20: error: cannot find symbol
> >> >> >         BatchUpdate batchUpdate = new BatchUpdate("test_row1");
> >> >> >                                       ^
> >> >> >   symbol:   class BatchUpdate
> >> >> >   location: class HBaseExample
> >> >> > HBaseExample.java:25: error: cannot find symbol
> >> >> >         Cell cell = table.get("test_row1",
> "columnfamily1:column1");
> >> >> >         ^
> >> >> >   symbol:   class Cell
> >> >> >   location: class HBaseExample
> >> >> > HBaseExample.java:25: error: no suitable method found for
> >> >> get(String,String)
> >> >> >         Cell cell = table.get("test_row1",
> "columnfamily1:column1");
> >> >> >                          ^
> >> >> >     method HTable.get(List<Get>) is not applicable
> >> >> >       (actual and formal argument lists differ in length)
> >> >> >     method HTable.get(Get) is not applicable
> >> >> >       (actual and formal argument lists differ in length)
> >> >> > HBaseExample.java:31: error: cannot find symbol
> >> >> >         RowResult singleRow =
> >> table.getRow(Bytes.toBytes("test_row1"));
> >> >> >         ^
> >> >> >   symbol:   class RowResult
> >> >> >   location: class HBaseExample
> >> >> > HBaseExample.java:31: error: cannot find symbol
> >> >> >         RowResult singleRow =
> >> table.getRow(Bytes.toBytes("test_row1"));
> >> >> >                                    ^
> >> >> >   symbol:   method getRow(byte[])
> >> >> >   location: variable table of type HTable
> >> >> > HBaseExample.java:32: error: cannot find symbol
> >> >> >         Cell cell =
> >> >> singleRow.get(Bytes.toBytes("columnfamily1:column1"));
> >> >> >         ^
> >> >> >   symbol:   class Cell
> >> >> >   location: class HBaseExample
> >> >> > HBaseExample.java:42: error: cannot find symbol
> >> >> >         Scanner scanner = table.getScanner(
> >> >> >         ^
> >> >> >   symbol:   class Scanner
> >> >> >   location: class HBaseExample
> >> >> > HBaseExample.java:42: error: no suitable method found for
> >> >> > getScanner(String[])
> >> >> >         Scanner scanner = table.getScanner(
> >> >> >                                ^
> >> >> >     method HTable.getScanner(byte[],byte[]) is not applicable
> >> >> >       (actual and formal argument lists differ in length)
> >> >> >     method HTable.getScanner(byte[]) is not applicable
> >> >> >       (actual argument String[] cannot be converted to byte[] by
> >> method
> >> >> > invocation conversion)
> >> >> >     method HTable.getScanner(Scan) is not applicable
> >> >> >       (actual argument String[] cannot be converted to Scan by
> method
> >> >> > invocation conversion)
> >> >> > HBaseExample.java:46: error: cannot find symbol
> >> >> >         RowResult rowResult = scanner.next();
> >> >> >         ^
> >> >> >   symbol:   class RowResult
> >> >> >   location: class HBaseExample
> >> >> > HBaseExample.java:55: error: cannot find symbol
> >> >> >         for (RowResult result : scanner) {
> >> >> >              ^
> >> >> >   symbol:   class RowResult
> >> >> >   location: class HBaseExample
> >> >> > Note: HBaseExample.java uses or overrides a deprecated API.
> >> >> > Note: Recompile with -Xlint:deprecation for details.
> >> >> > 15 errors
> >> >> >
> >> >> >
> >> >> > On Thu, Apr 4, 2013 at 2:50 AM, Harsha <ha...@defun.org> wrote:
> >> >> >
> >> >> >> Alok,
> >> >> >>     run "hbase classpath" and try putting everything in it in
> class
> >> >> path.
> >> >> >> -Harsha
> >> >> >>
> >> >> >>
> >> >> >> --
> >> >> >> Harsha
> >> >> >>
> >> >> >>
> >> >> >> On Wednesday, April 3, 2013 at 9:59 AM, Andrea Gazzarini wrote:
> >> >> >>
> >> >> >> > I don't have my laptop with me at the momemt and honestly last
> >> time I
> >> >> >> > ran a javac from command line it was about ten years ago but my
> >> >> >> > questions is : are you sure you can use wildcard this way?
> >> >> >> > If I remember well, prior to JDK 1.6 you could not use
> widlcards at
> >> >> all,
> >> >> >> > and starting from 1.6 you can use *only* wildcard, without the
> >> ".jar"
> >> >> >> suffix
> >> >> >> >
> >> >> >> > Best,
> >> >> >> > Andrea
> >> >> >> >
> >> >> >> >
> >> >> >> > On 04/03/2013 06:37 PM, Alok Singh Mahor wrote:
> >> >> >> > > Hi all,
> >> >> >> > > today I start afresh a Example code on
> >> >> >> > >
> >> http://blog.rajeevsharma.in/2009/06/using-hbase-in-java-0193.html
> >> >> >> > > but I guess luck is not with me.
> >> >> >> > > I run
> >> >> >> > > javac -classpath
> >> >> >> > >
> >> >> >>
> >> >>
> >>
> ~/packages/hbase-0.94.6/hbase-0.94.6.jar:~/packages/hbase-0.94.6/lib/*:~/packages/hadoop-1.1.2/*.jar:~/packages/hadoop-1.1.2/lib/*.jar
> >> >> >> > > HBaseExample.java -verbose
> >> >> >> > >
> >> >> >> > > please tell me what else I need to add in path to resolve
> these
> >> >> errors
> >> >> >> > >
> >> >> >> > > thank you
> >> >> >> > >
> >> >> >> > >
> >> >> >> > > alok@alok:~/exp/hbase/exp$ javac -classpath
> >> >> >> > >
> >> >> >>
> >> >>
> >>
> ~/packages/hbase-0.94.6/hbase-0.94.6.jar:~/packages/hbase-0.94.6/lib/*:~/packages/hadoop-1.1.2/*.jar:~/packages/hadoop-1.1.2/lib/*.jar
> >> >> >> > > HBaseExample.java -verbose
> >> >> >> > > [parsing started RegularFileObject[HBaseExample.java]]
> >> >> >> > > [parsing completed 29ms]
> >> >> >> > > [search path for source files:
> >> >> >> > >
> >> >> >>
> >> >>
> >>
> /home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar,~/packages/hbase-0.94.6/lib/*,~/packages/hadoop-1.1.2/*.jar,~/packages/hadoop-1.1.2/lib/*.jar]
> >> >> >> > > [search path for class files:
> >> >> >> > >
> >> >> >>
> >> >>
> >>
> /usr/lib/jvm/java-7-openjdk-i386/jre/lib/resources.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/rt.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/sunrsasign.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jsse.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jce.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/charsets.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/netx.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/plugin.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/rhino.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jfr.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/classes,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/zipfs.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/sunjce_provider.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/sunpkcs11.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/pulse-java.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/dnsns.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/java-atk-wrapper.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/localedata.jar,/home/alok/pack
> >> >> >>
> >> >> >>
> >> >>
> >>
> ages/hbase-0.94.6/hbase-0.94.6.jar,~/packages/hbase-0.94.6/lib/*,~/packages/hadoop-1.1.2/*.jar,~/packages/hadoop-1.1.2/lib/*.jar]
> >> >> >> > > [loading
> >> >> >> > >
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/IOException.class)]]
> >> >> >> > > HBaseExample.java:2: error: package org.apache.hadoop.fs does
> not
> >> >> exist
> >> >> >> > > import org.apache.hadoop.fs.Path;
> >> >> >> > > ^
> >> >> >> > > [loading
> >> >> >> > >
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/HBaseConfiguration.class)]]
> >> >> >> > > [loading
> >> >> >> > >
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/client/HTable.class)]]
> >> >> >> > > HBaseExample.java:5: error: cannot find symbol
> >> >> >> > > import org.apache.hadoop.hbase.client.Scanner;
> >> >> >> > > ^
> >> >> >> > > symbol: class Scanner
> >> >> >> > > location: package org.apache.hadoop.hbase.client
> >> >> >> > > HBaseExample.java:6: error: cannot find symbol
> >> >> >> > > import org.apache.hadoop.hbase.io.BatchUpdate;
> >> >> >> > > ^
> >> >> >> > > symbol: class BatchUpdate
> >> >> >> > > location: package org.apache.hadoop.hbase.io (
> >> >> >> http://org.apache.hadoop.hbase.io)
> >> >> >> > > HBaseExample.java:7: error: cannot find symbol
> >> >> >> > > import org.apache.hadoop.hbase.io.Cell;
> >> >> >> > > ^
> >> >> >> > > symbol: class Cell
> >> >> >> > > location: package org.apache.hadoop.hbase.io (
> >> >> >> http://org.apache.hadoop.hbase.io)
> >> >> >> > > HBaseExample.java:8: error: cannot find symbol
> >> >> >> > > import org.apache.hadoop.hbase.io.RowResult;
> >> >> >> > > ^
> >> >> >> > > symbol: class RowResult
> >> >> >> > > location: package org.apache.hadoop.hbase.io (
> >> >> >> http://org.apache.hadoop.hbase.io)
> >> >> >> > > [loading
> >> >> >> > >
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/util/Bytes.class)]]
> >> >> >> > > [loading
> >> >> >> > >
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Object.class)]]
> >> >> >> > > [loading
> >> >> >> > >
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/String.class)]]
> >> >> >> > > [checking HBaseExample]
> >> >> >> > > [loading
> >> >> >> > >
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/AutoCloseable.class)]]
> >> >> >> > > [loading
> >> >> >> > >
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Exception.class)]]
> >> >> >> > > [loading
> >> >> >> > >
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Throwable.class)]]
> >> >> >> > > HBaseExample.java:16: error: cannot find symbol
> >> >> >> > > conf.addResource(new
> >> Path("/opt/hbase-0.19.3/conf/hbase-site.xml"));
> >> >> >> > > ^
> >> >> >> > > symbol: class Path
> >> >> >> > > location: class HBaseExample
> >> >> >> > > HBaseExample.java:16: error: cannot access Configuration
> >> >> >> > > conf.addResource(new
> >> Path("/opt/hbase-0.19.3/conf/hbase-site.xml"));
> >> >> >> > > ^
> >> >> >> > > class file for org.apache.hadoop.conf.Configuration not found
> >> >> >> > > HBaseExample.java:20: error: cannot find symbol
> >> >> >> > > BatchUpdate batchUpdate = new BatchUpdate("test_row1");
> >> >> >> > > ^
> >> >> >> > > symbol: class BatchUpdate
> >> >> >> > > location: class HBaseExample
> >> >> >> > > HBaseExample.java:20: error: cannot find symbol
> >> >> >> > > BatchUpdate batchUpdate = new BatchUpdate("test_row1");
> >> >> >> > > ^
> >> >> >> > > symbol: class BatchUpdate
> >> >> >> > > location: class HBaseExample
> >> >> >> > > [loading
> >> >> >> > >
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/math/BigDecimal.class)]]
> >> >> >> > > [loading
> >> >> >> > >
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/nio/ByteBuffer.class)]]
> >> >> >> > > HBaseExample.java:25: error: cannot find symbol
> >> >> >> > > Cell cell = table.get("test_row1", "columnfamily1:column1");
> >> >> >> > > ^
> >> >> >> > > symbol: class Cell
> >> >> >> > > location: class HBaseExample
> >> >> >> > > [loading
> >> >> >> > >
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/util/List.class)]]
> >> >> >> > > HBaseExample.java:25: error: no suitable method found for
> >> >> >> get(String,String)
> >> >> >> > > Cell cell = table.get("test_row1", "columnfamily1:column1");
> >> >> >> > > ^
> >> >> >> > > method HTable.get(List<Get>) is not applicable
> >> >> >> > > (actual and formal argument lists differ in length)
> >> >> >> > > method HTable.get(Get) is not applicable
> >> >> >> > > (actual and formal argument lists differ in length)
> >> >> >> > > [loading
> >> >> >> > >
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/System.class)]]
> >> >> >> > > [loading
> >> >> >> > >
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/PrintStream.class)]]
> >> >> >> > > [loading
> >> >> >> > >
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/FilterOutputStream.class)]]
> >> >> >> > > [loading
> >> >> >> > >
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/OutputStream.class)]]
> >> >> >> > > HBaseExample.java:31: error: cannot find symbol
> >> >> >> > > RowResult singleRow =
> table.getRow(Bytes.toBytes("test_row1"));
> >> >> >> > > ^
> >> >> >> > > symbol: class RowResult
> >> >> >> > > location: class HBaseExample
> >> >> >> > > HBaseExample.java:31: error: cannot find symbol
> >> >> >> > > RowResult singleRow =
> table.getRow(Bytes.toBytes("test_row1"));
> >> >> >> > > ^
> >> >> >> > > symbol: method getRow(byte[])
> >> >> >> > > location: variable table of type HTable
> >> >> >> > > HBaseExample.java:32: error: cannot find symbol
> >> >> >> > > Cell cell =
> >> singleRow.get(Bytes.toBytes("columnfamily1:column1"));
> >> >> >> > > ^
> >> >> >> > > symbol: class Cell
> >> >> >> > > location: class HBaseExample
> >> >> >> > > HBaseExample.java:42: error: cannot find symbol
> >> >> >> > > Scanner scanner = table.getScanner(
> >> >> >> > > ^
> >> >> >> > > symbol: class Scanner
> >> >> >> > > location: class HBaseExample
> >> >> >> > > [loading
> >> >> >> > >
> >> >> >>
> >> >>
> >>
> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/client/Scan.class)]]
> >> >> >> > > HBaseExample.java:42: error: no suitable method found for
> >> >> >> > > getScanner(String[])
> >> >> >> > > Scanner scanner = table.getScanner(
> >> >> >> > > ^
> >> >> >> > > method HTable.getScanner(byte[],byte[]) is not applicable
> >> >> >> > > (actual and formal argument lists differ in length)
> >> >> >> > > method HTable.getScanner(byte[]) is not applicable
> >> >> >> > > (actual argument String[] cannot be converted to byte[] by
> method
> >> >> >> > > invocation conversion)
> >> >> >> > > method HTable.getScanner(Scan) is not applicable
> >> >> >> > > (actual argument String[] cannot be converted to Scan by
> method
> >> >> >> > > invocation conversion)
> >> >> >> > > HBaseExample.java:46: error: cannot find symbol
> >> >> >> > > RowResult rowResult = scanner.next();
> >> >> >> > > ^
> >> >> >> > > symbol: class RowResult
> >> >> >> > > location: class HBaseExample
> >> >> >> > > HBaseExample.java:55: error: cannot find symbol
> >> >> >> > > for (RowResult result : scanner) {
> >> >> >> > > ^
> >> >> >> > > symbol: class RowResult
> >> >> >> > > location: class HBaseExample
> >> >> >> > > [total 461ms]
> >> >> >> > > Note: HBaseExample.java uses or overrides a deprecated API.
> >> >> >> > > Note: Recompile with -Xlint:deprecation for details.
> >> >> >> > > 18 errors
> >> >> >> > >
> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >> >>
> >> >> >>
> >> >> >>
> >> >>
> >>
>

Re: connecting Hbase using java

Posted by Jean-Marc Spaggiari <je...@spaggiari.org>.
org.apache.hadoop.conf.Configuration is missing from the imports...

2013/4/4 Alok Singh Mahor <al...@gmail.com>:
> 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 <jean-marc@spaggiari.org
>> 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 <al...@gmail.com>:
>> > 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/jaxb-api-2.1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jaxb-impl-2.2.3-1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jersey-core-1.8.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jersey-json-1.8.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jersey-server-1.8.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jettison-1.1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jetty-6.1.26.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jetty-util-6.1.26.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jruby-complete-1.6.5.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jsp-2.1-6.1.14.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jsp-api-2.1-6.1.14.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jsr305-1.3.9.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/junit-4.10-HBASE-1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/libthrift-0.8.0.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/log4j-1.2.16.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/metrics-core-2.1.2.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/netty-3.2.4.Final.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/protobuf-java-2.4.0a.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/servlet-api-2.5-6.1.14.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/slf4j-api-1.4.3.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/slf4j-log4j12-1.4.3.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/snappy-java-1.0.3.2.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/stax-api-1.0.1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/velocity-1.7.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/xmlenc-0.52.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/zookeeper-3.4.5.jar:
>> >
>> >
>> >
>> > On Thu, Apr 4, 2013 at 5:54 AM, Jean-Marc Spaggiari <
>> jean-marc@spaggiari.org
>> >> wrote:
>> >
>> >> What's the output of ~/packages/hbase-0.94.6/bin/hbase classpath?
>> >>
>> >> 2013/4/3 Alok Singh Mahor <al...@gmail.com>:
>> >> > thank you Harsha
>> >> > with your advice I used command to compile that example code
>> >> > alok@alok:~/exp/hbase/exp$ javac -classpath
>> >> > `~/packages/hbase-0.94.6/bin/hbase classpath` HBaseExample.java
>> >> >
>> >> > so errors reduced to 15 from 18
>> >> > could you please what else I have to add
>> >> >
>> >> > please see the error
>> >> >
>> >> > alok@alok:~/exp/hbase/exp$ javac -classpath
>> >> > `~/packages/hbase-0.94.6/bin/hbase classpath` HBaseExample.java
>> >> > HBaseExample.java:5: error: cannot find symbol
>> >> > import org.apache.hadoop.hbase.client.Scanner;
>> >> >                                      ^
>> >> >   symbol:   class Scanner
>> >> >   location: package org.apache.hadoop.hbase.client
>> >> > HBaseExample.java:6: error: cannot find symbol
>> >> > import org.apache.hadoop.hbase.io.BatchUpdate;
>> >> >                                  ^
>> >> >   symbol:   class BatchUpdate
>> >> >   location: package org.apache.hadoop.hbase.io
>> >> > HBaseExample.java:7: error: cannot find symbol
>> >> > import org.apache.hadoop.hbase.io.Cell;
>> >> >                                  ^
>> >> >   symbol:   class Cell
>> >> >   location: package org.apache.hadoop.hbase.io
>> >> > HBaseExample.java:8: error: cannot find symbol
>> >> > import org.apache.hadoop.hbase.io.RowResult;
>> >> >                                  ^
>> >> >   symbol:   class RowResult
>> >> >   location: package org.apache.hadoop.hbase.io
>> >> > HBaseExample.java:20: error: cannot find symbol
>> >> >         BatchUpdate batchUpdate = new BatchUpdate("test_row1");
>> >> >         ^
>> >> >   symbol:   class BatchUpdate
>> >> >   location: class HBaseExample
>> >> > HBaseExample.java:20: error: cannot find symbol
>> >> >         BatchUpdate batchUpdate = new BatchUpdate("test_row1");
>> >> >                                       ^
>> >> >   symbol:   class BatchUpdate
>> >> >   location: class HBaseExample
>> >> > HBaseExample.java:25: error: cannot find symbol
>> >> >         Cell cell = table.get("test_row1", "columnfamily1:column1");
>> >> >         ^
>> >> >   symbol:   class Cell
>> >> >   location: class HBaseExample
>> >> > HBaseExample.java:25: error: no suitable method found for
>> >> get(String,String)
>> >> >         Cell cell = table.get("test_row1", "columnfamily1:column1");
>> >> >                          ^
>> >> >     method HTable.get(List<Get>) is not applicable
>> >> >       (actual and formal argument lists differ in length)
>> >> >     method HTable.get(Get) is not applicable
>> >> >       (actual and formal argument lists differ in length)
>> >> > HBaseExample.java:31: error: cannot find symbol
>> >> >         RowResult singleRow =
>> table.getRow(Bytes.toBytes("test_row1"));
>> >> >         ^
>> >> >   symbol:   class RowResult
>> >> >   location: class HBaseExample
>> >> > HBaseExample.java:31: error: cannot find symbol
>> >> >         RowResult singleRow =
>> table.getRow(Bytes.toBytes("test_row1"));
>> >> >                                    ^
>> >> >   symbol:   method getRow(byte[])
>> >> >   location: variable table of type HTable
>> >> > HBaseExample.java:32: error: cannot find symbol
>> >> >         Cell cell =
>> >> singleRow.get(Bytes.toBytes("columnfamily1:column1"));
>> >> >         ^
>> >> >   symbol:   class Cell
>> >> >   location: class HBaseExample
>> >> > HBaseExample.java:42: error: cannot find symbol
>> >> >         Scanner scanner = table.getScanner(
>> >> >         ^
>> >> >   symbol:   class Scanner
>> >> >   location: class HBaseExample
>> >> > HBaseExample.java:42: error: no suitable method found for
>> >> > getScanner(String[])
>> >> >         Scanner scanner = table.getScanner(
>> >> >                                ^
>> >> >     method HTable.getScanner(byte[],byte[]) is not applicable
>> >> >       (actual and formal argument lists differ in length)
>> >> >     method HTable.getScanner(byte[]) is not applicable
>> >> >       (actual argument String[] cannot be converted to byte[] by
>> method
>> >> > invocation conversion)
>> >> >     method HTable.getScanner(Scan) is not applicable
>> >> >       (actual argument String[] cannot be converted to Scan by method
>> >> > invocation conversion)
>> >> > HBaseExample.java:46: error: cannot find symbol
>> >> >         RowResult rowResult = scanner.next();
>> >> >         ^
>> >> >   symbol:   class RowResult
>> >> >   location: class HBaseExample
>> >> > HBaseExample.java:55: error: cannot find symbol
>> >> >         for (RowResult result : scanner) {
>> >> >              ^
>> >> >   symbol:   class RowResult
>> >> >   location: class HBaseExample
>> >> > Note: HBaseExample.java uses or overrides a deprecated API.
>> >> > Note: Recompile with -Xlint:deprecation for details.
>> >> > 15 errors
>> >> >
>> >> >
>> >> > On Thu, Apr 4, 2013 at 2:50 AM, Harsha <ha...@defun.org> wrote:
>> >> >
>> >> >> Alok,
>> >> >>     run "hbase classpath" and try putting everything in it in class
>> >> path.
>> >> >> -Harsha
>> >> >>
>> >> >>
>> >> >> --
>> >> >> Harsha
>> >> >>
>> >> >>
>> >> >> On Wednesday, April 3, 2013 at 9:59 AM, Andrea Gazzarini wrote:
>> >> >>
>> >> >> > I don't have my laptop with me at the momemt and honestly last
>> time I
>> >> >> > ran a javac from command line it was about ten years ago but my
>> >> >> > questions is : are you sure you can use wildcard this way?
>> >> >> > If I remember well, prior to JDK 1.6 you could not use widlcards at
>> >> all,
>> >> >> > and starting from 1.6 you can use *only* wildcard, without the
>> ".jar"
>> >> >> suffix
>> >> >> >
>> >> >> > Best,
>> >> >> > Andrea
>> >> >> >
>> >> >> >
>> >> >> > On 04/03/2013 06:37 PM, Alok Singh Mahor wrote:
>> >> >> > > Hi all,
>> >> >> > > today I start afresh a Example code on
>> >> >> > >
>> http://blog.rajeevsharma.in/2009/06/using-hbase-in-java-0193.html
>> >> >> > > but I guess luck is not with me.
>> >> >> > > I run
>> >> >> > > javac -classpath
>> >> >> > >
>> >> >>
>> >>
>> ~/packages/hbase-0.94.6/hbase-0.94.6.jar:~/packages/hbase-0.94.6/lib/*:~/packages/hadoop-1.1.2/*.jar:~/packages/hadoop-1.1.2/lib/*.jar
>> >> >> > > HBaseExample.java -verbose
>> >> >> > >
>> >> >> > > please tell me what else I need to add in path to resolve these
>> >> errors
>> >> >> > >
>> >> >> > > thank you
>> >> >> > >
>> >> >> > >
>> >> >> > > alok@alok:~/exp/hbase/exp$ javac -classpath
>> >> >> > >
>> >> >>
>> >>
>> ~/packages/hbase-0.94.6/hbase-0.94.6.jar:~/packages/hbase-0.94.6/lib/*:~/packages/hadoop-1.1.2/*.jar:~/packages/hadoop-1.1.2/lib/*.jar
>> >> >> > > HBaseExample.java -verbose
>> >> >> > > [parsing started RegularFileObject[HBaseExample.java]]
>> >> >> > > [parsing completed 29ms]
>> >> >> > > [search path for source files:
>> >> >> > >
>> >> >>
>> >>
>> /home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar,~/packages/hbase-0.94.6/lib/*,~/packages/hadoop-1.1.2/*.jar,~/packages/hadoop-1.1.2/lib/*.jar]
>> >> >> > > [search path for class files:
>> >> >> > >
>> >> >>
>> >>
>> /usr/lib/jvm/java-7-openjdk-i386/jre/lib/resources.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/rt.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/sunrsasign.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jsse.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jce.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/charsets.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/netx.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/plugin.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/rhino.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jfr.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/classes,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/zipfs.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/sunjce_provider.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/sunpkcs11.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/pulse-java.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/dnsns.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/java-atk-wrapper.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/localedata.jar,/home/alok/pack
>> >> >>
>> >> >>
>> >>
>> ages/hbase-0.94.6/hbase-0.94.6.jar,~/packages/hbase-0.94.6/lib/*,~/packages/hadoop-1.1.2/*.jar,~/packages/hadoop-1.1.2/lib/*.jar]
>> >> >> > > [loading
>> >> >> > >
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/IOException.class)]]
>> >> >> > > HBaseExample.java:2: error: package org.apache.hadoop.fs does not
>> >> exist
>> >> >> > > import org.apache.hadoop.fs.Path;
>> >> >> > > ^
>> >> >> > > [loading
>> >> >> > >
>> >> >>
>> >>
>> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/HBaseConfiguration.class)]]
>> >> >> > > [loading
>> >> >> > >
>> >> >>
>> >>
>> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/client/HTable.class)]]
>> >> >> > > HBaseExample.java:5: error: cannot find symbol
>> >> >> > > import org.apache.hadoop.hbase.client.Scanner;
>> >> >> > > ^
>> >> >> > > symbol: class Scanner
>> >> >> > > location: package org.apache.hadoop.hbase.client
>> >> >> > > HBaseExample.java:6: error: cannot find symbol
>> >> >> > > import org.apache.hadoop.hbase.io.BatchUpdate;
>> >> >> > > ^
>> >> >> > > symbol: class BatchUpdate
>> >> >> > > location: package org.apache.hadoop.hbase.io (
>> >> >> http://org.apache.hadoop.hbase.io)
>> >> >> > > HBaseExample.java:7: error: cannot find symbol
>> >> >> > > import org.apache.hadoop.hbase.io.Cell;
>> >> >> > > ^
>> >> >> > > symbol: class Cell
>> >> >> > > location: package org.apache.hadoop.hbase.io (
>> >> >> http://org.apache.hadoop.hbase.io)
>> >> >> > > HBaseExample.java:8: error: cannot find symbol
>> >> >> > > import org.apache.hadoop.hbase.io.RowResult;
>> >> >> > > ^
>> >> >> > > symbol: class RowResult
>> >> >> > > location: package org.apache.hadoop.hbase.io (
>> >> >> http://org.apache.hadoop.hbase.io)
>> >> >> > > [loading
>> >> >> > >
>> >> >>
>> >>
>> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/util/Bytes.class)]]
>> >> >> > > [loading
>> >> >> > >
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Object.class)]]
>> >> >> > > [loading
>> >> >> > >
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/String.class)]]
>> >> >> > > [checking HBaseExample]
>> >> >> > > [loading
>> >> >> > >
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/AutoCloseable.class)]]
>> >> >> > > [loading
>> >> >> > >
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Exception.class)]]
>> >> >> > > [loading
>> >> >> > >
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Throwable.class)]]
>> >> >> > > HBaseExample.java:16: error: cannot find symbol
>> >> >> > > conf.addResource(new
>> Path("/opt/hbase-0.19.3/conf/hbase-site.xml"));
>> >> >> > > ^
>> >> >> > > symbol: class Path
>> >> >> > > location: class HBaseExample
>> >> >> > > HBaseExample.java:16: error: cannot access Configuration
>> >> >> > > conf.addResource(new
>> Path("/opt/hbase-0.19.3/conf/hbase-site.xml"));
>> >> >> > > ^
>> >> >> > > class file for org.apache.hadoop.conf.Configuration not found
>> >> >> > > HBaseExample.java:20: error: cannot find symbol
>> >> >> > > BatchUpdate batchUpdate = new BatchUpdate("test_row1");
>> >> >> > > ^
>> >> >> > > symbol: class BatchUpdate
>> >> >> > > location: class HBaseExample
>> >> >> > > HBaseExample.java:20: error: cannot find symbol
>> >> >> > > BatchUpdate batchUpdate = new BatchUpdate("test_row1");
>> >> >> > > ^
>> >> >> > > symbol: class BatchUpdate
>> >> >> > > location: class HBaseExample
>> >> >> > > [loading
>> >> >> > >
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/math/BigDecimal.class)]]
>> >> >> > > [loading
>> >> >> > >
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/nio/ByteBuffer.class)]]
>> >> >> > > HBaseExample.java:25: error: cannot find symbol
>> >> >> > > Cell cell = table.get("test_row1", "columnfamily1:column1");
>> >> >> > > ^
>> >> >> > > symbol: class Cell
>> >> >> > > location: class HBaseExample
>> >> >> > > [loading
>> >> >> > >
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/util/List.class)]]
>> >> >> > > HBaseExample.java:25: error: no suitable method found for
>> >> >> get(String,String)
>> >> >> > > Cell cell = table.get("test_row1", "columnfamily1:column1");
>> >> >> > > ^
>> >> >> > > method HTable.get(List<Get>) is not applicable
>> >> >> > > (actual and formal argument lists differ in length)
>> >> >> > > method HTable.get(Get) is not applicable
>> >> >> > > (actual and formal argument lists differ in length)
>> >> >> > > [loading
>> >> >> > >
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/System.class)]]
>> >> >> > > [loading
>> >> >> > >
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/PrintStream.class)]]
>> >> >> > > [loading
>> >> >> > >
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/FilterOutputStream.class)]]
>> >> >> > > [loading
>> >> >> > >
>> >> >>
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/OutputStream.class)]]
>> >> >> > > HBaseExample.java:31: error: cannot find symbol
>> >> >> > > RowResult singleRow = table.getRow(Bytes.toBytes("test_row1"));
>> >> >> > > ^
>> >> >> > > symbol: class RowResult
>> >> >> > > location: class HBaseExample
>> >> >> > > HBaseExample.java:31: error: cannot find symbol
>> >> >> > > RowResult singleRow = table.getRow(Bytes.toBytes("test_row1"));
>> >> >> > > ^
>> >> >> > > symbol: method getRow(byte[])
>> >> >> > > location: variable table of type HTable
>> >> >> > > HBaseExample.java:32: error: cannot find symbol
>> >> >> > > Cell cell =
>> singleRow.get(Bytes.toBytes("columnfamily1:column1"));
>> >> >> > > ^
>> >> >> > > symbol: class Cell
>> >> >> > > location: class HBaseExample
>> >> >> > > HBaseExample.java:42: error: cannot find symbol
>> >> >> > > Scanner scanner = table.getScanner(
>> >> >> > > ^
>> >> >> > > symbol: class Scanner
>> >> >> > > location: class HBaseExample
>> >> >> > > [loading
>> >> >> > >
>> >> >>
>> >>
>> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/client/Scan.class)]]
>> >> >> > > HBaseExample.java:42: error: no suitable method found for
>> >> >> > > getScanner(String[])
>> >> >> > > Scanner scanner = table.getScanner(
>> >> >> > > ^
>> >> >> > > method HTable.getScanner(byte[],byte[]) is not applicable
>> >> >> > > (actual and formal argument lists differ in length)
>> >> >> > > method HTable.getScanner(byte[]) is not applicable
>> >> >> > > (actual argument String[] cannot be converted to byte[] by method
>> >> >> > > invocation conversion)
>> >> >> > > method HTable.getScanner(Scan) is not applicable
>> >> >> > > (actual argument String[] cannot be converted to Scan by method
>> >> >> > > invocation conversion)
>> >> >> > > HBaseExample.java:46: error: cannot find symbol
>> >> >> > > RowResult rowResult = scanner.next();
>> >> >> > > ^
>> >> >> > > symbol: class RowResult
>> >> >> > > location: class HBaseExample
>> >> >> > > HBaseExample.java:55: error: cannot find symbol
>> >> >> > > for (RowResult result : scanner) {
>> >> >> > > ^
>> >> >> > > symbol: class RowResult
>> >> >> > > location: class HBaseExample
>> >> >> > > [total 461ms]
>> >> >> > > Note: HBaseExample.java uses or overrides a deprecated API.
>> >> >> > > Note: Recompile with -Xlint:deprecation for details.
>> >> >> > > 18 errors
>> >> >> > >
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >>
>> >> >>
>> >> >>
>> >>
>>

Re: connecting Hbase using java

Posted by Alok Singh Mahor <al...@gmail.com>.
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 <jean-marc@spaggiari.org
> 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 <al...@gmail.com>:
> > 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/jaxb-api-2.1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jaxb-impl-2.2.3-1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jersey-core-1.8.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jersey-json-1.8.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jersey-server-1.8.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jettison-1.1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jetty-6.1.26.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jetty-util-6.1.26.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jruby-complete-1.6.5.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jsp-2.1-6.1.14.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jsp-api-2.1-6.1.14.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jsr305-1.3.9.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/junit-4.10-HBASE-1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/libthrift-0.8.0.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/log4j-1.2.16.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/metrics-core-2.1.2.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/netty-3.2.4.Final.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/protobuf-java-2.4.0a.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/servlet-api-2.5-6.1.14.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/slf4j-api-1.4.3.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/slf4j-log4j12-1.4.3.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/snappy-java-1.0.3.2.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/stax-api-1.0.1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/velocity-1.7.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/xmlenc-0.52.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/zookeeper-3.4.5.jar:
> >
> >
> >
> > On Thu, Apr 4, 2013 at 5:54 AM, Jean-Marc Spaggiari <
> jean-marc@spaggiari.org
> >> wrote:
> >
> >> What's the output of ~/packages/hbase-0.94.6/bin/hbase classpath?
> >>
> >> 2013/4/3 Alok Singh Mahor <al...@gmail.com>:
> >> > thank you Harsha
> >> > with your advice I used command to compile that example code
> >> > alok@alok:~/exp/hbase/exp$ javac -classpath
> >> > `~/packages/hbase-0.94.6/bin/hbase classpath` HBaseExample.java
> >> >
> >> > so errors reduced to 15 from 18
> >> > could you please what else I have to add
> >> >
> >> > please see the error
> >> >
> >> > alok@alok:~/exp/hbase/exp$ javac -classpath
> >> > `~/packages/hbase-0.94.6/bin/hbase classpath` HBaseExample.java
> >> > HBaseExample.java:5: error: cannot find symbol
> >> > import org.apache.hadoop.hbase.client.Scanner;
> >> >                                      ^
> >> >   symbol:   class Scanner
> >> >   location: package org.apache.hadoop.hbase.client
> >> > HBaseExample.java:6: error: cannot find symbol
> >> > import org.apache.hadoop.hbase.io.BatchUpdate;
> >> >                                  ^
> >> >   symbol:   class BatchUpdate
> >> >   location: package org.apache.hadoop.hbase.io
> >> > HBaseExample.java:7: error: cannot find symbol
> >> > import org.apache.hadoop.hbase.io.Cell;
> >> >                                  ^
> >> >   symbol:   class Cell
> >> >   location: package org.apache.hadoop.hbase.io
> >> > HBaseExample.java:8: error: cannot find symbol
> >> > import org.apache.hadoop.hbase.io.RowResult;
> >> >                                  ^
> >> >   symbol:   class RowResult
> >> >   location: package org.apache.hadoop.hbase.io
> >> > HBaseExample.java:20: error: cannot find symbol
> >> >         BatchUpdate batchUpdate = new BatchUpdate("test_row1");
> >> >         ^
> >> >   symbol:   class BatchUpdate
> >> >   location: class HBaseExample
> >> > HBaseExample.java:20: error: cannot find symbol
> >> >         BatchUpdate batchUpdate = new BatchUpdate("test_row1");
> >> >                                       ^
> >> >   symbol:   class BatchUpdate
> >> >   location: class HBaseExample
> >> > HBaseExample.java:25: error: cannot find symbol
> >> >         Cell cell = table.get("test_row1", "columnfamily1:column1");
> >> >         ^
> >> >   symbol:   class Cell
> >> >   location: class HBaseExample
> >> > HBaseExample.java:25: error: no suitable method found for
> >> get(String,String)
> >> >         Cell cell = table.get("test_row1", "columnfamily1:column1");
> >> >                          ^
> >> >     method HTable.get(List<Get>) is not applicable
> >> >       (actual and formal argument lists differ in length)
> >> >     method HTable.get(Get) is not applicable
> >> >       (actual and formal argument lists differ in length)
> >> > HBaseExample.java:31: error: cannot find symbol
> >> >         RowResult singleRow =
> table.getRow(Bytes.toBytes("test_row1"));
> >> >         ^
> >> >   symbol:   class RowResult
> >> >   location: class HBaseExample
> >> > HBaseExample.java:31: error: cannot find symbol
> >> >         RowResult singleRow =
> table.getRow(Bytes.toBytes("test_row1"));
> >> >                                    ^
> >> >   symbol:   method getRow(byte[])
> >> >   location: variable table of type HTable
> >> > HBaseExample.java:32: error: cannot find symbol
> >> >         Cell cell =
> >> singleRow.get(Bytes.toBytes("columnfamily1:column1"));
> >> >         ^
> >> >   symbol:   class Cell
> >> >   location: class HBaseExample
> >> > HBaseExample.java:42: error: cannot find symbol
> >> >         Scanner scanner = table.getScanner(
> >> >         ^
> >> >   symbol:   class Scanner
> >> >   location: class HBaseExample
> >> > HBaseExample.java:42: error: no suitable method found for
> >> > getScanner(String[])
> >> >         Scanner scanner = table.getScanner(
> >> >                                ^
> >> >     method HTable.getScanner(byte[],byte[]) is not applicable
> >> >       (actual and formal argument lists differ in length)
> >> >     method HTable.getScanner(byte[]) is not applicable
> >> >       (actual argument String[] cannot be converted to byte[] by
> method
> >> > invocation conversion)
> >> >     method HTable.getScanner(Scan) is not applicable
> >> >       (actual argument String[] cannot be converted to Scan by method
> >> > invocation conversion)
> >> > HBaseExample.java:46: error: cannot find symbol
> >> >         RowResult rowResult = scanner.next();
> >> >         ^
> >> >   symbol:   class RowResult
> >> >   location: class HBaseExample
> >> > HBaseExample.java:55: error: cannot find symbol
> >> >         for (RowResult result : scanner) {
> >> >              ^
> >> >   symbol:   class RowResult
> >> >   location: class HBaseExample
> >> > Note: HBaseExample.java uses or overrides a deprecated API.
> >> > Note: Recompile with -Xlint:deprecation for details.
> >> > 15 errors
> >> >
> >> >
> >> > On Thu, Apr 4, 2013 at 2:50 AM, Harsha <ha...@defun.org> wrote:
> >> >
> >> >> Alok,
> >> >>     run "hbase classpath" and try putting everything in it in class
> >> path.
> >> >> -Harsha
> >> >>
> >> >>
> >> >> --
> >> >> Harsha
> >> >>
> >> >>
> >> >> On Wednesday, April 3, 2013 at 9:59 AM, Andrea Gazzarini wrote:
> >> >>
> >> >> > I don't have my laptop with me at the momemt and honestly last
> time I
> >> >> > ran a javac from command line it was about ten years ago but my
> >> >> > questions is : are you sure you can use wildcard this way?
> >> >> > If I remember well, prior to JDK 1.6 you could not use widlcards at
> >> all,
> >> >> > and starting from 1.6 you can use *only* wildcard, without the
> ".jar"
> >> >> suffix
> >> >> >
> >> >> > Best,
> >> >> > Andrea
> >> >> >
> >> >> >
> >> >> > On 04/03/2013 06:37 PM, Alok Singh Mahor wrote:
> >> >> > > Hi all,
> >> >> > > today I start afresh a Example code on
> >> >> > >
> http://blog.rajeevsharma.in/2009/06/using-hbase-in-java-0193.html
> >> >> > > but I guess luck is not with me.
> >> >> > > I run
> >> >> > > javac -classpath
> >> >> > >
> >> >>
> >>
> ~/packages/hbase-0.94.6/hbase-0.94.6.jar:~/packages/hbase-0.94.6/lib/*:~/packages/hadoop-1.1.2/*.jar:~/packages/hadoop-1.1.2/lib/*.jar
> >> >> > > HBaseExample.java -verbose
> >> >> > >
> >> >> > > please tell me what else I need to add in path to resolve these
> >> errors
> >> >> > >
> >> >> > > thank you
> >> >> > >
> >> >> > >
> >> >> > > alok@alok:~/exp/hbase/exp$ javac -classpath
> >> >> > >
> >> >>
> >>
> ~/packages/hbase-0.94.6/hbase-0.94.6.jar:~/packages/hbase-0.94.6/lib/*:~/packages/hadoop-1.1.2/*.jar:~/packages/hadoop-1.1.2/lib/*.jar
> >> >> > > HBaseExample.java -verbose
> >> >> > > [parsing started RegularFileObject[HBaseExample.java]]
> >> >> > > [parsing completed 29ms]
> >> >> > > [search path for source files:
> >> >> > >
> >> >>
> >>
> /home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar,~/packages/hbase-0.94.6/lib/*,~/packages/hadoop-1.1.2/*.jar,~/packages/hadoop-1.1.2/lib/*.jar]
> >> >> > > [search path for class files:
> >> >> > >
> >> >>
> >>
> /usr/lib/jvm/java-7-openjdk-i386/jre/lib/resources.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/rt.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/sunrsasign.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jsse.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jce.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/charsets.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/netx.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/plugin.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/rhino.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jfr.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/classes,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/zipfs.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/sunjce_provider.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/sunpkcs11.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/pulse-java.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/dnsns.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/java-atk-wrapper.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/localedata.jar,/home/alok/pack
> >> >>
> >> >>
> >>
> ages/hbase-0.94.6/hbase-0.94.6.jar,~/packages/hbase-0.94.6/lib/*,~/packages/hadoop-1.1.2/*.jar,~/packages/hadoop-1.1.2/lib/*.jar]
> >> >> > > [loading
> >> >> > >
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/IOException.class)]]
> >> >> > > HBaseExample.java:2: error: package org.apache.hadoop.fs does not
> >> exist
> >> >> > > import org.apache.hadoop.fs.Path;
> >> >> > > ^
> >> >> > > [loading
> >> >> > >
> >> >>
> >>
> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/HBaseConfiguration.class)]]
> >> >> > > [loading
> >> >> > >
> >> >>
> >>
> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/client/HTable.class)]]
> >> >> > > HBaseExample.java:5: error: cannot find symbol
> >> >> > > import org.apache.hadoop.hbase.client.Scanner;
> >> >> > > ^
> >> >> > > symbol: class Scanner
> >> >> > > location: package org.apache.hadoop.hbase.client
> >> >> > > HBaseExample.java:6: error: cannot find symbol
> >> >> > > import org.apache.hadoop.hbase.io.BatchUpdate;
> >> >> > > ^
> >> >> > > symbol: class BatchUpdate
> >> >> > > location: package org.apache.hadoop.hbase.io (
> >> >> http://org.apache.hadoop.hbase.io)
> >> >> > > HBaseExample.java:7: error: cannot find symbol
> >> >> > > import org.apache.hadoop.hbase.io.Cell;
> >> >> > > ^
> >> >> > > symbol: class Cell
> >> >> > > location: package org.apache.hadoop.hbase.io (
> >> >> http://org.apache.hadoop.hbase.io)
> >> >> > > HBaseExample.java:8: error: cannot find symbol
> >> >> > > import org.apache.hadoop.hbase.io.RowResult;
> >> >> > > ^
> >> >> > > symbol: class RowResult
> >> >> > > location: package org.apache.hadoop.hbase.io (
> >> >> http://org.apache.hadoop.hbase.io)
> >> >> > > [loading
> >> >> > >
> >> >>
> >>
> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/util/Bytes.class)]]
> >> >> > > [loading
> >> >> > >
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Object.class)]]
> >> >> > > [loading
> >> >> > >
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/String.class)]]
> >> >> > > [checking HBaseExample]
> >> >> > > [loading
> >> >> > >
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/AutoCloseable.class)]]
> >> >> > > [loading
> >> >> > >
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Exception.class)]]
> >> >> > > [loading
> >> >> > >
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Throwable.class)]]
> >> >> > > HBaseExample.java:16: error: cannot find symbol
> >> >> > > conf.addResource(new
> Path("/opt/hbase-0.19.3/conf/hbase-site.xml"));
> >> >> > > ^
> >> >> > > symbol: class Path
> >> >> > > location: class HBaseExample
> >> >> > > HBaseExample.java:16: error: cannot access Configuration
> >> >> > > conf.addResource(new
> Path("/opt/hbase-0.19.3/conf/hbase-site.xml"));
> >> >> > > ^
> >> >> > > class file for org.apache.hadoop.conf.Configuration not found
> >> >> > > HBaseExample.java:20: error: cannot find symbol
> >> >> > > BatchUpdate batchUpdate = new BatchUpdate("test_row1");
> >> >> > > ^
> >> >> > > symbol: class BatchUpdate
> >> >> > > location: class HBaseExample
> >> >> > > HBaseExample.java:20: error: cannot find symbol
> >> >> > > BatchUpdate batchUpdate = new BatchUpdate("test_row1");
> >> >> > > ^
> >> >> > > symbol: class BatchUpdate
> >> >> > > location: class HBaseExample
> >> >> > > [loading
> >> >> > >
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/math/BigDecimal.class)]]
> >> >> > > [loading
> >> >> > >
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/nio/ByteBuffer.class)]]
> >> >> > > HBaseExample.java:25: error: cannot find symbol
> >> >> > > Cell cell = table.get("test_row1", "columnfamily1:column1");
> >> >> > > ^
> >> >> > > symbol: class Cell
> >> >> > > location: class HBaseExample
> >> >> > > [loading
> >> >> > >
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/util/List.class)]]
> >> >> > > HBaseExample.java:25: error: no suitable method found for
> >> >> get(String,String)
> >> >> > > Cell cell = table.get("test_row1", "columnfamily1:column1");
> >> >> > > ^
> >> >> > > method HTable.get(List<Get>) is not applicable
> >> >> > > (actual and formal argument lists differ in length)
> >> >> > > method HTable.get(Get) is not applicable
> >> >> > > (actual and formal argument lists differ in length)
> >> >> > > [loading
> >> >> > >
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/System.class)]]
> >> >> > > [loading
> >> >> > >
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/PrintStream.class)]]
> >> >> > > [loading
> >> >> > >
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/FilterOutputStream.class)]]
> >> >> > > [loading
> >> >> > >
> >> >>
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/OutputStream.class)]]
> >> >> > > HBaseExample.java:31: error: cannot find symbol
> >> >> > > RowResult singleRow = table.getRow(Bytes.toBytes("test_row1"));
> >> >> > > ^
> >> >> > > symbol: class RowResult
> >> >> > > location: class HBaseExample
> >> >> > > HBaseExample.java:31: error: cannot find symbol
> >> >> > > RowResult singleRow = table.getRow(Bytes.toBytes("test_row1"));
> >> >> > > ^
> >> >> > > symbol: method getRow(byte[])
> >> >> > > location: variable table of type HTable
> >> >> > > HBaseExample.java:32: error: cannot find symbol
> >> >> > > Cell cell =
> singleRow.get(Bytes.toBytes("columnfamily1:column1"));
> >> >> > > ^
> >> >> > > symbol: class Cell
> >> >> > > location: class HBaseExample
> >> >> > > HBaseExample.java:42: error: cannot find symbol
> >> >> > > Scanner scanner = table.getScanner(
> >> >> > > ^
> >> >> > > symbol: class Scanner
> >> >> > > location: class HBaseExample
> >> >> > > [loading
> >> >> > >
> >> >>
> >>
> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/client/Scan.class)]]
> >> >> > > HBaseExample.java:42: error: no suitable method found for
> >> >> > > getScanner(String[])
> >> >> > > Scanner scanner = table.getScanner(
> >> >> > > ^
> >> >> > > method HTable.getScanner(byte[],byte[]) is not applicable
> >> >> > > (actual and formal argument lists differ in length)
> >> >> > > method HTable.getScanner(byte[]) is not applicable
> >> >> > > (actual argument String[] cannot be converted to byte[] by method
> >> >> > > invocation conversion)
> >> >> > > method HTable.getScanner(Scan) is not applicable
> >> >> > > (actual argument String[] cannot be converted to Scan by method
> >> >> > > invocation conversion)
> >> >> > > HBaseExample.java:46: error: cannot find symbol
> >> >> > > RowResult rowResult = scanner.next();
> >> >> > > ^
> >> >> > > symbol: class RowResult
> >> >> > > location: class HBaseExample
> >> >> > > HBaseExample.java:55: error: cannot find symbol
> >> >> > > for (RowResult result : scanner) {
> >> >> > > ^
> >> >> > > symbol: class RowResult
> >> >> > > location: class HBaseExample
> >> >> > > [total 461ms]
> >> >> > > Note: HBaseExample.java uses or overrides a deprecated API.
> >> >> > > Note: Recompile with -Xlint:deprecation for details.
> >> >> > > 18 errors
> >> >> > >
> >> >> >
> >> >> >
> >> >> >
> >> >>
> >> >>
> >> >>
> >>
>

Re: connecting Hbase using java

Posted by Jean-Marc Spaggiari <je...@spaggiari.org>.
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 <al...@gmail.com>:
> 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/jaxb-api-2.1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jaxb-impl-2.2.3-1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jersey-core-1.8.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jersey-json-1.8.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jersey-server-1.8.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jettison-1.1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jetty-6.1.26.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jetty-util-6.1.26.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jruby-complete-1.6.5.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jsp-2.1-6.1.14.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jsp-api-2.1-6.1.14.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jsr305-1.3.9.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/junit-4.10-HBASE-1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/libthrift-0.8.0.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/log4j-1.2.16.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/metrics-core-2.1.2.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/netty-3.2.4.Final.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/protobuf-java-2.4.0a.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/servlet-api-2.5-6.1.14.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/slf4j-api-1.4.3.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/slf4j-log4j12-1.4.3.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/snappy-java-1.0.3.2.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/stax-api-1.0.1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/velocity-1.7.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/xmlenc-0.52.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/zookeeper-3.4.5.jar:
>
>
>
> On Thu, Apr 4, 2013 at 5:54 AM, Jean-Marc Spaggiari <jean-marc@spaggiari.org
>> wrote:
>
>> What's the output of ~/packages/hbase-0.94.6/bin/hbase classpath?
>>
>> 2013/4/3 Alok Singh Mahor <al...@gmail.com>:
>> > thank you Harsha
>> > with your advice I used command to compile that example code
>> > alok@alok:~/exp/hbase/exp$ javac -classpath
>> > `~/packages/hbase-0.94.6/bin/hbase classpath` HBaseExample.java
>> >
>> > so errors reduced to 15 from 18
>> > could you please what else I have to add
>> >
>> > please see the error
>> >
>> > alok@alok:~/exp/hbase/exp$ javac -classpath
>> > `~/packages/hbase-0.94.6/bin/hbase classpath` HBaseExample.java
>> > HBaseExample.java:5: error: cannot find symbol
>> > import org.apache.hadoop.hbase.client.Scanner;
>> >                                      ^
>> >   symbol:   class Scanner
>> >   location: package org.apache.hadoop.hbase.client
>> > HBaseExample.java:6: error: cannot find symbol
>> > import org.apache.hadoop.hbase.io.BatchUpdate;
>> >                                  ^
>> >   symbol:   class BatchUpdate
>> >   location: package org.apache.hadoop.hbase.io
>> > HBaseExample.java:7: error: cannot find symbol
>> > import org.apache.hadoop.hbase.io.Cell;
>> >                                  ^
>> >   symbol:   class Cell
>> >   location: package org.apache.hadoop.hbase.io
>> > HBaseExample.java:8: error: cannot find symbol
>> > import org.apache.hadoop.hbase.io.RowResult;
>> >                                  ^
>> >   symbol:   class RowResult
>> >   location: package org.apache.hadoop.hbase.io
>> > HBaseExample.java:20: error: cannot find symbol
>> >         BatchUpdate batchUpdate = new BatchUpdate("test_row1");
>> >         ^
>> >   symbol:   class BatchUpdate
>> >   location: class HBaseExample
>> > HBaseExample.java:20: error: cannot find symbol
>> >         BatchUpdate batchUpdate = new BatchUpdate("test_row1");
>> >                                       ^
>> >   symbol:   class BatchUpdate
>> >   location: class HBaseExample
>> > HBaseExample.java:25: error: cannot find symbol
>> >         Cell cell = table.get("test_row1", "columnfamily1:column1");
>> >         ^
>> >   symbol:   class Cell
>> >   location: class HBaseExample
>> > HBaseExample.java:25: error: no suitable method found for
>> get(String,String)
>> >         Cell cell = table.get("test_row1", "columnfamily1:column1");
>> >                          ^
>> >     method HTable.get(List<Get>) is not applicable
>> >       (actual and formal argument lists differ in length)
>> >     method HTable.get(Get) is not applicable
>> >       (actual and formal argument lists differ in length)
>> > HBaseExample.java:31: error: cannot find symbol
>> >         RowResult singleRow = table.getRow(Bytes.toBytes("test_row1"));
>> >         ^
>> >   symbol:   class RowResult
>> >   location: class HBaseExample
>> > HBaseExample.java:31: error: cannot find symbol
>> >         RowResult singleRow = table.getRow(Bytes.toBytes("test_row1"));
>> >                                    ^
>> >   symbol:   method getRow(byte[])
>> >   location: variable table of type HTable
>> > HBaseExample.java:32: error: cannot find symbol
>> >         Cell cell =
>> singleRow.get(Bytes.toBytes("columnfamily1:column1"));
>> >         ^
>> >   symbol:   class Cell
>> >   location: class HBaseExample
>> > HBaseExample.java:42: error: cannot find symbol
>> >         Scanner scanner = table.getScanner(
>> >         ^
>> >   symbol:   class Scanner
>> >   location: class HBaseExample
>> > HBaseExample.java:42: error: no suitable method found for
>> > getScanner(String[])
>> >         Scanner scanner = table.getScanner(
>> >                                ^
>> >     method HTable.getScanner(byte[],byte[]) is not applicable
>> >       (actual and formal argument lists differ in length)
>> >     method HTable.getScanner(byte[]) is not applicable
>> >       (actual argument String[] cannot be converted to byte[] by method
>> > invocation conversion)
>> >     method HTable.getScanner(Scan) is not applicable
>> >       (actual argument String[] cannot be converted to Scan by method
>> > invocation conversion)
>> > HBaseExample.java:46: error: cannot find symbol
>> >         RowResult rowResult = scanner.next();
>> >         ^
>> >   symbol:   class RowResult
>> >   location: class HBaseExample
>> > HBaseExample.java:55: error: cannot find symbol
>> >         for (RowResult result : scanner) {
>> >              ^
>> >   symbol:   class RowResult
>> >   location: class HBaseExample
>> > Note: HBaseExample.java uses or overrides a deprecated API.
>> > Note: Recompile with -Xlint:deprecation for details.
>> > 15 errors
>> >
>> >
>> > On Thu, Apr 4, 2013 at 2:50 AM, Harsha <ha...@defun.org> wrote:
>> >
>> >> Alok,
>> >>     run "hbase classpath" and try putting everything in it in class
>> path.
>> >> -Harsha
>> >>
>> >>
>> >> --
>> >> Harsha
>> >>
>> >>
>> >> On Wednesday, April 3, 2013 at 9:59 AM, Andrea Gazzarini wrote:
>> >>
>> >> > I don't have my laptop with me at the momemt and honestly last time I
>> >> > ran a javac from command line it was about ten years ago but my
>> >> > questions is : are you sure you can use wildcard this way?
>> >> > If I remember well, prior to JDK 1.6 you could not use widlcards at
>> all,
>> >> > and starting from 1.6 you can use *only* wildcard, without the ".jar"
>> >> suffix
>> >> >
>> >> > Best,
>> >> > Andrea
>> >> >
>> >> >
>> >> > On 04/03/2013 06:37 PM, Alok Singh Mahor wrote:
>> >> > > Hi all,
>> >> > > today I start afresh a Example code on
>> >> > > http://blog.rajeevsharma.in/2009/06/using-hbase-in-java-0193.html
>> >> > > but I guess luck is not with me.
>> >> > > I run
>> >> > > javac -classpath
>> >> > >
>> >>
>> ~/packages/hbase-0.94.6/hbase-0.94.6.jar:~/packages/hbase-0.94.6/lib/*:~/packages/hadoop-1.1.2/*.jar:~/packages/hadoop-1.1.2/lib/*.jar
>> >> > > HBaseExample.java -verbose
>> >> > >
>> >> > > please tell me what else I need to add in path to resolve these
>> errors
>> >> > >
>> >> > > thank you
>> >> > >
>> >> > >
>> >> > > alok@alok:~/exp/hbase/exp$ javac -classpath
>> >> > >
>> >>
>> ~/packages/hbase-0.94.6/hbase-0.94.6.jar:~/packages/hbase-0.94.6/lib/*:~/packages/hadoop-1.1.2/*.jar:~/packages/hadoop-1.1.2/lib/*.jar
>> >> > > HBaseExample.java -verbose
>> >> > > [parsing started RegularFileObject[HBaseExample.java]]
>> >> > > [parsing completed 29ms]
>> >> > > [search path for source files:
>> >> > >
>> >>
>> /home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar,~/packages/hbase-0.94.6/lib/*,~/packages/hadoop-1.1.2/*.jar,~/packages/hadoop-1.1.2/lib/*.jar]
>> >> > > [search path for class files:
>> >> > >
>> >>
>> /usr/lib/jvm/java-7-openjdk-i386/jre/lib/resources.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/rt.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/sunrsasign.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jsse.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jce.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/charsets.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/netx.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/plugin.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/rhino.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jfr.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/classes,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/zipfs.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/sunjce_provider.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/sunpkcs11.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/pulse-java.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/dnsns.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/java-atk-wrapper.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/localedata.jar,/home/alok/pack
>> >>
>> >>
>> ages/hbase-0.94.6/hbase-0.94.6.jar,~/packages/hbase-0.94.6/lib/*,~/packages/hadoop-1.1.2/*.jar,~/packages/hadoop-1.1.2/lib/*.jar]
>> >> > > [loading
>> >> > >
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/IOException.class)]]
>> >> > > HBaseExample.java:2: error: package org.apache.hadoop.fs does not
>> exist
>> >> > > import org.apache.hadoop.fs.Path;
>> >> > > ^
>> >> > > [loading
>> >> > >
>> >>
>> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/HBaseConfiguration.class)]]
>> >> > > [loading
>> >> > >
>> >>
>> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/client/HTable.class)]]
>> >> > > HBaseExample.java:5: error: cannot find symbol
>> >> > > import org.apache.hadoop.hbase.client.Scanner;
>> >> > > ^
>> >> > > symbol: class Scanner
>> >> > > location: package org.apache.hadoop.hbase.client
>> >> > > HBaseExample.java:6: error: cannot find symbol
>> >> > > import org.apache.hadoop.hbase.io.BatchUpdate;
>> >> > > ^
>> >> > > symbol: class BatchUpdate
>> >> > > location: package org.apache.hadoop.hbase.io (
>> >> http://org.apache.hadoop.hbase.io)
>> >> > > HBaseExample.java:7: error: cannot find symbol
>> >> > > import org.apache.hadoop.hbase.io.Cell;
>> >> > > ^
>> >> > > symbol: class Cell
>> >> > > location: package org.apache.hadoop.hbase.io (
>> >> http://org.apache.hadoop.hbase.io)
>> >> > > HBaseExample.java:8: error: cannot find symbol
>> >> > > import org.apache.hadoop.hbase.io.RowResult;
>> >> > > ^
>> >> > > symbol: class RowResult
>> >> > > location: package org.apache.hadoop.hbase.io (
>> >> http://org.apache.hadoop.hbase.io)
>> >> > > [loading
>> >> > >
>> >>
>> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/util/Bytes.class)]]
>> >> > > [loading
>> >> > >
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Object.class)]]
>> >> > > [loading
>> >> > >
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/String.class)]]
>> >> > > [checking HBaseExample]
>> >> > > [loading
>> >> > >
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/AutoCloseable.class)]]
>> >> > > [loading
>> >> > >
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Exception.class)]]
>> >> > > [loading
>> >> > >
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Throwable.class)]]
>> >> > > HBaseExample.java:16: error: cannot find symbol
>> >> > > conf.addResource(new Path("/opt/hbase-0.19.3/conf/hbase-site.xml"));
>> >> > > ^
>> >> > > symbol: class Path
>> >> > > location: class HBaseExample
>> >> > > HBaseExample.java:16: error: cannot access Configuration
>> >> > > conf.addResource(new Path("/opt/hbase-0.19.3/conf/hbase-site.xml"));
>> >> > > ^
>> >> > > class file for org.apache.hadoop.conf.Configuration not found
>> >> > > HBaseExample.java:20: error: cannot find symbol
>> >> > > BatchUpdate batchUpdate = new BatchUpdate("test_row1");
>> >> > > ^
>> >> > > symbol: class BatchUpdate
>> >> > > location: class HBaseExample
>> >> > > HBaseExample.java:20: error: cannot find symbol
>> >> > > BatchUpdate batchUpdate = new BatchUpdate("test_row1");
>> >> > > ^
>> >> > > symbol: class BatchUpdate
>> >> > > location: class HBaseExample
>> >> > > [loading
>> >> > >
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/math/BigDecimal.class)]]
>> >> > > [loading
>> >> > >
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/nio/ByteBuffer.class)]]
>> >> > > HBaseExample.java:25: error: cannot find symbol
>> >> > > Cell cell = table.get("test_row1", "columnfamily1:column1");
>> >> > > ^
>> >> > > symbol: class Cell
>> >> > > location: class HBaseExample
>> >> > > [loading
>> >> > >
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/util/List.class)]]
>> >> > > HBaseExample.java:25: error: no suitable method found for
>> >> get(String,String)
>> >> > > Cell cell = table.get("test_row1", "columnfamily1:column1");
>> >> > > ^
>> >> > > method HTable.get(List<Get>) is not applicable
>> >> > > (actual and formal argument lists differ in length)
>> >> > > method HTable.get(Get) is not applicable
>> >> > > (actual and formal argument lists differ in length)
>> >> > > [loading
>> >> > >
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/System.class)]]
>> >> > > [loading
>> >> > >
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/PrintStream.class)]]
>> >> > > [loading
>> >> > >
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/FilterOutputStream.class)]]
>> >> > > [loading
>> >> > >
>> >>
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/OutputStream.class)]]
>> >> > > HBaseExample.java:31: error: cannot find symbol
>> >> > > RowResult singleRow = table.getRow(Bytes.toBytes("test_row1"));
>> >> > > ^
>> >> > > symbol: class RowResult
>> >> > > location: class HBaseExample
>> >> > > HBaseExample.java:31: error: cannot find symbol
>> >> > > RowResult singleRow = table.getRow(Bytes.toBytes("test_row1"));
>> >> > > ^
>> >> > > symbol: method getRow(byte[])
>> >> > > location: variable table of type HTable
>> >> > > HBaseExample.java:32: error: cannot find symbol
>> >> > > Cell cell = singleRow.get(Bytes.toBytes("columnfamily1:column1"));
>> >> > > ^
>> >> > > symbol: class Cell
>> >> > > location: class HBaseExample
>> >> > > HBaseExample.java:42: error: cannot find symbol
>> >> > > Scanner scanner = table.getScanner(
>> >> > > ^
>> >> > > symbol: class Scanner
>> >> > > location: class HBaseExample
>> >> > > [loading
>> >> > >
>> >>
>> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/client/Scan.class)]]
>> >> > > HBaseExample.java:42: error: no suitable method found for
>> >> > > getScanner(String[])
>> >> > > Scanner scanner = table.getScanner(
>> >> > > ^
>> >> > > method HTable.getScanner(byte[],byte[]) is not applicable
>> >> > > (actual and formal argument lists differ in length)
>> >> > > method HTable.getScanner(byte[]) is not applicable
>> >> > > (actual argument String[] cannot be converted to byte[] by method
>> >> > > invocation conversion)
>> >> > > method HTable.getScanner(Scan) is not applicable
>> >> > > (actual argument String[] cannot be converted to Scan by method
>> >> > > invocation conversion)
>> >> > > HBaseExample.java:46: error: cannot find symbol
>> >> > > RowResult rowResult = scanner.next();
>> >> > > ^
>> >> > > symbol: class RowResult
>> >> > > location: class HBaseExample
>> >> > > HBaseExample.java:55: error: cannot find symbol
>> >> > > for (RowResult result : scanner) {
>> >> > > ^
>> >> > > symbol: class RowResult
>> >> > > location: class HBaseExample
>> >> > > [total 461ms]
>> >> > > Note: HBaseExample.java uses or overrides a deprecated API.
>> >> > > Note: Recompile with -Xlint:deprecation for details.
>> >> > > 18 errors
>> >> > >
>> >> >
>> >> >
>> >> >
>> >>
>> >>
>> >>
>>

Re: connecting Hbase using java

Posted by Alok Singh Mahor <al...@gmail.com>.
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/jaxb-api-2.1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jaxb-impl-2.2.3-1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jersey-core-1.8.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jersey-json-1.8.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jersey-server-1.8.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jettison-1.1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jetty-6.1.26.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jetty-util-6.1.26.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jruby-complete-1.6.5.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jsp-2.1-6.1.14.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jsp-api-2.1-6.1.14.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/jsr305-1.3.9.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/junit-4.10-HBASE-1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/libthrift-0.8.0.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/log4j-1.2.16.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/metrics-core-2.1.2.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/netty-3.2.4.Final.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/protobuf-java-2.4.0a.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/servlet-api-2.5-6.1.14.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/slf4j-api-1.4.3.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/slf4j-log4j12-1.4.3.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/snappy-java-1.0.3.2.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/stax-api-1.0.1.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/velocity-1.7.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/xmlenc-0.52.jar:/home/alok/packages/hbase-0.94.6/bin/../lib/zookeeper-3.4.5.jar:



On Thu, Apr 4, 2013 at 5:54 AM, Jean-Marc Spaggiari <jean-marc@spaggiari.org
> wrote:

> What's the output of ~/packages/hbase-0.94.6/bin/hbase classpath?
>
> 2013/4/3 Alok Singh Mahor <al...@gmail.com>:
> > thank you Harsha
> > with your advice I used command to compile that example code
> > alok@alok:~/exp/hbase/exp$ javac -classpath
> > `~/packages/hbase-0.94.6/bin/hbase classpath` HBaseExample.java
> >
> > so errors reduced to 15 from 18
> > could you please what else I have to add
> >
> > please see the error
> >
> > alok@alok:~/exp/hbase/exp$ javac -classpath
> > `~/packages/hbase-0.94.6/bin/hbase classpath` HBaseExample.java
> > HBaseExample.java:5: error: cannot find symbol
> > import org.apache.hadoop.hbase.client.Scanner;
> >                                      ^
> >   symbol:   class Scanner
> >   location: package org.apache.hadoop.hbase.client
> > HBaseExample.java:6: error: cannot find symbol
> > import org.apache.hadoop.hbase.io.BatchUpdate;
> >                                  ^
> >   symbol:   class BatchUpdate
> >   location: package org.apache.hadoop.hbase.io
> > HBaseExample.java:7: error: cannot find symbol
> > import org.apache.hadoop.hbase.io.Cell;
> >                                  ^
> >   symbol:   class Cell
> >   location: package org.apache.hadoop.hbase.io
> > HBaseExample.java:8: error: cannot find symbol
> > import org.apache.hadoop.hbase.io.RowResult;
> >                                  ^
> >   symbol:   class RowResult
> >   location: package org.apache.hadoop.hbase.io
> > HBaseExample.java:20: error: cannot find symbol
> >         BatchUpdate batchUpdate = new BatchUpdate("test_row1");
> >         ^
> >   symbol:   class BatchUpdate
> >   location: class HBaseExample
> > HBaseExample.java:20: error: cannot find symbol
> >         BatchUpdate batchUpdate = new BatchUpdate("test_row1");
> >                                       ^
> >   symbol:   class BatchUpdate
> >   location: class HBaseExample
> > HBaseExample.java:25: error: cannot find symbol
> >         Cell cell = table.get("test_row1", "columnfamily1:column1");
> >         ^
> >   symbol:   class Cell
> >   location: class HBaseExample
> > HBaseExample.java:25: error: no suitable method found for
> get(String,String)
> >         Cell cell = table.get("test_row1", "columnfamily1:column1");
> >                          ^
> >     method HTable.get(List<Get>) is not applicable
> >       (actual and formal argument lists differ in length)
> >     method HTable.get(Get) is not applicable
> >       (actual and formal argument lists differ in length)
> > HBaseExample.java:31: error: cannot find symbol
> >         RowResult singleRow = table.getRow(Bytes.toBytes("test_row1"));
> >         ^
> >   symbol:   class RowResult
> >   location: class HBaseExample
> > HBaseExample.java:31: error: cannot find symbol
> >         RowResult singleRow = table.getRow(Bytes.toBytes("test_row1"));
> >                                    ^
> >   symbol:   method getRow(byte[])
> >   location: variable table of type HTable
> > HBaseExample.java:32: error: cannot find symbol
> >         Cell cell =
> singleRow.get(Bytes.toBytes("columnfamily1:column1"));
> >         ^
> >   symbol:   class Cell
> >   location: class HBaseExample
> > HBaseExample.java:42: error: cannot find symbol
> >         Scanner scanner = table.getScanner(
> >         ^
> >   symbol:   class Scanner
> >   location: class HBaseExample
> > HBaseExample.java:42: error: no suitable method found for
> > getScanner(String[])
> >         Scanner scanner = table.getScanner(
> >                                ^
> >     method HTable.getScanner(byte[],byte[]) is not applicable
> >       (actual and formal argument lists differ in length)
> >     method HTable.getScanner(byte[]) is not applicable
> >       (actual argument String[] cannot be converted to byte[] by method
> > invocation conversion)
> >     method HTable.getScanner(Scan) is not applicable
> >       (actual argument String[] cannot be converted to Scan by method
> > invocation conversion)
> > HBaseExample.java:46: error: cannot find symbol
> >         RowResult rowResult = scanner.next();
> >         ^
> >   symbol:   class RowResult
> >   location: class HBaseExample
> > HBaseExample.java:55: error: cannot find symbol
> >         for (RowResult result : scanner) {
> >              ^
> >   symbol:   class RowResult
> >   location: class HBaseExample
> > Note: HBaseExample.java uses or overrides a deprecated API.
> > Note: Recompile with -Xlint:deprecation for details.
> > 15 errors
> >
> >
> > On Thu, Apr 4, 2013 at 2:50 AM, Harsha <ha...@defun.org> wrote:
> >
> >> Alok,
> >>     run "hbase classpath" and try putting everything in it in class
> path.
> >> -Harsha
> >>
> >>
> >> --
> >> Harsha
> >>
> >>
> >> On Wednesday, April 3, 2013 at 9:59 AM, Andrea Gazzarini wrote:
> >>
> >> > I don't have my laptop with me at the momemt and honestly last time I
> >> > ran a javac from command line it was about ten years ago but my
> >> > questions is : are you sure you can use wildcard this way?
> >> > If I remember well, prior to JDK 1.6 you could not use widlcards at
> all,
> >> > and starting from 1.6 you can use *only* wildcard, without the ".jar"
> >> suffix
> >> >
> >> > Best,
> >> > Andrea
> >> >
> >> >
> >> > On 04/03/2013 06:37 PM, Alok Singh Mahor wrote:
> >> > > Hi all,
> >> > > today I start afresh a Example code on
> >> > > http://blog.rajeevsharma.in/2009/06/using-hbase-in-java-0193.html
> >> > > but I guess luck is not with me.
> >> > > I run
> >> > > javac -classpath
> >> > >
> >>
> ~/packages/hbase-0.94.6/hbase-0.94.6.jar:~/packages/hbase-0.94.6/lib/*:~/packages/hadoop-1.1.2/*.jar:~/packages/hadoop-1.1.2/lib/*.jar
> >> > > HBaseExample.java -verbose
> >> > >
> >> > > please tell me what else I need to add in path to resolve these
> errors
> >> > >
> >> > > thank you
> >> > >
> >> > >
> >> > > alok@alok:~/exp/hbase/exp$ javac -classpath
> >> > >
> >>
> ~/packages/hbase-0.94.6/hbase-0.94.6.jar:~/packages/hbase-0.94.6/lib/*:~/packages/hadoop-1.1.2/*.jar:~/packages/hadoop-1.1.2/lib/*.jar
> >> > > HBaseExample.java -verbose
> >> > > [parsing started RegularFileObject[HBaseExample.java]]
> >> > > [parsing completed 29ms]
> >> > > [search path for source files:
> >> > >
> >>
> /home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar,~/packages/hbase-0.94.6/lib/*,~/packages/hadoop-1.1.2/*.jar,~/packages/hadoop-1.1.2/lib/*.jar]
> >> > > [search path for class files:
> >> > >
> >>
> /usr/lib/jvm/java-7-openjdk-i386/jre/lib/resources.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/rt.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/sunrsasign.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jsse.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jce.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/charsets.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/netx.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/plugin.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/rhino.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jfr.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/classes,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/zipfs.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/sunjce_provider.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/sunpkcs11.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/pulse-java.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/dnsns.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/java-atk-wrapper.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/localedata.jar,/home/alok/pack
> >>
> >>
> ages/hbase-0.94.6/hbase-0.94.6.jar,~/packages/hbase-0.94.6/lib/*,~/packages/hadoop-1.1.2/*.jar,~/packages/hadoop-1.1.2/lib/*.jar]
> >> > > [loading
> >> > >
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/IOException.class)]]
> >> > > HBaseExample.java:2: error: package org.apache.hadoop.fs does not
> exist
> >> > > import org.apache.hadoop.fs.Path;
> >> > > ^
> >> > > [loading
> >> > >
> >>
> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/HBaseConfiguration.class)]]
> >> > > [loading
> >> > >
> >>
> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/client/HTable.class)]]
> >> > > HBaseExample.java:5: error: cannot find symbol
> >> > > import org.apache.hadoop.hbase.client.Scanner;
> >> > > ^
> >> > > symbol: class Scanner
> >> > > location: package org.apache.hadoop.hbase.client
> >> > > HBaseExample.java:6: error: cannot find symbol
> >> > > import org.apache.hadoop.hbase.io.BatchUpdate;
> >> > > ^
> >> > > symbol: class BatchUpdate
> >> > > location: package org.apache.hadoop.hbase.io (
> >> http://org.apache.hadoop.hbase.io)
> >> > > HBaseExample.java:7: error: cannot find symbol
> >> > > import org.apache.hadoop.hbase.io.Cell;
> >> > > ^
> >> > > symbol: class Cell
> >> > > location: package org.apache.hadoop.hbase.io (
> >> http://org.apache.hadoop.hbase.io)
> >> > > HBaseExample.java:8: error: cannot find symbol
> >> > > import org.apache.hadoop.hbase.io.RowResult;
> >> > > ^
> >> > > symbol: class RowResult
> >> > > location: package org.apache.hadoop.hbase.io (
> >> http://org.apache.hadoop.hbase.io)
> >> > > [loading
> >> > >
> >>
> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/util/Bytes.class)]]
> >> > > [loading
> >> > >
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Object.class)]]
> >> > > [loading
> >> > >
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/String.class)]]
> >> > > [checking HBaseExample]
> >> > > [loading
> >> > >
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/AutoCloseable.class)]]
> >> > > [loading
> >> > >
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Exception.class)]]
> >> > > [loading
> >> > >
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Throwable.class)]]
> >> > > HBaseExample.java:16: error: cannot find symbol
> >> > > conf.addResource(new Path("/opt/hbase-0.19.3/conf/hbase-site.xml"));
> >> > > ^
> >> > > symbol: class Path
> >> > > location: class HBaseExample
> >> > > HBaseExample.java:16: error: cannot access Configuration
> >> > > conf.addResource(new Path("/opt/hbase-0.19.3/conf/hbase-site.xml"));
> >> > > ^
> >> > > class file for org.apache.hadoop.conf.Configuration not found
> >> > > HBaseExample.java:20: error: cannot find symbol
> >> > > BatchUpdate batchUpdate = new BatchUpdate("test_row1");
> >> > > ^
> >> > > symbol: class BatchUpdate
> >> > > location: class HBaseExample
> >> > > HBaseExample.java:20: error: cannot find symbol
> >> > > BatchUpdate batchUpdate = new BatchUpdate("test_row1");
> >> > > ^
> >> > > symbol: class BatchUpdate
> >> > > location: class HBaseExample
> >> > > [loading
> >> > >
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/math/BigDecimal.class)]]
> >> > > [loading
> >> > >
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/nio/ByteBuffer.class)]]
> >> > > HBaseExample.java:25: error: cannot find symbol
> >> > > Cell cell = table.get("test_row1", "columnfamily1:column1");
> >> > > ^
> >> > > symbol: class Cell
> >> > > location: class HBaseExample
> >> > > [loading
> >> > >
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/util/List.class)]]
> >> > > HBaseExample.java:25: error: no suitable method found for
> >> get(String,String)
> >> > > Cell cell = table.get("test_row1", "columnfamily1:column1");
> >> > > ^
> >> > > method HTable.get(List<Get>) is not applicable
> >> > > (actual and formal argument lists differ in length)
> >> > > method HTable.get(Get) is not applicable
> >> > > (actual and formal argument lists differ in length)
> >> > > [loading
> >> > >
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/System.class)]]
> >> > > [loading
> >> > >
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/PrintStream.class)]]
> >> > > [loading
> >> > >
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/FilterOutputStream.class)]]
> >> > > [loading
> >> > >
> >>
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/OutputStream.class)]]
> >> > > HBaseExample.java:31: error: cannot find symbol
> >> > > RowResult singleRow = table.getRow(Bytes.toBytes("test_row1"));
> >> > > ^
> >> > > symbol: class RowResult
> >> > > location: class HBaseExample
> >> > > HBaseExample.java:31: error: cannot find symbol
> >> > > RowResult singleRow = table.getRow(Bytes.toBytes("test_row1"));
> >> > > ^
> >> > > symbol: method getRow(byte[])
> >> > > location: variable table of type HTable
> >> > > HBaseExample.java:32: error: cannot find symbol
> >> > > Cell cell = singleRow.get(Bytes.toBytes("columnfamily1:column1"));
> >> > > ^
> >> > > symbol: class Cell
> >> > > location: class HBaseExample
> >> > > HBaseExample.java:42: error: cannot find symbol
> >> > > Scanner scanner = table.getScanner(
> >> > > ^
> >> > > symbol: class Scanner
> >> > > location: class HBaseExample
> >> > > [loading
> >> > >
> >>
> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/client/Scan.class)]]
> >> > > HBaseExample.java:42: error: no suitable method found for
> >> > > getScanner(String[])
> >> > > Scanner scanner = table.getScanner(
> >> > > ^
> >> > > method HTable.getScanner(byte[],byte[]) is not applicable
> >> > > (actual and formal argument lists differ in length)
> >> > > method HTable.getScanner(byte[]) is not applicable
> >> > > (actual argument String[] cannot be converted to byte[] by method
> >> > > invocation conversion)
> >> > > method HTable.getScanner(Scan) is not applicable
> >> > > (actual argument String[] cannot be converted to Scan by method
> >> > > invocation conversion)
> >> > > HBaseExample.java:46: error: cannot find symbol
> >> > > RowResult rowResult = scanner.next();
> >> > > ^
> >> > > symbol: class RowResult
> >> > > location: class HBaseExample
> >> > > HBaseExample.java:55: error: cannot find symbol
> >> > > for (RowResult result : scanner) {
> >> > > ^
> >> > > symbol: class RowResult
> >> > > location: class HBaseExample
> >> > > [total 461ms]
> >> > > Note: HBaseExample.java uses or overrides a deprecated API.
> >> > > Note: Recompile with -Xlint:deprecation for details.
> >> > > 18 errors
> >> > >
> >> >
> >> >
> >> >
> >>
> >>
> >>
>

Re: connecting Hbase using java

Posted by Jean-Marc Spaggiari <je...@spaggiari.org>.
What's the output of ~/packages/hbase-0.94.6/bin/hbase classpath?

2013/4/3 Alok Singh Mahor <al...@gmail.com>:
> thank you Harsha
> with your advice I used command to compile that example code
> alok@alok:~/exp/hbase/exp$ javac -classpath
> `~/packages/hbase-0.94.6/bin/hbase classpath` HBaseExample.java
>
> so errors reduced to 15 from 18
> could you please what else I have to add
>
> please see the error
>
> alok@alok:~/exp/hbase/exp$ javac -classpath
> `~/packages/hbase-0.94.6/bin/hbase classpath` HBaseExample.java
> HBaseExample.java:5: error: cannot find symbol
> import org.apache.hadoop.hbase.client.Scanner;
>                                      ^
>   symbol:   class Scanner
>   location: package org.apache.hadoop.hbase.client
> HBaseExample.java:6: error: cannot find symbol
> import org.apache.hadoop.hbase.io.BatchUpdate;
>                                  ^
>   symbol:   class BatchUpdate
>   location: package org.apache.hadoop.hbase.io
> HBaseExample.java:7: error: cannot find symbol
> import org.apache.hadoop.hbase.io.Cell;
>                                  ^
>   symbol:   class Cell
>   location: package org.apache.hadoop.hbase.io
> HBaseExample.java:8: error: cannot find symbol
> import org.apache.hadoop.hbase.io.RowResult;
>                                  ^
>   symbol:   class RowResult
>   location: package org.apache.hadoop.hbase.io
> HBaseExample.java:20: error: cannot find symbol
>         BatchUpdate batchUpdate = new BatchUpdate("test_row1");
>         ^
>   symbol:   class BatchUpdate
>   location: class HBaseExample
> HBaseExample.java:20: error: cannot find symbol
>         BatchUpdate batchUpdate = new BatchUpdate("test_row1");
>                                       ^
>   symbol:   class BatchUpdate
>   location: class HBaseExample
> HBaseExample.java:25: error: cannot find symbol
>         Cell cell = table.get("test_row1", "columnfamily1:column1");
>         ^
>   symbol:   class Cell
>   location: class HBaseExample
> HBaseExample.java:25: error: no suitable method found for get(String,String)
>         Cell cell = table.get("test_row1", "columnfamily1:column1");
>                          ^
>     method HTable.get(List<Get>) is not applicable
>       (actual and formal argument lists differ in length)
>     method HTable.get(Get) is not applicable
>       (actual and formal argument lists differ in length)
> HBaseExample.java:31: error: cannot find symbol
>         RowResult singleRow = table.getRow(Bytes.toBytes("test_row1"));
>         ^
>   symbol:   class RowResult
>   location: class HBaseExample
> HBaseExample.java:31: error: cannot find symbol
>         RowResult singleRow = table.getRow(Bytes.toBytes("test_row1"));
>                                    ^
>   symbol:   method getRow(byte[])
>   location: variable table of type HTable
> HBaseExample.java:32: error: cannot find symbol
>         Cell cell = singleRow.get(Bytes.toBytes("columnfamily1:column1"));
>         ^
>   symbol:   class Cell
>   location: class HBaseExample
> HBaseExample.java:42: error: cannot find symbol
>         Scanner scanner = table.getScanner(
>         ^
>   symbol:   class Scanner
>   location: class HBaseExample
> HBaseExample.java:42: error: no suitable method found for
> getScanner(String[])
>         Scanner scanner = table.getScanner(
>                                ^
>     method HTable.getScanner(byte[],byte[]) is not applicable
>       (actual and formal argument lists differ in length)
>     method HTable.getScanner(byte[]) is not applicable
>       (actual argument String[] cannot be converted to byte[] by method
> invocation conversion)
>     method HTable.getScanner(Scan) is not applicable
>       (actual argument String[] cannot be converted to Scan by method
> invocation conversion)
> HBaseExample.java:46: error: cannot find symbol
>         RowResult rowResult = scanner.next();
>         ^
>   symbol:   class RowResult
>   location: class HBaseExample
> HBaseExample.java:55: error: cannot find symbol
>         for (RowResult result : scanner) {
>              ^
>   symbol:   class RowResult
>   location: class HBaseExample
> Note: HBaseExample.java uses or overrides a deprecated API.
> Note: Recompile with -Xlint:deprecation for details.
> 15 errors
>
>
> On Thu, Apr 4, 2013 at 2:50 AM, Harsha <ha...@defun.org> wrote:
>
>> Alok,
>>     run "hbase classpath" and try putting everything in it in class path.
>> -Harsha
>>
>>
>> --
>> Harsha
>>
>>
>> On Wednesday, April 3, 2013 at 9:59 AM, Andrea Gazzarini wrote:
>>
>> > I don't have my laptop with me at the momemt and honestly last time I
>> > ran a javac from command line it was about ten years ago but my
>> > questions is : are you sure you can use wildcard this way?
>> > If I remember well, prior to JDK 1.6 you could not use widlcards at all,
>> > and starting from 1.6 you can use *only* wildcard, without the ".jar"
>> suffix
>> >
>> > Best,
>> > Andrea
>> >
>> >
>> > On 04/03/2013 06:37 PM, Alok Singh Mahor wrote:
>> > > Hi all,
>> > > today I start afresh a Example code on
>> > > http://blog.rajeevsharma.in/2009/06/using-hbase-in-java-0193.html
>> > > but I guess luck is not with me.
>> > > I run
>> > > javac -classpath
>> > >
>> ~/packages/hbase-0.94.6/hbase-0.94.6.jar:~/packages/hbase-0.94.6/lib/*:~/packages/hadoop-1.1.2/*.jar:~/packages/hadoop-1.1.2/lib/*.jar
>> > > HBaseExample.java -verbose
>> > >
>> > > please tell me what else I need to add in path to resolve these errors
>> > >
>> > > thank you
>> > >
>> > >
>> > > alok@alok:~/exp/hbase/exp$ javac -classpath
>> > >
>> ~/packages/hbase-0.94.6/hbase-0.94.6.jar:~/packages/hbase-0.94.6/lib/*:~/packages/hadoop-1.1.2/*.jar:~/packages/hadoop-1.1.2/lib/*.jar
>> > > HBaseExample.java -verbose
>> > > [parsing started RegularFileObject[HBaseExample.java]]
>> > > [parsing completed 29ms]
>> > > [search path for source files:
>> > >
>> /home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar,~/packages/hbase-0.94.6/lib/*,~/packages/hadoop-1.1.2/*.jar,~/packages/hadoop-1.1.2/lib/*.jar]
>> > > [search path for class files:
>> > >
>> /usr/lib/jvm/java-7-openjdk-i386/jre/lib/resources.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/rt.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/sunrsasign.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jsse.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jce.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/charsets.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/netx.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/plugin.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/rhino.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jfr.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/classes,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/zipfs.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/sunjce_provider.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/sunpkcs11.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/pulse-java.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/dnsns.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/java-atk-wrapper.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/localedata.jar,/home/alok/pack
>>
>> ages/hbase-0.94.6/hbase-0.94.6.jar,~/packages/hbase-0.94.6/lib/*,~/packages/hadoop-1.1.2/*.jar,~/packages/hadoop-1.1.2/lib/*.jar]
>> > > [loading
>> > >
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/IOException.class)]]
>> > > HBaseExample.java:2: error: package org.apache.hadoop.fs does not exist
>> > > import org.apache.hadoop.fs.Path;
>> > > ^
>> > > [loading
>> > >
>> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/HBaseConfiguration.class)]]
>> > > [loading
>> > >
>> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/client/HTable.class)]]
>> > > HBaseExample.java:5: error: cannot find symbol
>> > > import org.apache.hadoop.hbase.client.Scanner;
>> > > ^
>> > > symbol: class Scanner
>> > > location: package org.apache.hadoop.hbase.client
>> > > HBaseExample.java:6: error: cannot find symbol
>> > > import org.apache.hadoop.hbase.io.BatchUpdate;
>> > > ^
>> > > symbol: class BatchUpdate
>> > > location: package org.apache.hadoop.hbase.io (
>> http://org.apache.hadoop.hbase.io)
>> > > HBaseExample.java:7: error: cannot find symbol
>> > > import org.apache.hadoop.hbase.io.Cell;
>> > > ^
>> > > symbol: class Cell
>> > > location: package org.apache.hadoop.hbase.io (
>> http://org.apache.hadoop.hbase.io)
>> > > HBaseExample.java:8: error: cannot find symbol
>> > > import org.apache.hadoop.hbase.io.RowResult;
>> > > ^
>> > > symbol: class RowResult
>> > > location: package org.apache.hadoop.hbase.io (
>> http://org.apache.hadoop.hbase.io)
>> > > [loading
>> > >
>> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/util/Bytes.class)]]
>> > > [loading
>> > >
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Object.class)]]
>> > > [loading
>> > >
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/String.class)]]
>> > > [checking HBaseExample]
>> > > [loading
>> > >
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/AutoCloseable.class)]]
>> > > [loading
>> > >
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Exception.class)]]
>> > > [loading
>> > >
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Throwable.class)]]
>> > > HBaseExample.java:16: error: cannot find symbol
>> > > conf.addResource(new Path("/opt/hbase-0.19.3/conf/hbase-site.xml"));
>> > > ^
>> > > symbol: class Path
>> > > location: class HBaseExample
>> > > HBaseExample.java:16: error: cannot access Configuration
>> > > conf.addResource(new Path("/opt/hbase-0.19.3/conf/hbase-site.xml"));
>> > > ^
>> > > class file for org.apache.hadoop.conf.Configuration not found
>> > > HBaseExample.java:20: error: cannot find symbol
>> > > BatchUpdate batchUpdate = new BatchUpdate("test_row1");
>> > > ^
>> > > symbol: class BatchUpdate
>> > > location: class HBaseExample
>> > > HBaseExample.java:20: error: cannot find symbol
>> > > BatchUpdate batchUpdate = new BatchUpdate("test_row1");
>> > > ^
>> > > symbol: class BatchUpdate
>> > > location: class HBaseExample
>> > > [loading
>> > >
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/math/BigDecimal.class)]]
>> > > [loading
>> > >
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/nio/ByteBuffer.class)]]
>> > > HBaseExample.java:25: error: cannot find symbol
>> > > Cell cell = table.get("test_row1", "columnfamily1:column1");
>> > > ^
>> > > symbol: class Cell
>> > > location: class HBaseExample
>> > > [loading
>> > >
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/util/List.class)]]
>> > > HBaseExample.java:25: error: no suitable method found for
>> get(String,String)
>> > > Cell cell = table.get("test_row1", "columnfamily1:column1");
>> > > ^
>> > > method HTable.get(List<Get>) is not applicable
>> > > (actual and formal argument lists differ in length)
>> > > method HTable.get(Get) is not applicable
>> > > (actual and formal argument lists differ in length)
>> > > [loading
>> > >
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/System.class)]]
>> > > [loading
>> > >
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/PrintStream.class)]]
>> > > [loading
>> > >
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/FilterOutputStream.class)]]
>> > > [loading
>> > >
>> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/OutputStream.class)]]
>> > > HBaseExample.java:31: error: cannot find symbol
>> > > RowResult singleRow = table.getRow(Bytes.toBytes("test_row1"));
>> > > ^
>> > > symbol: class RowResult
>> > > location: class HBaseExample
>> > > HBaseExample.java:31: error: cannot find symbol
>> > > RowResult singleRow = table.getRow(Bytes.toBytes("test_row1"));
>> > > ^
>> > > symbol: method getRow(byte[])
>> > > location: variable table of type HTable
>> > > HBaseExample.java:32: error: cannot find symbol
>> > > Cell cell = singleRow.get(Bytes.toBytes("columnfamily1:column1"));
>> > > ^
>> > > symbol: class Cell
>> > > location: class HBaseExample
>> > > HBaseExample.java:42: error: cannot find symbol
>> > > Scanner scanner = table.getScanner(
>> > > ^
>> > > symbol: class Scanner
>> > > location: class HBaseExample
>> > > [loading
>> > >
>> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/client/Scan.class)]]
>> > > HBaseExample.java:42: error: no suitable method found for
>> > > getScanner(String[])
>> > > Scanner scanner = table.getScanner(
>> > > ^
>> > > method HTable.getScanner(byte[],byte[]) is not applicable
>> > > (actual and formal argument lists differ in length)
>> > > method HTable.getScanner(byte[]) is not applicable
>> > > (actual argument String[] cannot be converted to byte[] by method
>> > > invocation conversion)
>> > > method HTable.getScanner(Scan) is not applicable
>> > > (actual argument String[] cannot be converted to Scan by method
>> > > invocation conversion)
>> > > HBaseExample.java:46: error: cannot find symbol
>> > > RowResult rowResult = scanner.next();
>> > > ^
>> > > symbol: class RowResult
>> > > location: class HBaseExample
>> > > HBaseExample.java:55: error: cannot find symbol
>> > > for (RowResult result : scanner) {
>> > > ^
>> > > symbol: class RowResult
>> > > location: class HBaseExample
>> > > [total 461ms]
>> > > Note: HBaseExample.java uses or overrides a deprecated API.
>> > > Note: Recompile with -Xlint:deprecation for details.
>> > > 18 errors
>> > >
>> >
>> >
>> >
>>
>>
>>

Re: connecting Hbase using java

Posted by Alok Singh Mahor <al...@gmail.com>.
thank you Harsha
with your advice I used command to compile that example code
alok@alok:~/exp/hbase/exp$ javac -classpath
`~/packages/hbase-0.94.6/bin/hbase classpath` HBaseExample.java

so errors reduced to 15 from 18
could you please what else I have to add

please see the error

alok@alok:~/exp/hbase/exp$ javac -classpath
`~/packages/hbase-0.94.6/bin/hbase classpath` HBaseExample.java
HBaseExample.java:5: error: cannot find symbol
import org.apache.hadoop.hbase.client.Scanner;
                                     ^
  symbol:   class Scanner
  location: package org.apache.hadoop.hbase.client
HBaseExample.java:6: error: cannot find symbol
import org.apache.hadoop.hbase.io.BatchUpdate;
                                 ^
  symbol:   class BatchUpdate
  location: package org.apache.hadoop.hbase.io
HBaseExample.java:7: error: cannot find symbol
import org.apache.hadoop.hbase.io.Cell;
                                 ^
  symbol:   class Cell
  location: package org.apache.hadoop.hbase.io
HBaseExample.java:8: error: cannot find symbol
import org.apache.hadoop.hbase.io.RowResult;
                                 ^
  symbol:   class RowResult
  location: package org.apache.hadoop.hbase.io
HBaseExample.java:20: error: cannot find symbol
        BatchUpdate batchUpdate = new BatchUpdate("test_row1");
        ^
  symbol:   class BatchUpdate
  location: class HBaseExample
HBaseExample.java:20: error: cannot find symbol
        BatchUpdate batchUpdate = new BatchUpdate("test_row1");
                                      ^
  symbol:   class BatchUpdate
  location: class HBaseExample
HBaseExample.java:25: error: cannot find symbol
        Cell cell = table.get("test_row1", "columnfamily1:column1");
        ^
  symbol:   class Cell
  location: class HBaseExample
HBaseExample.java:25: error: no suitable method found for get(String,String)
        Cell cell = table.get("test_row1", "columnfamily1:column1");
                         ^
    method HTable.get(List<Get>) is not applicable
      (actual and formal argument lists differ in length)
    method HTable.get(Get) is not applicable
      (actual and formal argument lists differ in length)
HBaseExample.java:31: error: cannot find symbol
        RowResult singleRow = table.getRow(Bytes.toBytes("test_row1"));
        ^
  symbol:   class RowResult
  location: class HBaseExample
HBaseExample.java:31: error: cannot find symbol
        RowResult singleRow = table.getRow(Bytes.toBytes("test_row1"));
                                   ^
  symbol:   method getRow(byte[])
  location: variable table of type HTable
HBaseExample.java:32: error: cannot find symbol
        Cell cell = singleRow.get(Bytes.toBytes("columnfamily1:column1"));
        ^
  symbol:   class Cell
  location: class HBaseExample
HBaseExample.java:42: error: cannot find symbol
        Scanner scanner = table.getScanner(
        ^
  symbol:   class Scanner
  location: class HBaseExample
HBaseExample.java:42: error: no suitable method found for
getScanner(String[])
        Scanner scanner = table.getScanner(
                               ^
    method HTable.getScanner(byte[],byte[]) is not applicable
      (actual and formal argument lists differ in length)
    method HTable.getScanner(byte[]) is not applicable
      (actual argument String[] cannot be converted to byte[] by method
invocation conversion)
    method HTable.getScanner(Scan) is not applicable
      (actual argument String[] cannot be converted to Scan by method
invocation conversion)
HBaseExample.java:46: error: cannot find symbol
        RowResult rowResult = scanner.next();
        ^
  symbol:   class RowResult
  location: class HBaseExample
HBaseExample.java:55: error: cannot find symbol
        for (RowResult result : scanner) {
             ^
  symbol:   class RowResult
  location: class HBaseExample
Note: HBaseExample.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
15 errors


On Thu, Apr 4, 2013 at 2:50 AM, Harsha <ha...@defun.org> wrote:

> Alok,
>     run "hbase classpath" and try putting everything in it in class path.
> -Harsha
>
>
> --
> Harsha
>
>
> On Wednesday, April 3, 2013 at 9:59 AM, Andrea Gazzarini wrote:
>
> > I don't have my laptop with me at the momemt and honestly last time I
> > ran a javac from command line it was about ten years ago but my
> > questions is : are you sure you can use wildcard this way?
> > If I remember well, prior to JDK 1.6 you could not use widlcards at all,
> > and starting from 1.6 you can use *only* wildcard, without the ".jar"
> suffix
> >
> > Best,
> > Andrea
> >
> >
> > On 04/03/2013 06:37 PM, Alok Singh Mahor wrote:
> > > Hi all,
> > > today I start afresh a Example code on
> > > http://blog.rajeevsharma.in/2009/06/using-hbase-in-java-0193.html
> > > but I guess luck is not with me.
> > > I run
> > > javac -classpath
> > >
> ~/packages/hbase-0.94.6/hbase-0.94.6.jar:~/packages/hbase-0.94.6/lib/*:~/packages/hadoop-1.1.2/*.jar:~/packages/hadoop-1.1.2/lib/*.jar
> > > HBaseExample.java -verbose
> > >
> > > please tell me what else I need to add in path to resolve these errors
> > >
> > > thank you
> > >
> > >
> > > alok@alok:~/exp/hbase/exp$ javac -classpath
> > >
> ~/packages/hbase-0.94.6/hbase-0.94.6.jar:~/packages/hbase-0.94.6/lib/*:~/packages/hadoop-1.1.2/*.jar:~/packages/hadoop-1.1.2/lib/*.jar
> > > HBaseExample.java -verbose
> > > [parsing started RegularFileObject[HBaseExample.java]]
> > > [parsing completed 29ms]
> > > [search path for source files:
> > >
> /home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar,~/packages/hbase-0.94.6/lib/*,~/packages/hadoop-1.1.2/*.jar,~/packages/hadoop-1.1.2/lib/*.jar]
> > > [search path for class files:
> > >
> /usr/lib/jvm/java-7-openjdk-i386/jre/lib/resources.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/rt.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/sunrsasign.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jsse.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jce.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/charsets.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/netx.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/plugin.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/rhino.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jfr.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/classes,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/zipfs.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/sunjce_provider.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/sunpkcs11.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/pulse-java.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/dnsns.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/java-atk-wrapper.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/localedata.jar,/home/alok/pack
>
> ages/hbase-0.94.6/hbase-0.94.6.jar,~/packages/hbase-0.94.6/lib/*,~/packages/hadoop-1.1.2/*.jar,~/packages/hadoop-1.1.2/lib/*.jar]
> > > [loading
> > >
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/IOException.class)]]
> > > HBaseExample.java:2: error: package org.apache.hadoop.fs does not exist
> > > import org.apache.hadoop.fs.Path;
> > > ^
> > > [loading
> > >
> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/HBaseConfiguration.class)]]
> > > [loading
> > >
> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/client/HTable.class)]]
> > > HBaseExample.java:5: error: cannot find symbol
> > > import org.apache.hadoop.hbase.client.Scanner;
> > > ^
> > > symbol: class Scanner
> > > location: package org.apache.hadoop.hbase.client
> > > HBaseExample.java:6: error: cannot find symbol
> > > import org.apache.hadoop.hbase.io.BatchUpdate;
> > > ^
> > > symbol: class BatchUpdate
> > > location: package org.apache.hadoop.hbase.io (
> http://org.apache.hadoop.hbase.io)
> > > HBaseExample.java:7: error: cannot find symbol
> > > import org.apache.hadoop.hbase.io.Cell;
> > > ^
> > > symbol: class Cell
> > > location: package org.apache.hadoop.hbase.io (
> http://org.apache.hadoop.hbase.io)
> > > HBaseExample.java:8: error: cannot find symbol
> > > import org.apache.hadoop.hbase.io.RowResult;
> > > ^
> > > symbol: class RowResult
> > > location: package org.apache.hadoop.hbase.io (
> http://org.apache.hadoop.hbase.io)
> > > [loading
> > >
> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/util/Bytes.class)]]
> > > [loading
> > >
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Object.class)]]
> > > [loading
> > >
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/String.class)]]
> > > [checking HBaseExample]
> > > [loading
> > >
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/AutoCloseable.class)]]
> > > [loading
> > >
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Exception.class)]]
> > > [loading
> > >
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Throwable.class)]]
> > > HBaseExample.java:16: error: cannot find symbol
> > > conf.addResource(new Path("/opt/hbase-0.19.3/conf/hbase-site.xml"));
> > > ^
> > > symbol: class Path
> > > location: class HBaseExample
> > > HBaseExample.java:16: error: cannot access Configuration
> > > conf.addResource(new Path("/opt/hbase-0.19.3/conf/hbase-site.xml"));
> > > ^
> > > class file for org.apache.hadoop.conf.Configuration not found
> > > HBaseExample.java:20: error: cannot find symbol
> > > BatchUpdate batchUpdate = new BatchUpdate("test_row1");
> > > ^
> > > symbol: class BatchUpdate
> > > location: class HBaseExample
> > > HBaseExample.java:20: error: cannot find symbol
> > > BatchUpdate batchUpdate = new BatchUpdate("test_row1");
> > > ^
> > > symbol: class BatchUpdate
> > > location: class HBaseExample
> > > [loading
> > >
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/math/BigDecimal.class)]]
> > > [loading
> > >
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/nio/ByteBuffer.class)]]
> > > HBaseExample.java:25: error: cannot find symbol
> > > Cell cell = table.get("test_row1", "columnfamily1:column1");
> > > ^
> > > symbol: class Cell
> > > location: class HBaseExample
> > > [loading
> > >
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/util/List.class)]]
> > > HBaseExample.java:25: error: no suitable method found for
> get(String,String)
> > > Cell cell = table.get("test_row1", "columnfamily1:column1");
> > > ^
> > > method HTable.get(List<Get>) is not applicable
> > > (actual and formal argument lists differ in length)
> > > method HTable.get(Get) is not applicable
> > > (actual and formal argument lists differ in length)
> > > [loading
> > >
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/System.class)]]
> > > [loading
> > >
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/PrintStream.class)]]
> > > [loading
> > >
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/FilterOutputStream.class)]]
> > > [loading
> > >
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/OutputStream.class)]]
> > > HBaseExample.java:31: error: cannot find symbol
> > > RowResult singleRow = table.getRow(Bytes.toBytes("test_row1"));
> > > ^
> > > symbol: class RowResult
> > > location: class HBaseExample
> > > HBaseExample.java:31: error: cannot find symbol
> > > RowResult singleRow = table.getRow(Bytes.toBytes("test_row1"));
> > > ^
> > > symbol: method getRow(byte[])
> > > location: variable table of type HTable
> > > HBaseExample.java:32: error: cannot find symbol
> > > Cell cell = singleRow.get(Bytes.toBytes("columnfamily1:column1"));
> > > ^
> > > symbol: class Cell
> > > location: class HBaseExample
> > > HBaseExample.java:42: error: cannot find symbol
> > > Scanner scanner = table.getScanner(
> > > ^
> > > symbol: class Scanner
> > > location: class HBaseExample
> > > [loading
> > >
> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/client/Scan.class)]]
> > > HBaseExample.java:42: error: no suitable method found for
> > > getScanner(String[])
> > > Scanner scanner = table.getScanner(
> > > ^
> > > method HTable.getScanner(byte[],byte[]) is not applicable
> > > (actual and formal argument lists differ in length)
> > > method HTable.getScanner(byte[]) is not applicable
> > > (actual argument String[] cannot be converted to byte[] by method
> > > invocation conversion)
> > > method HTable.getScanner(Scan) is not applicable
> > > (actual argument String[] cannot be converted to Scan by method
> > > invocation conversion)
> > > HBaseExample.java:46: error: cannot find symbol
> > > RowResult rowResult = scanner.next();
> > > ^
> > > symbol: class RowResult
> > > location: class HBaseExample
> > > HBaseExample.java:55: error: cannot find symbol
> > > for (RowResult result : scanner) {
> > > ^
> > > symbol: class RowResult
> > > location: class HBaseExample
> > > [total 461ms]
> > > Note: HBaseExample.java uses or overrides a deprecated API.
> > > Note: Recompile with -Xlint:deprecation for details.
> > > 18 errors
> > >
> >
> >
> >
>
>
>

Re: connecting Hbase using java

Posted by Harsha <ha...@defun.org>.
Alok,
    run "hbase classpath" and try putting everything in it in class path.
-Harsha


-- 
Harsha


On Wednesday, April 3, 2013 at 9:59 AM, Andrea Gazzarini wrote:

> I don't have my laptop with me at the momemt and honestly last time I 
> ran a javac from command line it was about ten years ago but my 
> questions is : are you sure you can use wildcard this way?
> If I remember well, prior to JDK 1.6 you could not use widlcards at all, 
> and starting from 1.6 you can use *only* wildcard, without the ".jar" suffix
> 
> Best,
> Andrea
> 
> 
> On 04/03/2013 06:37 PM, Alok Singh Mahor wrote:
> > Hi all,
> > today I start afresh a Example code on
> > http://blog.rajeevsharma.in/2009/06/using-hbase-in-java-0193.html
> > but I guess luck is not with me.
> > I run
> > javac -classpath
> > ~/packages/hbase-0.94.6/hbase-0.94.6.jar:~/packages/hbase-0.94.6/lib/*:~/packages/hadoop-1.1.2/*.jar:~/packages/hadoop-1.1.2/lib/*.jar
> > HBaseExample.java -verbose
> > 
> > please tell me what else I need to add in path to resolve these errors
> > 
> > thank you
> > 
> > 
> > alok@alok:~/exp/hbase/exp$ javac -classpath
> > ~/packages/hbase-0.94.6/hbase-0.94.6.jar:~/packages/hbase-0.94.6/lib/*:~/packages/hadoop-1.1.2/*.jar:~/packages/hadoop-1.1.2/lib/*.jar
> > HBaseExample.java -verbose
> > [parsing started RegularFileObject[HBaseExample.java]]
> > [parsing completed 29ms]
> > [search path for source files:
> > /home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar,~/packages/hbase-0.94.6/lib/*,~/packages/hadoop-1.1.2/*.jar,~/packages/hadoop-1.1.2/lib/*.jar]
> > [search path for class files:
> > /usr/lib/jvm/java-7-openjdk-i386/jre/lib/resources.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/rt.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/sunrsasign.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jsse.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jce.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/charsets.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/netx.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/plugin.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/rhino.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jfr.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/classes,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/zipfs.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/sunjce_provider.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/sunpkcs11.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/pulse-java.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/dnsns.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/java-atk-wrapper.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/localedata.jar,/home/alok/pack
ages/hbase-0.94.6/hbase-0.94.6.jar,~/packages/hbase-0.94.6/lib/*,~/packages/hadoop-1.1.2/*.jar,~/packages/hadoop-1.1.2/lib/*.jar]
> > [loading
> > ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/IOException.class)]]
> > HBaseExample.java:2: error: package org.apache.hadoop.fs does not exist
> > import org.apache.hadoop.fs.Path;
> > ^
> > [loading
> > ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/HBaseConfiguration.class)]]
> > [loading
> > ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/client/HTable.class)]]
> > HBaseExample.java:5: error: cannot find symbol
> > import org.apache.hadoop.hbase.client.Scanner;
> > ^
> > symbol: class Scanner
> > location: package org.apache.hadoop.hbase.client
> > HBaseExample.java:6: error: cannot find symbol
> > import org.apache.hadoop.hbase.io.BatchUpdate;
> > ^
> > symbol: class BatchUpdate
> > location: package org.apache.hadoop.hbase.io (http://org.apache.hadoop.hbase.io)
> > HBaseExample.java:7: error: cannot find symbol
> > import org.apache.hadoop.hbase.io.Cell;
> > ^
> > symbol: class Cell
> > location: package org.apache.hadoop.hbase.io (http://org.apache.hadoop.hbase.io)
> > HBaseExample.java:8: error: cannot find symbol
> > import org.apache.hadoop.hbase.io.RowResult;
> > ^
> > symbol: class RowResult
> > location: package org.apache.hadoop.hbase.io (http://org.apache.hadoop.hbase.io)
> > [loading
> > ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/util/Bytes.class)]]
> > [loading
> > ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Object.class)]]
> > [loading
> > ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/String.class)]]
> > [checking HBaseExample]
> > [loading
> > ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/AutoCloseable.class)]]
> > [loading
> > ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Exception.class)]]
> > [loading
> > ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Throwable.class)]]
> > HBaseExample.java:16: error: cannot find symbol
> > conf.addResource(new Path("/opt/hbase-0.19.3/conf/hbase-site.xml"));
> > ^
> > symbol: class Path
> > location: class HBaseExample
> > HBaseExample.java:16: error: cannot access Configuration
> > conf.addResource(new Path("/opt/hbase-0.19.3/conf/hbase-site.xml"));
> > ^
> > class file for org.apache.hadoop.conf.Configuration not found
> > HBaseExample.java:20: error: cannot find symbol
> > BatchUpdate batchUpdate = new BatchUpdate("test_row1");
> > ^
> > symbol: class BatchUpdate
> > location: class HBaseExample
> > HBaseExample.java:20: error: cannot find symbol
> > BatchUpdate batchUpdate = new BatchUpdate("test_row1");
> > ^
> > symbol: class BatchUpdate
> > location: class HBaseExample
> > [loading
> > ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/math/BigDecimal.class)]]
> > [loading
> > ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/nio/ByteBuffer.class)]]
> > HBaseExample.java:25: error: cannot find symbol
> > Cell cell = table.get("test_row1", "columnfamily1:column1");
> > ^
> > symbol: class Cell
> > location: class HBaseExample
> > [loading
> > ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/util/List.class)]]
> > HBaseExample.java:25: error: no suitable method found for get(String,String)
> > Cell cell = table.get("test_row1", "columnfamily1:column1");
> > ^
> > method HTable.get(List<Get>) is not applicable
> > (actual and formal argument lists differ in length)
> > method HTable.get(Get) is not applicable
> > (actual and formal argument lists differ in length)
> > [loading
> > ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/System.class)]]
> > [loading
> > ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/PrintStream.class)]]
> > [loading
> > ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/FilterOutputStream.class)]]
> > [loading
> > ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/OutputStream.class)]]
> > HBaseExample.java:31: error: cannot find symbol
> > RowResult singleRow = table.getRow(Bytes.toBytes("test_row1"));
> > ^
> > symbol: class RowResult
> > location: class HBaseExample
> > HBaseExample.java:31: error: cannot find symbol
> > RowResult singleRow = table.getRow(Bytes.toBytes("test_row1"));
> > ^
> > symbol: method getRow(byte[])
> > location: variable table of type HTable
> > HBaseExample.java:32: error: cannot find symbol
> > Cell cell = singleRow.get(Bytes.toBytes("columnfamily1:column1"));
> > ^
> > symbol: class Cell
> > location: class HBaseExample
> > HBaseExample.java:42: error: cannot find symbol
> > Scanner scanner = table.getScanner(
> > ^
> > symbol: class Scanner
> > location: class HBaseExample
> > [loading
> > ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/client/Scan.class)]]
> > HBaseExample.java:42: error: no suitable method found for
> > getScanner(String[])
> > Scanner scanner = table.getScanner(
> > ^
> > method HTable.getScanner(byte[],byte[]) is not applicable
> > (actual and formal argument lists differ in length)
> > method HTable.getScanner(byte[]) is not applicable
> > (actual argument String[] cannot be converted to byte[] by method
> > invocation conversion)
> > method HTable.getScanner(Scan) is not applicable
> > (actual argument String[] cannot be converted to Scan by method
> > invocation conversion)
> > HBaseExample.java:46: error: cannot find symbol
> > RowResult rowResult = scanner.next();
> > ^
> > symbol: class RowResult
> > location: class HBaseExample
> > HBaseExample.java:55: error: cannot find symbol
> > for (RowResult result : scanner) {
> > ^
> > symbol: class RowResult
> > location: class HBaseExample
> > [total 461ms]
> > Note: HBaseExample.java uses or overrides a deprecated API.
> > Note: Recompile with -Xlint:deprecation for details.
> > 18 errors
> > 
> 
> 
> 



Re: connecting Hbase using java

Posted by Andrea Gazzarini <an...@gmail.com>.
I don't have my laptop with me at the momemt and honestly last time I 
ran a javac from command line it was about ten years ago but my 
questions is : are you sure you can use wildcard this way?
If I remember well, prior to JDK 1.6 you could not use widlcards at all, 
and starting from 1.6 you can use *only* wildcard, without the ".jar" suffix

Best,
Andrea


On 04/03/2013 06:37 PM, Alok Singh Mahor wrote:
> Hi all,
> today I start afresh a Example code on
> http://blog.rajeevsharma.in/2009/06/using-hbase-in-java-0193.html
> but I guess luck is not with me.
> I run
> javac -classpath
> ~/packages/hbase-0.94.6/hbase-0.94.6.jar:~/packages/hbase-0.94.6/lib/*:~/packages/hadoop-1.1.2/*.jar:~/packages/hadoop-1.1.2/lib/*.jar
> HBaseExample.java -verbose
>
> please tell me what else I need to add in path to resolve these errors
>
> thank you
>
>
> alok@alok:~/exp/hbase/exp$ javac -classpath
> ~/packages/hbase-0.94.6/hbase-0.94.6.jar:~/packages/hbase-0.94.6/lib/*:~/packages/hadoop-1.1.2/*.jar:~/packages/hadoop-1.1.2/lib/*.jar
> HBaseExample.java -verbose
> [parsing started RegularFileObject[HBaseExample.java]]
> [parsing completed 29ms]
> [search path for source files:
> /home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar,~/packages/hbase-0.94.6/lib/*,~/packages/hadoop-1.1.2/*.jar,~/packages/hadoop-1.1.2/lib/*.jar]
> [search path for class files:
> /usr/lib/jvm/java-7-openjdk-i386/jre/lib/resources.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/rt.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/sunrsasign.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jsse.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jce.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/charsets.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/netx.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/plugin.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/rhino.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jfr.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/classes,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/zipfs.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/sunjce_provider.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/sunpkcs11.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/pulse-java.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/dnsns.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/java-atk-wrapper.jar,/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/localedata.jar,/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar,~/packages/hbase-0.94.6/lib/*,~/packages/hadoop-1.1.2/*.jar,~/packages/hadoop-1.1.2/lib/*.jar]
> [loading
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/IOException.class)]]
> HBaseExample.java:2: error: package org.apache.hadoop.fs does not exist
> import org.apache.hadoop.fs.Path;
>                             ^
> [loading
> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/HBaseConfiguration.class)]]
> [loading
> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/client/HTable.class)]]
> HBaseExample.java:5: error: cannot find symbol
> import org.apache.hadoop.hbase.client.Scanner;
>                                       ^
>    symbol:   class Scanner
>    location: package org.apache.hadoop.hbase.client
> HBaseExample.java:6: error: cannot find symbol
> import org.apache.hadoop.hbase.io.BatchUpdate;
>                                   ^
>    symbol:   class BatchUpdate
>    location: package org.apache.hadoop.hbase.io
> HBaseExample.java:7: error: cannot find symbol
> import org.apache.hadoop.hbase.io.Cell;
>                                   ^
>    symbol:   class Cell
>    location: package org.apache.hadoop.hbase.io
> HBaseExample.java:8: error: cannot find symbol
> import org.apache.hadoop.hbase.io.RowResult;
>                                   ^
>    symbol:   class RowResult
>    location: package org.apache.hadoop.hbase.io
> [loading
> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/util/Bytes.class)]]
> [loading
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Object.class)]]
> [loading
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/String.class)]]
> [checking HBaseExample]
> [loading
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/AutoCloseable.class)]]
> [loading
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Exception.class)]]
> [loading
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Throwable.class)]]
> HBaseExample.java:16: error: cannot find symbol
>          conf.addResource(new Path("/opt/hbase-0.19.3/conf/hbase-site.xml"));
>                               ^
>    symbol:   class Path
>    location: class HBaseExample
> HBaseExample.java:16: error: cannot access Configuration
>          conf.addResource(new Path("/opt/hbase-0.19.3/conf/hbase-site.xml"));
>              ^
>    class file for org.apache.hadoop.conf.Configuration not found
> HBaseExample.java:20: error: cannot find symbol
>          BatchUpdate batchUpdate = new BatchUpdate("test_row1");
>          ^
>    symbol:   class BatchUpdate
>    location: class HBaseExample
> HBaseExample.java:20: error: cannot find symbol
>          BatchUpdate batchUpdate = new BatchUpdate("test_row1");
>                                        ^
>    symbol:   class BatchUpdate
>    location: class HBaseExample
> [loading
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/math/BigDecimal.class)]]
> [loading
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/nio/ByteBuffer.class)]]
> HBaseExample.java:25: error: cannot find symbol
>          Cell cell = table.get("test_row1", "columnfamily1:column1");
>          ^
>    symbol:   class Cell
>    location: class HBaseExample
> [loading
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/util/List.class)]]
> HBaseExample.java:25: error: no suitable method found for get(String,String)
>          Cell cell = table.get("test_row1", "columnfamily1:column1");
>                           ^
>      method HTable.get(List<Get>) is not applicable
>        (actual and formal argument lists differ in length)
>      method HTable.get(Get) is not applicable
>        (actual and formal argument lists differ in length)
> [loading
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/lang/System.class)]]
> [loading
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/PrintStream.class)]]
> [loading
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/FilterOutputStream.class)]]
> [loading
> ZipFileIndexFileObject[/usr/lib/jvm/java-7-openjdk-i386/lib/ct.sym(META-INF/sym/rt.jar/java/io/OutputStream.class)]]
> HBaseExample.java:31: error: cannot find symbol
>          RowResult singleRow = table.getRow(Bytes.toBytes("test_row1"));
>          ^
>    symbol:   class RowResult
>    location: class HBaseExample
> HBaseExample.java:31: error: cannot find symbol
>          RowResult singleRow = table.getRow(Bytes.toBytes("test_row1"));
>                                     ^
>    symbol:   method getRow(byte[])
>    location: variable table of type HTable
> HBaseExample.java:32: error: cannot find symbol
>          Cell cell = singleRow.get(Bytes.toBytes("columnfamily1:column1"));
>          ^
>    symbol:   class Cell
>    location: class HBaseExample
> HBaseExample.java:42: error: cannot find symbol
>          Scanner scanner = table.getScanner(
>          ^
>    symbol:   class Scanner
>    location: class HBaseExample
> [loading
> ZipFileIndexFileObject[/home/alok/packages/hbase-0.94.6/hbase-0.94.6.jar(org/apache/hadoop/hbase/client/Scan.class)]]
> HBaseExample.java:42: error: no suitable method found for
> getScanner(String[])
>          Scanner scanner = table.getScanner(
>                                 ^
>      method HTable.getScanner(byte[],byte[]) is not applicable
>        (actual and formal argument lists differ in length)
>      method HTable.getScanner(byte[]) is not applicable
>        (actual argument String[] cannot be converted to byte[] by method
> invocation conversion)
>      method HTable.getScanner(Scan) is not applicable
>        (actual argument String[] cannot be converted to Scan by method
> invocation conversion)
> HBaseExample.java:46: error: cannot find symbol
>          RowResult rowResult = scanner.next();
>          ^
>    symbol:   class RowResult
>    location: class HBaseExample
> HBaseExample.java:55: error: cannot find symbol
>          for (RowResult result : scanner) {
>               ^
>    symbol:   class RowResult
>    location: class HBaseExample
> [total 461ms]
> Note: HBaseExample.java uses or overrides a deprecated API.
> Note: Recompile with -Xlint:deprecation for details.
> 18 errors
>