|
|
+
Ratner, Alan S 2012-11-26, 21:03
-
Re: Runs in Eclipse but not as a JarSuraj Varma 2012-11-26, 22:45
The difference is your classpath.
So -for problem 1, you need to specify jars under /hbase-0.94.2/lib to your classpath. You only need a subset ... but first to get over the problem set your classpath with all these jars. I don't think specifying a wildcard "*" works ... like below ngc@hadoop1:~/hadoop-1.0.4$<mailto:ngc@hadoop1:~/hadoop-1.0.4$> bin/hadoop jar ../eclipse/CreateBiTable.jar HBase/CreateBiTable -classpath "/home/ngc/hbase-0.94.2/*" you can use bin/hbase classpath to print out full classpath that you can include in your command line script ... In addition to the jars,you also need to add your hbase-site.xml (client side) to the classpath. This would be your problem 2. Hope that helps. --Suraj On Mon, Nov 26, 2012 at 1:03 PM, Ratner, Alan S (IS) <[EMAIL PROTECTED]> wrote: > I am running HBase 0.94.2 running on 6 servers with Zookeeper 3.4.5 running on 3. HBase works from its shell and from within Eclipse but not as a jar file. When I run within Eclipse I can see it worked properly by using the HBase shell commands (such as scan). > > > > I seem to have 2 separate problems. > > > > Problem 1: when I create a jar file from Eclipse it won't run at all: > > ngc@hadoop1:~/hadoop-1.0.4$<mailto:ngc@hadoop1:~/hadoop-1.0.4$> bin/hadoop jar ../eclipse/CreateBiTable.jar HBase/CreateBiTable -classpath "/home/ngc/hbase-0.94.2/*" > > Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/HBaseConfiguration at HBase.CreateBiTable.run(CreateBiTable.java:26) [line 26 is: Configuration conf = HBaseConfiguration.create();] > > > > Problem 2: when I create a "runnable" jar file from Eclipse it communicates with Zookeeper but then dies with: > > Exception in thread "main" java.lang.IllegalArgumentException: Not a host:port pair: \ufffd > > [EMAIL PROTECTED],60000,1353949574468<mailto:[EMAIL PROTECTED],60000,1353949574468> > > > > I'd prefer to use a regular jar (5 KB) rather than a runnable jar (100 MB). But I assume that if I fix Problem 1 then it will proceed until it crashes with Problem 2. > > > > Thanks in advance for any suggestions --- Alan. > > > > ----------------------------- > > CLASSPATH > > ngc@hadoop1:~/hadoop-1.0.4$<mailto:ngc@hadoop1:~/hadoop-1.0.4$> env | grep CLASSPATH CLASSPATH=/home/ngc/hadoop-1.0.4:/home/ngc/hbase-0.94.2/bin:/home/ngc/zookeeper-3.4.5/bin:/home/ngc/accumulo-1.3.5-incubating > > > > ----------------------------- > > HBASE PROGRAM > > package HBase; > > > > import org.apache.hadoop.conf.Configuration; > > import org.apache.hadoop.conf.Configured; > > import org.apache.hadoop.hbase.HBaseConfiguration; > > import org.apache.hadoop.hbase.HColumnDescriptor; > > import org.apache.hadoop.hbase.HTableDescriptor; > > import org.apache.hadoop.hbase.client.HBaseAdmin; > > import org.apache.hadoop.util.Tool; > > import org.apache.hadoop.util.ToolRunner; > > > > public class CreateBiTable extends Configured implements Tool { > > public static String TableName = new String ("BiIPTable"); > > public static String cf = "cf"; //column family > > public static String c1 = "c1"; //column1 > > > > public static void main(String[] args) throws Exception { > > long startTime = System.currentTimeMillis(); > > int res = ToolRunner.run(new Configuration(), new CreateBiTable(), args); > > double duration = (System.currentTimeMillis() - startTime)/1000.0; > > System.out.println(">>>> Job Finished in " + duration + " seconds"); > > System.exit(res); > > } > > > > public int run(String[] arg0) throws Exception { > > Configuration conf = HBaseConfiguration.create(); // System.out.println("Configuration created"); > > System.out.println("\t"+conf.toString()); > > HBaseAdmin admin = new HBaseAdmin(conf); // System.out.println("\t"+admin.toString()); |