Closed dpalic closed 4 years ago
afaik found the issue. Your lib requires httpcore 4.4.1 and you exclude it from dependencies which is not good https://github.com/Kong/unirest-java/blob/44cc5cbc67f4817f12d0259a6c2b142fe1baa007/unirest/pom.xml#L47-L50
afaik you shall add it as dependency with a version range, e.g. like this
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>[4.4.1,4.5)</version> <!-- or similar like your deps are required -->
workaround is to add additionally
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.4</version>
</dependency>
but this is not the nice way of dependencymanagement
It's only excluded from the async client because it's also included from the "regular" http client which uses a newer version than the async client uses and is dependent on newer methods (it cannot use the older one)
[INFO] com.konghq:unirest-java:jar:3.1.03-SNAPSHOT
[INFO] +- org.apache.httpcomponents:httpclient:jar:4.5.9:compile
[INFO] | +- org.apache.httpcomponents:httpcore:jar:4.4.11:compile
[INFO] | +- commons-logging:commons-logging:jar:1.2:compile
[INFO] | \- commons-codec:commons-codec:jar:1.11:compile
[INFO] +- org.apache.httpcomponents:httpmime:jar:4.5.9:compile
[INFO] +- org.apache.httpcomponents:httpasyncclient:jar:4.1.4:compile
[INFO] | \- org.apache.httpcomponents:httpcore-nio:jar:4.4.10:compile
[INFO] \- com.google.code.gson:gson:jar:2.8.5:compile
I can see from your list of depenencies that you are pulling in some older versions of httpclient than unirest uses. This can cause issues. The apache project isn't the best about backwards compatibility.
There is a fat jar version of Unirest that you can use that eliminates the conflicts with other dependencies (at the expense of fatness)
Oh I also just noticed you are using an ancient version of unirest (1.4.9)
Closing this as it looks like upgrading will resolve the issue
HttpResponse lResponse = Unirest.get(URL).queryString(PARAM_URL, lDomain)
.queryString(PARAM_MATCH_TYPE, lMatchType).queryString(PARAM_OUTPUT, lOutputFormat).asJson();
this is the full code I am using of UniRest right now. My URL is not even https it is http. This issue seems to be the same issue as #221
in my classpath I have: