有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

unirest java。lang.ClassNotFoundException:org。阿帕奇。http。尼奥。核反应堆IOreactoreException

我正在尝试使用Unirest Mashape构建java应用程序

这是我的代码:import com.mashape.unirest.http.*;

import com.mashape.unirest.http.HttpResponse;
import org.apache.http.*;
import org.json.*;
public class request {
    public static void main(String[] args) throws Exception {
        HttpResponse<JsonNode> response = Unirest.get("https://omgvamp-hearthstone-v1.p.mashape.com/cards").header("X-Mashape-Key", "<required>").asJson();
}
}

当我编译代码时,它不会显示任何错误。但是当我运行它时,它会显示以下运行时错误:Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/nio/reactor/IOReactorException at com.mashape.unirest.http.HttpClientHelper.prepareRequest(HttpClientHelper.java:151) at com.mashape.unirest.http.HttpClientHelper.request(HttpClientHelper.java:131) at com.mashape.unirest.request.BaseRequest.asJson(BaseRequest.java:68) at request.main(request.java:18) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) Caused by: java.lang.ClassNotFoundException: org.apache.http.nio.reactor.IOReactorException at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 9 more

I've got included this clases to my project

但我还是得到了错误。请帮帮我


共 (1) 个答案

  1. # 1 楼答案

    您还需要httpcore-nio。UnirestJava部分非常糟糕,缺少大多数依赖项