gpt4 book ai didi

java - Cloudant AuthCookie 不能为空

转载 作者:太空宇宙 更新时间:2023-11-04 14:01:58 25 4
gpt4 key购买 nike

我目前正在尝试使用此链接将条目添加到 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", 密码);

双参数版本假设您传递的是 cookie 而不是密码。

关于java - Cloudant AuthCookie 不能为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29220539/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com