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

[jira] [Closed] (VFS-777) "NoSuchMethodErrors" due to multiple versions of commons-codec:commons-codec:jar

     [ https://issues.apache.org/jira/browse/VFS-777?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bing-ok closed VFS-777.
-----------------------

Thanks for your support!

> "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
>            Reporter: Bing-ok
>            Priority: Major
>             Fix For: 2.7.0
>
>
> h1. Issue description
> 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.
> However, one method defined in shadowed version _*commons-codec:commons-codec:1.11*_ is referenced by client project via _*org.apache.httpcomponents:httpclient:4.5.12*_, but missing in the actually loaded version _*commons-codec:commons-codec:1.2*_.
> For instance, the following missing method(defined in _*commons-codec:commons-codec:1.11*_) is actually referenced by *_commons-vfs(commons-vfs2 module)_*, which will introduce a runtime error(i.e., "NoSuchMethodError") into *_commons-vfs(commons-vfs2 module)_*.
> *_Missing method: org.apache.commons.codec.binary.Base64: void init (int)_* is invoked by *_commons-vfs(commons-vfs2 module)_* via the following path:
> {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}
> h1. Suggested fixing solutions
> 1.Use configuration attribute <dependencyManagement> to unify the version of library _*commons-codec:commons-codec*_ to be *_1.11_* in commons-vfs(commons-vfs2 module)'s pom file.
> 2. Declare a direct dependency _*commons-codec:commons-codec1.11*_ to upgrade version from _*1.2*_ to _*1.11*_.
> 3.use <exclude> to exclude _*commons-codec:commons-codec:1.2*_ from the dependency tree, so that version _*1.11*_ will be loaded.
> 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,
> h1. Dependency tree----
> {noformat}
> [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){noformat}



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