Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

“NoSuchMethodErrors” due to multiple versions of commons-codec:commons-codec:jar #42

Open
Bing-ok opened this issue Nov 15, 2023 · 0 comments

Comments

@Bing-ok
Copy link

Bing-ok commented Nov 15, 2023

Issue description

Hi, there are multiple versions of commons-codec:commons-codec in book-master. As shown in the following dependency tree, according to Maven "nearest wins" strategy, only commons-codec:commons-codec:1.6 can be loaded, commons-codec:commons-codec:1.2, commons-codec:commons-codec:1.5 and commons-codec:commons-codec:1.4 will be shadowed.

However, several methods defined in shadowed version commons-codec:commons-codec:1.2, commons-codec:commons-codec:1.5 and commons-codec:commons-codec:1.4 are referenced by client project via org.apache.mahout:mahout-core:0.6, org.apache.mahout:mahout-integration:0.6, org.apache.solr:solr-solrj:3.6.0, org.apache.tika:tika-parsers:0.10 and org.carrot2:carrot2-core:3.6.0 but missing in the actually loaded version commons-codec:commons-codec:1.6.

For instance, the following missing method(defined in commons-codec:commons-codec:1.2, commons-codec:commons-codec:1.5 and commons-codec:commons-codec:1.4) are actually referenced by book-master, which will introduce a runtime error(i.e., "NoSuchMethodError") into book-master.

  1. <org.apache.commons.codec.binary.Base64: java.lang.String encodeToString(byte[])> is invoked by book-master via the following path:
path--
<com.tamingtext.util.SplitInput: void splitFile(org.apache.hadoop.fs.Path)> com.tamingtext:taming-text:0.1-SNAPSHOT;
<org.apache.hadoop.fs.FileSystem: org.apache.hadoop.fs.FSDataInputStream open(org.apache.hadoop.fs.Path)> org.apache.hadoop:hadoop-core:0.20.204.0;
<org.apache.hadoop.hdfs.HftpFileSystem: org.apache.hadoop.fs.FSDataInputStream open(org.apache.hadoop.fs.Path,int)> org.apache.hadoop:hadoop-core:0.20.204.0;
<org.apache.hadoop.hdfs.HftpFileSystem: java.net.HttpURLConnection openConnection(java.lang.String,java.lang.String)> org.apache.hadoop:hadoop-core:0.20.204.0;
<org.apache.hadoop.hdfs.HftpFileSystem: java.lang.String updateQuery(java.lang.String)> org.apache.hadoop:hadoop-core:0.20.204.0;
<org.apache.hadoop.security.token.Token: java.lang.String encodeToUrlString()> org.apache.hadoop:hadoop-core:0.20.204.0;
<org.apache.hadoop.security.token.Token: java.lang.String encodeWritable(org.apache.hadoop.io.Writable)> org.apache.hadoop:hadoop-core:0.20.204.0;
<org.apache.commons.codec.binary.Base64: java.lang.String encodeToString(byte[])>

Suggested fixing solutions:

  1. Change direct dependency commons-codec:commons-codec from 1.6 to 1.4. Because version 1.4 includes the above missing methods and is compatible with other versions of commons-codec:commons-codec in the project.
  2. Use configuration to unify the version of library commons-codec:commons-codec to be 1.4 in the pom file.

Please let me know which solution do you prefer? I can submit a PR to fix it.

Thank you very much for your attention.
Best regards,

Dependency tree----


[INFO] |  |  \- (commons-codec:commons-codec:jar:1.2:compile - omitted for conflict with 1.6)
[INFO] |  |  \- (commons-codec:commons-codec:jar:1.6:compile - omitted for duplicate)
[INFO] |  +- commons-codec:commons-codec:jar:1.6:compile
[INFO] |  +- (commons-codec:commons-codec:jar:1.4:compile - omitted for conflict with 1.6)
[INFO] |  |  \- (commons-codec:commons-codec:jar:1.5:compile - omitted for conflict with 1.6)
[INFO] |  |  +- (commons-codec:commons-codec:jar:1.4:compile - omitted for conflict with 1.6)
[INFO] |  |  +- (commons-codec:commons-codec:jar:1.2:compile - omitted for conflict with 1.6)
[INFO] |  +- (commons-codec:commons-codec:jar:1.4:compile - omitted for conflict with 1.6)
[INFO] |  |  \- (commons-codec:commons-codec:jar:1.4:compile - omitted for conflict with 1.6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant