hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Yu <yuzhih...@gmail.com>
Subject Re: connecting Hbase using java
Date Sun, 31 Mar 2013 14:37:21 GMT
bq.  imported external jar's
What external jars did you import ?

You can do the following:
In root of HBase 0.94 workspace (you have the source code, right ?) type:
mvn eclipse:eclipse
This would generate .project file
Let Eclipse import the generated project by giving Eclipse the path of 0.94
workspace root
Establish dependency on HBase project for your Java app

Cheers


On Sun, Mar 31, 2013 at 3:48 AM, Alok Singh Mahor <alokmahor@gmail.com>wrote:

> Hello Tez,
> I went through http://hbase.apache.org/book.html#developing
> but I didnt find relevancy or I could not understand that section.
>
> could you please tell me where exactly I am wrong? what exactly I have to
> import to my existing project?
>
> let me tell you what exactly I did
> hadoop and hbase are already running
> created new java project in eclipse named sample >> imported external jar's
> >> created java class >> ran as java application
>
> these are the steps that I follow. now please tell me what extra I have to
> do?
> thanks again
>
>
> On Sun, Mar 31, 2013 at 9:09 AM, Ted Yu <yuzhihong@gmail.com> wrote:
>
> > Have you gone over the related section in HBase book which I mentioned ?
> >
> > From the screen shot, you were missing HBase project which you can import
> > through File -> Import, then existing project.
> >
> > Cheers
> >
> >
> > On Sat, Mar 30, 2013 at 8:00 PM, Alok Singh Mahor <alokmahor@gmail.com
> > >wrote:
> >
> > > thank you Ted, Mohammad and Stephen
> > > now I ahve switched to eclipse and following
> > >
> > >
> >
> https://thinkasgeek.wordpress.com/2011/03/25/hbase-and-eclispe-ide-integration/#comment-29
> > >
> > > but in this code I am getting warning that
> > > <warning>The constructor HBaseConfiguration() is deprecated</warning>
> > >
> > > and when I run this project as java application I am getting a pop up
> to
> > > select java application.
> > > you can see that at http://i.troll.ws/d7340d3c.png
> > >
> > > I dont know what I have to select. but my java class name is sample so
> I
> > am
> > > selecting sample
> > > then I am runtime errors
> > >
> > > Exception in thread "main" java.lang.NoClassDefFoundError:
> > > org/apache/commons/lang/ArrayUtils
> > >     at org.apache.hadoop.hbase.HConstants.<clinit>(HConstants.java:691)
> > >     at
> > >
> > >
> >
> org.apache.hadoop.hbase.HTableDescriptor.<clinit>(HTableDescriptor.java:1144)
> > >     at sample.main(sample.java:11)
> > > Caused by: java.lang.ClassNotFoundException:
> > > org.apache.commons.lang.ArrayUtils
> > >     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)
> > >     ... 3 more
> > >
> > > could you tell me where I am wrong and how to correct that warning?
> > > thank you
> > >
> > >
> > > On Sat, Mar 30, 2013 at 8:59 PM, Stephen Boesch <javadba@gmail.com>
> > wrote:
> > >
> > > > have you included the jar files under:
> > > >
> > > >
> > >
> >
>  CLASSPATH=$HADOOP_HOME/*:$HADOOP_HOME/lib/*:$HBASE_HOME/*:$HBASE_HOME/lib/*:$CLASSPATH
> > > >
> > > > cd $HBASE_HOME/src
> > > > javac
> > > >
> examples/mapreduce/org/apache/hadoop/hbase/mapreduce/IndexBuilder.java
> > > >
> > > >
> > > >
> > > >
> > > > 2013/3/30 Alok Singh Mahor <alokmahor@gmail.com>
> > > >
> > > > > Hi all,
> > > > > I have set up Hbase in pseudo distributed mode.
> > > > > I am using hadoop-1.1.2  hbase-0.94.6 and setup files are in Home
> > > > > directory.
> > > > >
> > > > > content of ~/hbase-0.94.6/conf/hbase-site.xml is
> > > > >
> > > > > <configuration>
> > > > > <property>
> > > > >         <name>hbase.cluster.distributed</name>
> > > > >         <value>true</value>
> > > > > </property>
> > > > > <property>
> > > > >     <name>hbase.rootdir</name>
> > > > >     <value>hdfs://localhost:9000/hbase</value>
> > > > >   </property>
> > > > > <property>
> > > > >         <name>dfs.replication</name>
> > > > >         <value>1</value>
> > > > >         <description>The replication count for HLog and HFile
> > storage.
> > > > > Should not be greater than HDFS datanode count.
> > > > >         </description>
> > > > >     </property>
> > > > > </configuration>
> > > > >
> > > > > and I am able to create tables using hbase shell from its prompt.
> > > > > but I want to create table and load data programatically using
> java.
> > > > >
> > > > > I tried to follow
> > > > >
> > > > >
> > > >
> > >
> >
> http://autofei.wordpress.com/2012/04/02/java-example-code-using-hbase-data-model-operations/
> > > > >
> > > > > without eclipse but I am getting error that packages does not
> exist.
> > > > >
> > > > > could any one give me clean and simple steps to load data in Hbase
> > > > > programatically using java.
> > > > >
> > > > > thanks in advance
> > > > >
> > > >
> > >
> >
>

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