无法在本地设置Marklogic Java Api?
我已经安装了ML9.0.3,并按照它在本地进行了设置,并根据需要编辑了无法在本地设置Marklogic Java Api?,java,marklogic,Java,Marklogic,我已经安装了ML9.0.3,并按照它在本地进行了设置,并根据需要编辑了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.
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(您设置的属性中缺少这些属性):
示例_01_CreateJSON的代码引用Config.user,该用户从Example.writer_user
属性获得:
protected static String user = props.getProperty("example.writer_user");
您的属性文件必须定义一个example.writer\u user
值,才能知道作为谁登录
protected static String user = props.getProperty("example.writer_user");