Bing-ok created VFS-777:
---------------------------
Summary: "NoSuchMethodErrors" due to multiple versions of
commons-codec:commons-codec:jar
Key: VFS-777
URL: https://issues.apache.org/jira/browse/VFS-777
Project: Commons VFS
Issue Type: Bug
Affects Versions: 2.7.0
Reporter: Bing-ok
Hi, there are multiple versions of _*commons-codec:commons-codec*_ in
*_commons-vfs(commons-vfs2 module)_*. As shown in the following dependency
tree, according to Maven's "nearest wins" strategy, only
_*commons-codec:commons-codec:1.2*_ can be loaded,
_*commons-codec:commons-codec:1.11*_ and _*commons-codec:commons-codec:1.13*_
will be shadowed.
As _*commons-codec:commons-codec:1.11*_ and
_*commons-codec:commons-codec:1.13*_ have not been loaded during the building
process, several methods are missing. However, the missing methods:
*_1. org.apache.commons.codec.binary.Base64: void init (int)_*
{noformat}
paths------
<org.apache.commons.vfs2.provider.http4.Http4FileObject:
org.apache.http.HttpResponse
executeHttpUriRequest(org.apache.http.client.methods.HttpUriRequest)>
commons-vfs-master\commons-vfs2\target\classes
<org.apache.http.impl.client.DecompressingHttpClient:
org.apache.http.HttpResponse
execute(org.apache.http.client.methods.HttpUriRequest,org.apache.http.protocol.HttpContext)>
Repositories\org\apache\httpcomponents\httpclient\4.5.12\httpclient-4.5.12.jar
<org.apache.http.impl.client.DecompressingHttpClient:
org.apache.http.HttpResponse
execute(org.apache.http.HttpHost,org.apache.http.HttpRequest,org.apache.http.protocol.HttpContext)>
Repositories\org\apache\httpcomponents\httpclient\4.5.12\httpclient-4.5.12.jar
<org.apache.http.client.protocol.RequestTargetAuthentication: void
process(org.apache.http.HttpRequest,org.apache.http.protocol.HttpContext)>
Repositories\org\apache\httpcomponents\httpclient\4.5.12\httpclient-4.5.12.jar
<org.apache.http.client.protocol.RequestAuthenticationBase: void
process(org.apache.http.auth.AuthState,org.apache.http.HttpRequest,org.apache.http.protocol.HttpContext)>
Repositories\org\apache\httpcomponents\httpclient\4.5.12\httpclient-4.5.12.jar
<org.apache.http.client.protocol.RequestAuthenticationBase:
org.apache.http.Header
authenticate(org.apache.http.auth.AuthScheme,org.apache.http.auth.Credentials,org.apache.http.HttpRequest,org.apache.http.protocol.HttpContext)>
Repositories\org\apache\httpcomponents\httpclient\4.5.12\httpclient-4.5.12.jar
<org.apache.http.impl.auth.BasicScheme: org.apache.http.Header
authenticate(org.apache.http.auth.Credentials,org.apache.http.HttpRequest,org.apache.http.protocol.HttpContext)>
Repositories\org\apache\httpcomponents\httpclient\4.5.12\httpclient-4.5.12.jar
<org.apache.commons.codec.binary.Base64: void <init>(int)>{noformat}
The above missing methods are actually referenced by *_commons-vfs(commons-vfs2
module)_*, which will cause "NoSuchMethodErrors" at runtime.
Suggested fixing solutions:
1. Upgrade dependency _*commons-codec:commons-codec*_ from _*1.2*_ to _*1.13*_.
2.Use configuration attribute <dependencyManagement> to unify the version of
library _*commons-codec:commons-codec*_ to be *_1.13_* in
commons-vfs(commons-vfs2 module)'s pom file.
3.use <exclude> to exclude _*commons-codec:commons-codec:1.2*_ from the
dependency tree.
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] org.apache.commons:commons-vfs2:jar:2.7.0-SNAPSHOT
[INFO] +- commons-httpclient:commons-httpclient:jar:3.1:compile
[INFO] | \- *commons-codec:commons-codec:jar:1.2:compile*
[INFO] +- org.apache.httpcomponents:httpclient:jar:4.5.12:compile
[INFO] | \- *(commons-codec:commons-codec:jar:1.11:compile - omitted for
conflict with 1.2)*
[INFO] +- org.apache.httpcomponents.client5:httpclient5:jar:5.0:compile
[INFO] | \- *(commons-codec:commons-codec:jar:1.13:compile - omitted for
conflict with 1.2)*
[INFO] +- org.apache.hadoop:hadoop-common:test-jar:tests:3.2.1:test
[INFO] | +- *(commons-codec:commons-codec:jar:1.11:test - omitted for conflict
with 1.2)*
[INFO] | \- org.apache.hadoop:hadoop-auth:jar:3.2.1:test
[INFO] | \- *(commons-codec:commons-codec:jar:1.11:test - omitted for conflict
with 1.2)*
[INFO] \- org.apache.hadoop:hadoop-hdfs:test-jar:tests:3.2.1:test
[INFO] \- *(commons-codec:commons-codec:jar:1.11:test - omitted for conflict
with 1.2)*
--
This message was sent by Atlassian Jira
(v8.3.4#803005)