Skip to content

[Bug] [Yarn-perjob] NoSuchMethodError: org.apache.commons.cli.Option.builder(Ljava/lang/String;)Lorg/apache/commons/cli/Option$Builder; #4251

@RainBow-Suger

Description

@RainBow-Suger

Search before asking

  • I had searched in the issues and found no similar issues.

What happened

I encountered an error while using Yarn's per job and application execution mode
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.commons.cli.Option.builder(Ljava/lang/String;)Lorg/apache/commons/cli/Option$Builder;
at org.apache.flink.runtime.entrypoint.parser.CommandLineOptions.(CommandLineOptions.java:27)
at org.apache.flink.runtime.entrypoint.DynamicParametersConfigurationParserFactory.options(DynamicParametersConfigurationParserFactory.java:43)
at org.apache.flink.runtime.entrypoint.DynamicParametersConfigurationParserFactory.getOptions(DynamicParametersConfigurationParserFactory.java:50)
at org.apache.flink.runtime.entrypoint.parser.CommandLineParser.parse(CommandLineParser.java:42)
at org.apache.flink.runtime.entrypoint.ClusterEntrypointUtils.parseParametersOrExit(ClusterEntrypointUtils.java:70)
at org.apache.flink.yarn.entrypoint.YarnJobClusterEntrypoint.main(YarnJobClusterEntrypoint.java:99)
The official website explains that the per job and application execution mode of Dinky's current version of yarn depend on flink-shaded-Hadoop, and an additional flink-shaded-Hadoop-uber package needs to be added. If you are using flink-shaded-Hadoop-uber-3, please manually remove the conflicting content such as Javax.Servlet inside the package. I did add the flink-shaded-hadoop user package, and the version is 3.1.1.7.2.90-173-9.0. However, the error NoSuchMethodError still occurs: org.apache.commons.cli.Option.builder(Ljava/lang/String;)Lorg/apache/commons/cli/Option$Builder
I executed 'for i in $(ls *. jar); do echo $i && jar tf $i | grep org.apache.commons.cli.Options.class; done' in the dinky/extends directory and found that the flink-dist and flink-shaded-hadoop-3-uber packages used org.apache.commons.cli.Option.class
This class exists under the dependencies of commons-cli, and flink-dist uses the 1.5.0 version of commons-cli; flink-shaded-hadoop-3-uber uses version 1.2 of commons-cli, which is a lower version

What you expected to happen

I hope to upgrade the commons-cli in flink-shaded-hadoop-uber-3 to version 1.5.0

How to reproduce

Image After adding Uber dependency, Dinky executes according to Yarn's perjob mode dinky version: 1.2.1 flink: 1.20 hadoop: 3.3.4 Image

Anything else

No response

Version

1.2.1

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

Labels

FAQFrequently Asked QuestionsInvalidInvalid

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions