java - JAVA Nextcloud API 在使用 https 时抛出 UnknownHostException
问题描述
我尝试用 Java 实现 nextcloud api。我使用了这个 API(https://github.com/a-schild/nextcloud-java-api)并且它是自我解释的,但是我在连接到服务器时遇到了严重的问题。
public static void main(String[] args) {
String serverName = "https://<domain>/nextcloud/";
boolean useHTTPS = true;
int port = 443;
String userName = "test";
String password = "test";
NextcloudConnector nxt = new NextcloudConnector(serverName, useHTTPS, port, userName, password);
nxt.deleteUser("test2");
}
}
我总是得到这个异常:"Exception in thread "main" org.aarboard.nextcloud.api.exception.NextcloudApiException: java.util.concurrent.ExecutionException: java.net.UnknownHostException: https: unknown error"
解决方案
尝试在 serverName 中不使用协议:
String serverName = "<domain>/nextcloud/";
推荐阅读
- r - 头文件中的 Rcpp 函数默认值
- css - 尝试在 CSS 元素中加载背景图像时出现模块解析错误
- java - 找出其中的元素之间距离最小的位置
- javascript - 需要帮助修复 javascript 以在具有多个文件上传输入的表单页面上创建单个点击事件
- c# - Xamarin - MasterDetailPage 无法从任何页面调用
- python - Python 何时会/不会暂停协程的执行?
- python - 如何对 numpy 元组进行排序而不会出现关于只有长度为 1 的数组的错误可以转换为 python 标量
- javascript - 是否可以在 Styles.scss 中动态导入 Variables.scss 文件?
- r - 2 *“X2B”中的错误:二进制运算符的非数字参数
- python - django:将 DRY 和代码重用提升到一个新的水平?