【问题标题】:JAVA Nextcloud API throws UnknownHostException when using httpsJAVA Nextcloud API 在使用 https 时抛出 UnknownHostException
【发布时间】:2019-05-01 17:32:54
【问题描述】:

我尝试用 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"

【问题讨论】:

    标签: java cloud next


    【解决方案1】:

    尝试在 serverName 中不使用协议:

    String serverName = "<domain>/nextcloud/";
    

    【讨论】:

      猜你喜欢
      • 2010-12-25
      • 1970-01-01
      • 2018-06-20
      • 1970-01-01
      • 1970-01-01
      • 2018-02-10
      • 2018-10-12
      • 2011-02-23
      相关资源
      最近更新 更多