Could not find class file for org.apache.http.annotation.NotThreadSafe

problem phenomenon

Recently, when making a GET request function that includes a request body, I referenced httpclient-4.5.2.jar and httpcore-4.4.5.jar.

The error reported in the project compilation link is as follows:
insert image description here

Cause Analysis

The versions of httpcore and httpclient do not match.


solution

Change the version of httpcore from 4.4.5 to 4.4.4 , and the Maven reference is as follows:

<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.4</version>
</dependency>

Guess you like

Origin blog.csdn.net/aikudexiaohai/article/details/132126642