簡體   English   中英

Cloudant AuthCookie不能為空

[英]Cloudant AuthCookie may not be null

我目前正在嘗試使用此鏈接將條目添加到Cloudant:
https://github.com/cloudant/java-cloudant#installation-and-usage

下面是我的代碼

package sample;

import java.util.List;

import com.cloudant.client.api.CloudantClient;

public class Cloudant {
    public static void main (String[] args){

    String password = System.getProperty("gffgasdas");
    CloudantClient client = new CloudantClient("wiz.cloudant.com",password);



    System.out.println("Connected to Cloudant");
    System.out.println("Server Version: " + client.serverVersion());

    List<String> databases = client.getAllDbs();
    System.out.println("All my databases : ");
    for ( String db : databases ) {
        System.out.println(db);
        }
    }
}

我收到此錯誤:

Exception in thread "main" java.lang.IllegalArgumentException: AuthCookie may not be null.
    at org.lightcouch.internal.CouchDbUtil.assertNotEmpty(Unknown Source)
    at com.cloudant.client.api.CloudantClient.<init>(Unknown Source)
    at sample.Cloudant.main(Cloudant.java:11)

我擁有所有必要的重要進口商品。 任何幫助,將不勝感激謝謝。

我不確定您使用的是正確的構造函數。 看來您需要使用三參數構造函數CloudantClient(cloudantAccountName, username, password)

您的電話:

CloudantClient client = new CloudantClient("wiz.cloudant.com",password);

需要是:

CloudantClient client = new CloudantClient("wiz", "wiz", password);

包含兩個參數的版本假定您傳遞的是cookie而不是密碼。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM