Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

springboot2.7.0启动单元测试报错403,user not found #12078

Closed
LifetimeTender opened this issue May 10, 2024 · 5 comments
Closed

springboot2.7.0启动单元测试报错403,user not found #12078

LifetimeTender opened this issue May 10, 2024 · 5 comments
Labels
status/invalid This doesn't seem right

Comments

@LifetimeTender
Copy link

中文:
版本: springboot2.7.0, nacos2.2.0, nacos客户端2.3.2
在不更改任何代码, 配置的情况下, spring应用可以正常启动, 但是启动单元测试报错:ErrCode:403, ErrMsg:http error, code=403,msg=user not found!,dataId=xxx,group=xxx,tenant=xxx

English:
version: springboot2.7.0, nacos2.2.0, nacos client2.3.2
The spring application starts normally without changing any code or configuration, but the unit test starts with an error:ErrCode:403, ErrMsg:http error, code=403,msg=user not found!,dataId=xxx,group=xxx,tenant=xxx

@KomachiSion
Copy link
Collaborator

大概率是你单元测试时读取的配置文件没有设置用户密码,而你直接启动时读取的配置文件或者jvm参数中有用户密码。

@KomachiSion
Copy link
Collaborator

这种只能自行排查一下,为什么spring为什么没有读取到密码,或者看下是不是漏了配置。

@KomachiSion KomachiSion added the status/invalid This doesn't seem right label May 10, 2024
@LifetimeTender
Copy link
Author

大概率是你单元测试时读取的配置文件没有设置用户密码,而你直接启动时读取的配置文件或者jvm参数中有用户密码。

最后排查出来的问题是nacos客户端版本不匹配,nacos客户端降级到2.2.0就OK了.但是很奇怪的一个点,既然nacos客户端不匹配那么为什么正常启动项目就没问题

@KomachiSion
Copy link
Collaborator

  1. 我测试2.3.2客户端和2.2.0服务端是可以正常登录请求的, 应该还是配置哪里不正确,只是刚好你降级版本的时候修复掉了。
  2. 项目能启动,能正常获取配置和服务,说明你的服务端没有开启鉴权,不需要输入用户密码

@KomachiSion
Copy link
Collaborator

No more response from author for a long time, and this problem seems env problem.

@KomachiSion KomachiSion closed this as not planned Won't fix, can't repro, duplicate, stale May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants