hadoop-common-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aquil H. Abdullah" <aquil.abdul...@gmail.com>
Subject Re: Using -libjar option
Date Mon, 01 Aug 2011 17:21:27 GMT
[See Response Inline]

I've tried invoking getLib
On Mon, Aug 1, 2011 at 12:56 PM, Harsh J <harsh@cloudera.com> wrote:

> Aquil,
>
> On a side-note, if you use Tool, GenericOptsParser is automatically
> used internally (by ToolRunner), so you don't have to re-parse your
> args in your run(…) method. What you get as run(args) are the remnant
> args alone, if your application handles any.
>
[AA] Thanks for clearing that up!

>
> Would help, as John pointed out, if you could give your exact,
> invoking CLI command.
>

[AA] I am currently invoking my application as follows:

hadoop jar /home/test/hadoop/test.option.demo.jar
test.option.demo.OptionDemo -libjar /home/test/hadoop/lib/mytestlib.jar


>
>

> On Mon, Aug 1, 2011 at 9:41 PM, Aquil H. Abdullah
> <aquil.abdullah@gmail.com> wrote:
> > Hello All,
> >
> > I am new to Hadoop, and I am trying to use the GenericOptionsParser
> Class.
> > In particular, I would like to use the -libjar option to specify
> additional
> > jar files to include in the classpath. I've created a class that extends
> > Configured and Implements Tool:
> >
> > *public class* OptionDemo *extends* Configured *implements* Tool
> >
> > {
> >
> >    ...
> >
> > *    public int* run(String[] args) *throws* Exception
> >
> >    {
> >
> >        Configuration conf = getConf();
> >
> >        GenericOptionsParser opts = *new* GenericOptionsParser(conf,
> args);
> >
> >        ...
> >
> >    }
> >
> > }
> >
> >
> > However, when I run my code the jar files that I include after -libjar
> > aren't being added to the classpath and I receive an error that certain
> > classes can't be found during the execution of my job.
> >
> > The book Hadoop: The Definitive Guide states:
> >
> > You don’t usually use GenericOptionsParser directly, as it’s more
> convenient
> > to implement the Tool interface and run your application with the
> > ToolRunner, which uses GenericOptionsParser internally:
> > public interface Tool extends Configurable {
> >    int run(String [] args) throws Exception;
> > }
> >
> > but it still isn't clear to me how the -libjars option is parsed, whether
> or
> > not I need to explicitly add it to the classpath inside my run method, or
> > where it needs to be placed in the command-line? Any advice or sample
> code
> > on using -libjar would greatly be appreciated.
> >
> > --
> > Aquil H. Abdullah
> > aquil.abdullah@gmail.com
> >
>
>
>
> --
> Harsh J
>



-- 
Aquil H. Abdullah
aquil.abdullah@gmail.com

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