无法在本地设置 Marklogic Java Api?
Not able to setup Marklogic Java Api in local?
我已经安装了 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)
我该如何解决这个问题?
错误消息似乎表明在第 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 的代码引用了 Config.user,它是从 example.writer_user
属性 获得的:
protected static String user = props.getProperty("example.writer_user");
您的属性文件必须定义一个 example.writer_user
值,以便知道以谁的身份登录。
我已经安装了 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)
我该如何解决这个问题?
错误消息似乎表明在第 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 的代码引用了 Config.user,它是从 example.writer_user
属性 获得的:
protected static String user = props.getProperty("example.writer_user");
您的属性文件必须定义一个 example.writer_user
值,以便知道以谁的身份登录。