You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

本地配置MarkLogic Java API报错No user provided,求解决方法

解决MarkLogic示例程序运行时"No user provided"错误

问题背景

我已经安装了ML 9.0.3,按照文档在本地配置,并修改了config.properties文件:

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

运行控制台第一个程序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)

解决方案

这个错误的原因非常直接——你的配置文件里缺少了连接MarkLogic所需的用户名配置项。示例程序在创建数据库客户端时,需要同时获取用户名和密码才能完成digest认证。

你只需要做以下两步:

  1. 打开config.properties,添加用户名配置行:
    example.admin_user=admin
    
    (如果你不是用默认的admin用户,替换成你实际使用的有权限的用户名即可)
  2. 确认example.admin_password=x中的x是该用户名对应的正确密码,并且这个用户拥有创建文档的权限(新安装的MarkLogic中admin用户默认具备所有权限)。

修改后的完整配置应该是这样:

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

保存配置后重新运行程序,这个异常应该就会消失了。

内容的提问来源于stack exchange,提问作者Private

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 08:51:52