Kong / unirest-java

Unirest in Java: Simplified, lightweight HTTP client library.
http://kong.github.io/unirest-java/
MIT License
2.61k stars 594 forks source link

NoClassDefFoundError: org/apache/http/concurrent/FutureCallback #270

Closed ryber closed 5 years ago

ryber commented 5 years ago

Describe the bug java.lang.BootstrapMethodError: java.lang.IllegalAccessError: no such constructor: kong.unirest.apache.ApacheAsyncClient.(Config)void/newInvokeSpecial at kong.unirest.Config.(Config.java:69) at kong.unirest.Unirest.(Unirest.java:30)

To Reproduce Fire up Unirest under corretto

Environmental Data:

ryber commented 5 years ago

This is actually because the person who reported it had a older version of Apache http client in maven before Unirest and this was the final error:

caused by: java.lang.NoClassDefFoundError: org/apache/http/concurrent/FutureCallback
    at java.lang.invoke.MethodHandleNatives.resolve(Native Method)

It's weird that this even throws when the constructor is never invoked. We should also throw a better error which explains the problem and solution. Apache Http Client is used by lots of things and being on a old crusty version is a constant issue

ryber commented 5 years ago

make a better explanation for errors that happen when the user has a older version of Apache on the path https://github.com/Kong/unirest-java/commit/20ec053431f891e57152441565fef30b8505ae47