hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alok Singh Mahor <alokma...@gmail.com>
Subject Re: connecting Hbase using java
Date Wed, 03 Apr 2013 23:03:03 GMT
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 <harsha@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
> > >
> >
> >
> >
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message