报错内容:
Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure
error: cannot access NotThreadSafe
报错原因:
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.2</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.5</version>
</dependency>
httpclient 和 httpcore 包的版本不匹配。
注意!网上很多帖子都说降低httpcore到4.4.4 就能解决问题,因为4.5.2和4.4.4匹配。
但是这里的httpclient包本身就是有安全漏洞的,容易被XSS攻击。
httpclient问题详见: https://github.com/advisories/GHSA-7r82-7xv7-xcpj
Apache HttpClient versions prior to version 4.5.13 and 5.0.3 can misinterpret malformed authority component in request URIs passed to the library as java.net.URI object and pick the wrong target host for request execution.
因此,这里可以将httpclient升级到4.5.13,与httpcore的4.4.5匹配。两全其美。
正确的引用姿势:
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.13</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.5</version>
</dependency>
原文地址:https://blog.csdn.net/qq_44776721/article/details/120894673
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。