[英]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.