You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "Valentin Logvinskiy (JIRA)" <ji...@apache.org> on 2016/12/23 11:05:58 UTC

[jira] [Created] (HADOOP-13939) hadoop jar -libjars not working with mainClass argument

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-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org