【问题标题】:Not able to setup Marklogic Java Api in local?无法在本地设置 Marklogic Java Api?
【发布时间】:2018-01-20 04:10:01
【问题描述】:

我已经安装了 ML 9.0.3 并按照这个 document 在我的本地进行设置,我根据我的要求编辑了 config.properties

# properties to configure the examples
example.admin_password=x
example.host=localhost
example.port=9963
example.authentication_type=digest

当我在控制台中运行第一个程序时,它会抛出如下错误:

example: com.marklogic.client.example.tutorial.Example_01_CreateJSON
Exception in thread "main" java.lang.IllegalArgumentException: No user provided
    at com.marklogic.client.impl.JerseyServices.connect(JerseyServices.java:186)
    at com.marklogic.client.impl.JerseyServices.connect(JerseyServices.java:165)
    at com.marklogic.client.DatabaseClientFactory.newClient(DatabaseClientFactory.java:156)
    at com.marklogic.client.DatabaseClientFactory.newClient(DatabaseClientFactory.java:125)
    at com.marklogic.client.example.tutorial.Example_01_CreateJSON.main(Example_01_CreateJSON.java:37)

我该如何解决这个问题?

【问题讨论】:

    标签: java marklogic


    【解决方案1】:

    错误消息似乎表明在第 37 行尝试连接时未指定用户名:

    DatabaseClient client = DatabaseClientFactory.newClient(Config.host, Config.port, Config.user, Config.password, Config.authType);
    

    我在您提供的属性中没有看到用户名属性。本教程显示了 config.properties(您提供的属性中缺少这些属性):

    example.admin_user=rest-admin
    example.writer_user=rest-writer
    example.writer_password=x
    

    Example_01_CreateJSON 的代码引用了从example.writer_user 属性获取的 Config.user:

    protected static String user = props.getProperty("example.writer_user");
    

    您的属性文件必须定义一个 example.writer_user 值,以便知道以谁的身份登录。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-01-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-05-19
      • 1970-01-01
      相关资源
      最近更新 更多