我目前正在尝试使用此链接将条目添加到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)我有所有必要的重要进口。任何帮助都将不胜感激。
发布于 2015-09-15 18:03:01
我不确定您是否使用了正确的构造函数。看起来您需要使用带有三个参数的构造函数CloudantClient(cloudantAccountName, username, password)。
你的台词是:
CloudantClient client = new CloudantClient("wiz.cloudant.com",password);
需要满足以下条件:
CloudantClient client = new CloudantClient("wiz", "wiz", password);
双参数版本假设您传递的是cookie而不是密码。
https://stackoverflow.com/questions/29220539
复制相似问题