Valentin Logvinskiy created HADOOP-13939:
--------------------------------------------

             Summary: hadoop jar -libjars not working with mainClass argument
                 Key: HADOOP-13939
                 URL: https://issues.apache.org/jira/browse/HADOOP-13939
             Project: Hadoop Common
          Issue Type: Bug
            Reporter: Valentin Logvinskiy


If we have 
{code:java}
public class MainClass extends Configured implements Tool {
    public static void main(String[] args) throws Exception {
        ToolRunner.run(conf, new MainClass(), args);
    }
    
    ...
    
   @Override
    public int run(String[] args) throws Exception {
        ...
    }
}
{code}

Running this code with -libjars argument in distributed mode will not work.

{noformat}
hadoop jar file.jar MainClass -libjars /path/to/file
{noformat}

This not working due to error in GenericOptionsParser

GenericOptionsParser.java:
{code}
commandLine = parser.parse(opts, args, true);
{code}

As far as 3rd argument is "true" this mean:

{noformat}
* @param stopAtNonOption specifies whether to continue parsing the
     * arguments if a non option is encountered.
{noformat}

Our run arguments are:
{noformat}
MainClass -libjars /path/to/file
{noformat}

MainClass is nonOption and after this argument everything else don't start 
parsing.

If we have only arguments then processGeneralOptions method will return nothing 
and will not add tmpjars config.

Changing to 
{noformat}
commandLine = parser.parse(opts, args, false); 
{noformat}
works for me, but could affect a lot of developers (in theory)

Fast fix - do not use mainClass argument at all.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: common-dev-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-dev-h...@hadoop.apache.org

Reply via email to