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 "Mark Wood (JIRA)" <ji...@apache.org> on 2018/03/21 13:40:00 UTC
[jira] [Commented] (HADOOP-13939) hadoop jar -libjars not working
with mainClass argument
[ https://issues.apache.org/jira/browse/HADOOP-13939?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16407917#comment-16407917 ]
Mark Wood commented on HADOOP-13939:
------------------------------------
This applies to any generic option, not just -libjars; perhaps the title should be updated appropriately? I just spent too much time trying to figure out why my generic options weren't getting recognized!
> 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
> Affects Versions: 2.7.2
> Reporter: Valentin Logvinskiy
> Priority: Major
>
> 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
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org