开发者社区> 问答> 正文

阿里云的姿态检测运行时抛出java.lang.NoClassDefFoundError错误,跪求解决

在这里我使用了阿里云的姿态检测库,但从开始运行时抛出java.lang.NoClassDefFoundError错误导致无法运行:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/conn/HttpClientConnectionManager
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at com.aliyuncs.http.HttpClientFactory.buildClient(HttpClientFactory.java:35)
    at com.aliyuncs.DefaultAcsClient.<init>(DefaultAcsClient.java:77)
    at com.aliyuncs.DefaultAcsClient.<init>(DefaultAcsClient.java:66)
    at com.HUST_fighting.start.Main.main(Main.java:22)
Caused by: java.lang.ClassNotFoundException: org.apache.http.conn.HttpClientConnectionManager
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 6 more

这个错误在网上找了半天没有解决方法。据说是编译时找不到指定类

求大佬找出问题并提供解决建议,以下是源码:

import com.aliyuncs.profile.DefaultProfile;
import com.aliyuncs.facebody.model.v20191230.BodyPostureRequest;
import com.aliyuncs.facebody.model.v20191230.BodyPostureResponse;

import javax.swing.JButton;
import javax.swing.JOptionPane;

import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.exceptions.ServerException;

public class Main {
    static IAcsClient client = null;
    public static void main(String[] args) throws ServerException, ClientException {
        DefaultProfile profile = DefaultProfile.getProfile(
                "cn-shanghai",             //默认
                "xxxxx",         //Access Key 已隐藏
                "xxxxx");
        client = new DefaultAcsClient(profile);
        bodyTest();
    }
    public static void bodyTest() throws ServerException, ClientException {
        BodyPostureRequest body = new BodyPostureRequest();
        body.setImageURL("https://viapi-test.oss-cn-shanghai.aliyuncs.com/test-team/bodyp.jpg");
        BodyPostureResponse bodyp = client.getAcsResponse(body);
        System.out.println(bodyp);
    }
}

image.png

image.png

以下是引用的库:

image.png

遇到了同样的问题,在CSDN看到了,希望阿里云团队能够给出正确、标准的答案~请查看

展开
收起
刘刚_ 2020-05-22 21:20:27 1827 0
1 条回答
写回答
取消 提交回答
  • 同问,使用短信服务时也出现了这个问题

    2020-05-22 23:10:08
    赞同 展开评论 打赏
问答分类:
问答标签:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
Spring Cloud Alibaba - 重新定义 Java Cloud-Native 立即下载
The Reactive Cloud Native Arch 立即下载
JAVA开发手册1.5.0 立即下载