Exception authenticating MongoCredential{mechanism=null, userName=‘zhupeng‘, source=‘ksc‘, password=
配置中配置账号和密码连接数据库,出现MongoSecurityException: Exception authenticating MongoCredential{mechanism=null, userName='zhupeng', source='ksc', password=<hidden>, mechanismProperties={}}权限异常
百度一下报错原因,看到了这条信息,
当然,这个提示等于没有提示,给我的感觉就是我少了某些东西,于是从设置账密的标签入手。点进标签,查看一下标签的定义。
<xsd:attribute name="credentials" type="xsd:string" use="optional"><xsd:annotation><xsd:documentation><![CDATA[
The comma delimited list of username:password@database entries to use for authentication. Appending ?uri.authMechanism allows to specify the authentication challenge mechanism. If the credential you're trying to pass contains a comma itself, quote it with single quotes: '…'.]]></xsd:documentation></xsd:annotation></xsd:attribute></xsd:complexType>
其中有一段解释The comma delimited list of username:password@database entries to use for authentication. Appending ?uri.authMechanism allows to specify the authentication challenge mechanism. If the credential you're trying to pass contains a comma itself, quote it with single quotes: '…'.
这个格式是:username:password@database ,可能需要添加 ?uri.authMechanism权限(英语4级没有过,大致意思)。于是恍然大悟。原先从网上抄的写法是:
<mongo:mongo-client id="mongo" host="${mongo.host}" port="${mongo.port}"credentials="${mongo.username}:${mongo.password}@${mongo.dbname}">.......
</mongo:mongo-client>
查看xml配置,再结合翻译后的内容,发现就少了权限的问题,我通过用MongoDB数据库的工具看一下权限
添加权限后解决问题
<mongo:mongo-client id="mongo" host="${mongo.host}" port="${mongo.port}"credentials="${mongo.username}:${mongo.password}@${mongo.dbname}?authMechanism=SCRAM-SHA-1">....
</mongo:mongo-client>
Exception authenticating MongoCredential{mechanism=null, userName=‘zhupeng‘, source=‘ksc‘, password=相关推荐
- MongoDB查询报错:class com.mongodb.MongoSecurityException: Exception authenticating MongoCredential...
异常日志: 2019-05-30 10:10:24,252 [http-nio-8080-exec-1] DEBUG [java.sql.Connection] - ooo Connection Op ...
- 【MongoDB异常】Exception authenticating MongoCredential解决方法
我们通过ideal编辑器编辑 springboot时候,出现这个错误: com.mongodb.MongoSecurityException: Exception authenticating Mon ...
- UncategorizedMongoDbException: Exception authenticating MongoCredential解决办法
今天通过springboot连接MongoDB的时候,出现了以下的报错: 从报错来看,是因为认证没有通过,检查了配置,是没有问题的,那么会不会是账号本身的问题呢? 于是到MongoDB的客户端看了下, ...
- 使用springBoot:run命令启动时报错:An exception occurred while running. null
过程 详细报错信息如下: Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.1.17.RELEASE ...
- nested exception is java.sql.SQLException: Data truncated for column 'PassWord' at row 72
tomcat启动没有错误,进入登录界面发现登不进去,出现错误: 2016-08-17 14:52:44 -43568 [http-8080-4] DEBUG - ==> Preparing ...
- java getqueue 0_【求助】Exception in threadAWT-EventQueue-0java.lang.Null
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 用户登录 import java.awt.*; import java.awt.event.*; import javax.swing.*; import ...
- 错误HikariPool-1 - Exception during..+ Access denied for user ‘root‘@‘localhost‘ (using password: YES)
项目场景: 前些天在IDEA中导入项目后,更改好配置,运行出错 问题描述 以下是错误提示: ERROR 18660 --- [3)-192.168.48.1] com.zaxxer.hikari.po ...
- Exception: java.io.IOException: Keystore was tampered with, or password was incorrect
在进行证书相关操作默认密码changeit,而不是注册时自己设置的密码.
- go mongodb排序查询_Kotlin与MongoDB整合CURD案例详解
1.mongodb的低版本bson无法转换类型 比如MongoDB数据库表的字段类型为Decimal,实体类用String去定义就会报如下错误 No converter found capablof ...
最新文章
- 《Zabbix-ICMP ping监控添加方法》-7
- firefox显示 您的连接不安全 解决办法
- 【完结】听完这12次分享,你应该完成了AI小白的蜕变
- linux简单文件管理命令的使用
- XMPP的简介和基本概念
- Python基本知识
- 计算机分屏解决方案,整套解决方案:使窗口布局更高效,为Windows平台编译分屏工具...
- Linux Shell脚本 删除一个字符串中的部分字符
- python如何安装pipwindows_如何在Windows上使用python 2.6安装pip
- Hadoop学习之hdfs集群搭建详解
- 荣耀V10什么时候升级鸿蒙,华为非常良心,荣耀V10用户迎来更新,2.08M补丁包优化稳定性...
- 【Matlab】图像裁剪函数imcrop的原点、长度、宽度问题
- django商城项目之历史浏览记录
- 免费注册的域名.tk
- photoshop制作gif动画
- 看看这模型!“桥梁建设国家队”是如何用CC来三维建模的?
- 调整k8s的iptable参数时启动生效报错
- The bundle does not contain an app icon for iPhone / iPod Touch of exactly '57x57' pixels
- Valentino Beauty华伦天奴美妆即将登陆中国市场
- Selenium WebDriver(1)——入门篇