Nacos 2.2.0.1启动服务失败, 提示Error creating bean with name ‘user‘:

 在GitHub上下了一个Nacos的2.2.0.1版本,直接解压,安装到本地,启动服务失败。。what??
查看了一下报错信息,它给了提示,去这个网站(https://nacos.io/zh-cn/docs/v2/guide/user/auth.html)查看一下原因。

UnsatisfiedDependencyException: Error creating bean with name 'user': Unsatisfied dependency expressed through field 'jwtTokenManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jwtTokenManager' defined in URL [jar:file:/D:/nacos-server-2.2.0.1/nacos/target/nacos-server.jar!/BOOT-INF/lib/nacos-plugin-default-impl-2.2.0.jar!/com/alibaba/nacos/plugin/auth/impl/JwtTokenManager.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.alibaba.nacos.plugin.auth.impl.JwtTokenManager]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: the length of secret key must great than or equal 32 bytes; And the secret key  must be encoded by base64.Please see https://nacos.io/zh-cn/docs/v2/guide/user/auth.html
  1. 官网给的提示是,在2.2.0.1版本之后,不提供以下的默认值了。
    在这里插入图片描述

  2. 然后我就去本地的application.properties看了一下,果然是空的!一阵操作,给他补上
    这里官网给了示例,我就直接按照他给的示例做了密钥填充。
    在这里插入图片描述

    修改前:
    在这里插入图片描述
    修改后:
    在这里插入图片描述

  3. 再进入到nacos的bin目录下,打开cmd窗口,使用 startup.cmd -m standalone 命令,以单机模式运行,成功!在浏览器中输入 localhost:8848/nacos进行登录,用户名和密码都是nacos
    在这里插入图片描述
    在这里插入图片描述

评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值