Kong / unirest-java

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

Standalone complains of missing Ivy classes. #425

Closed dailytabs closed 2 years ago

dailytabs commented 2 years ago

Describe the bug Grabbing standalone. Running groovy script.groovy and getting error.

To Reproduce Steps to reproduce the behavior:

@Grapes([
        @Grab('com.konghq:unirest-java:3.11.09:standalone')
])

def steps = get("https://api.tempo.io/core/3/accounts")
        .header('Authorization', 'Bearer ...')
        .asObject(List).body

System.out.println steps as String

Expected behavior Standalone package to not require outside classes to function.

Environmental Data:

Additional context

Caught: java.lang.NoClassDefFoundError: org/apache/ivy/util/MessageLogger
java.lang.NoClassDefFoundError: org/apache/ivy/util/MessageLogger
Caused by: java.lang.ClassNotFoundException: org.apache.ivy.util.MessageLogger
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
dailytabs commented 2 years ago

Same error whether I use standalone or not.

ryber commented 2 years ago

Unirest has no dependency on Ivy. At the minimum its:

[INFO] \- com.konghq:unirest-java:jar:standalone:3.11.09:compile
[INFO]    +- org.apache.httpcomponents:httpclient:jar:4.5.13:compile
[INFO]    |  +- org.apache.httpcomponents:httpcore:jar:4.4.13: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.13:compile
[INFO]    +- org.apache.httpcomponents:httpcore-nio:jar:4.4.13:compile
[INFO]    +- org.apache.httpcomponents:httpasyncclient:jar:4.1.4:compile
[INFO]    \- com.google.code.gson:gson:jar:2.8.6:compile`

Can you get more of a stack trace to show where in Apache or Unirest it's trying to load that class?

ryber commented 2 years ago

@dailytabs Ivy is a dependency management library, There is no reason Unirest would use it, it is very likely used by Grape and that is where your error is coming from

ryber commented 2 years ago

Closing as this is most likely a issue with Grape

dailytabs commented 2 years ago

Sorry, I meant to come back and close this. It was Gradle getting in the way.