在这里我使用了阿里云的姿态检测库,但从开始运行时抛出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);
}
}
以下是引用的库:
遇到了同样的问题,在CSDN看到了,希望阿里云团队能够给出正确、标准的答案~请查看
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。