在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
    在这里插入图片描述
    在这里插入图片描述

GitHub 加速计划 / na / nacos
29.81 K
12.75 K
下载
Nacos是由阿里巴巴开源的服务治理中间件,集成了动态服务发现、配置管理和服务元数据管理功能,广泛应用于微服务架构中,简化服务治理过程。
最近提交(Master分支:2 个月前 )
3a9003bc 30 天前
963b221f 30 天前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐