You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@knox.apache.org by "Bing-ok (Jira)" <ji...@apache.org> on 2021/03/01 08:37:00 UTC

[jira] [Created] (KNOX-2540) “NoSuchMethodErrors” due to multiple versions of org.apache.curator:curator-client

Bing-ok created KNOX-2540:
-----------------------------

             Summary: “NoSuchMethodErrors” due to multiple versions of org.apache.curator:curator-client
                 Key: KNOX-2540
                 URL: https://issues.apache.org/jira/browse/KNOX-2540
             Project: Apache Knox
          Issue Type: Bug
    Affects Versions: 1.6.0
            Reporter: Bing-ok


h2. Issue description:

There are multiple versions of _*org.apache.curator:curator-client*_ in _*hadoop-examples*_. As shown in the following dependency tree, according to Maven's "nearest wins" strategy, only _*org.apache.curator:curator-client:4.3.0*_ can be loaded, _*org.apache.curator:curator-client:2.13.0*_ will be shadowed.

However, several methods defined in shadowed version _*org.apache.curator:curator-client:2.13.0*_ are referenced by client project via _*org.apache.hadoop:hadoop-common:3.2.1*_ but missing in the actually loaded version _*org.apache.curator:curator-client:4.3.0*_.

For instance, the following missing method(defined in _*org.apache.curator:curator-client:2.13.0*_) are actually referenced by *_hadoop-examples_*, which will introduce a runtime error(i.e., "NoSuchMethodError") into _*hadoop-examples*_.

_*org.apache.curator.utils.ThreadUtils: void checkInterrupted(java.lang.Throwable)*_ is invoked by _*hadoop-examples*_ via the following path:
{code:java}
<org.apache.knox.examples.WordCount: void main(java.lang.String[])> knox/hadoop-examples/target/classes
<org.apache.hadoop.util.GenericOptionsParser: void <init>(org.apache.hadoop.conf.Configuration,java.lang.String[])> Respository/org/apache/hadoop/hadoop-common/3.2.1/hadoop-common-3.2.1.jar
<org.apache.hadoop.util.GenericOptionsParser: void <init>(org.apache.hadoop.conf.Configuration,org.apache.commons.cli.Options,java.lang.String[])> Respository/org/apache/hadoop/hadoop-common/3.2.1/hadoop-common-3.2.1.jar
<org.apache.hadoop.util.GenericOptionsParser: boolean parseGeneralOptions(org.apache.commons.cli.Options,java.lang.String[])> Respository/org/apache/hadoop/hadoop-common/3.2.1/hadoop-common-3.2.1.jar
<org.apache.hadoop.util.GenericOptionsParser: void processGeneralOptions(org.apache.commons.cli.CommandLine)> Respository/org/apache/hadoop/hadoop-common/3.2.1/hadoop-common-3.2.1.jar
<org.apache.hadoop.security.Credentials: org.apache.hadoop.security.Credentials readTokenStorageFile(org.apache.hadoop.fs.Path,org.apache.hadoop.conf.Configuration)> Respository/org/apache/hadoop/hadoop-common/3.2.1/hadoop-common-3.2.1.jar
<org.apache.hadoop.io.IOUtils: void cleanupWithLogger(org.slf4j.Logger,java.io.Closeable[])> Respository/org/apache/hadoop/hadoop-common/3.2.1/hadoop-common-3.2.1.jar
<org.apache.curator.framework.recipes.nodes.PersistentNode: void close()> Respository/org/apache/curator/curator-recipes/4.3.0/curator-recipes-4.3.0.jar
<org.apache.curator.utils.ThreadUtils: void checkInterrupted(java.lang.Throwable)>{code}
h2. Suggested fixing solutions:

1. Upgrade dependency _*org.apache.hadoop:hadoop-common*_ from _*3.2.1*_ to _*3.2.2*_.Because the newer version _*org.apache.hadoop:hadoop-common:3.2.2*_ does not invoke the above missing methods, such changing can solve the problem.

This repair will introduce the following new dependencies:
javax.activation:javax.activation-api:1.2.0

2. Change direct dependency _*org.apache.curator:curator-client*_ from _*4.3.0*_ to _*2.13.0*_.
h2. Dependency tree----
{code:java}
[INFO] org.apache.knox:hadoop-examples:jar:1.6.0-SNAPSHOT
[INFO] \- org.apache.hadoop:hadoop-common:jar:3.2.1:provided
[INFO]    +- org.apache.curator:curator-client:jar:4.3.0:provided (version managed from 2.13.0)
[INFO]    \- org.apache.curator:curator-recipes:jar:4.3.0:provided (version managed from 2.13.0)
[INFO]       \- org.apache.curator:curator-framework:jar:4.3.0:provided
[INFO]          \- (org.apache.curator:curator-client:jar:4.3.0:provided - version managed from 2.13.0; omitted for duplicate)
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)