nacos2.2.3开启权限验证,nacos启动报错Error creating bean with name ‘basicAuthenticationFilter‘ defined in class

启动完整报错

ERROR Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'basicAuthenticationFilter' defined in class path resource [com/alibaba/nacos/prometheus/filter/PrometheusAuthFilter.class]: Unsatisfied dependency expressed through method 'basicAuthenticationFilter' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'nacosAuthConfig' defined in URL [jar:file:/C:/杩呴浄涓嬭浇/nacos-server-2.2.3/nacos/target/nacos-server.jar!/BOOT-INF/lib/nacos-plugin-default-impl-2.2.3.jar!/com/alibaba/nacos/plugin/auth/impl/NacosAuthConfig.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'tokenManagerDelegate': 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:/C:/杩呴浄涓嬭浇/nacos-server-2.2.3/nacos/target/nacos-server.jar!/BOOT-INF/lib/nacos-plugin-default-impl-2.2.3.jar!/com/alibaba/nacos/plugin/auth/impl/token/impl/JwtTokenManager.class]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.alibaba.nacos.plugin.auth.impl.token.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

作者的解决方式

  • 缺少配置了nacos.core.auth.plugin.nacos.token.secret.key
nacos.core.auth.plugin.nacos.token.secret.key=SecretKey012345678901234567890123456789012345678901234567890123456789

这种类型报错的通用解决方式

  • 从官网文档中把没补齐的参数全补齐上去
  • nacos权限验证官方文档
  • nacos.core.auth.plugin.nacos.token.secret.key的默认值
    SecretKey012345678901234567890123456789012345678901234567890123456789
    
    nacos2.2.3开启权限验证,nacos启动报错Error creating bean with name ‘basicAuthenticationFilter‘ defined in class_第1张图片
    nacos2.2.3开启权限验证,nacos启动报错Error creating bean with name ‘basicAuthenticationFilter‘ defined in class_第2张图片

你可能感兴趣的:(其他,nacos)