当前位置:   article > 正文

解决Nacos2.2.1启动报错_the length of secret key must great than or equal

the length of secret key must great than or equal 32 bytes; and the secret k

解决Nacos2.2.1启动报错

报错原因

Caused by: 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 http://xxx....
Caused by: java.lang.IllegalArgumentException: 
          The specified key byte array is x bits which is not secure enough for any JWT HMAC-SHA algorithm.  
          The JWT JWA Specification (RFC 7518, Section 3.2) states that keys used with HMAC-SHA algorithms MUST have a size >= 256 bits (the key size must be greater than or equal to the hash output size). 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

原因总结

很明显,报错原因是secret key参数 长度不够
打开nacos文件夹 -> conf -> application.properties
找到以下配置:
nacos.core.auth.plugin.nacos.token.secret.key=
在后面添加随机参数作为nacos的加密密钥,
规则是加密密钥长度 >=256 bits 或者 >= 32 bytes

我添加了50位英文、数字成功运行

执行

startup.cmd -m standalone
  • 1

最终结果

成功点亮
在这里插入图片描述

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小小林熬夜学编程/article/detail/486098
推荐阅读
相关标签
  

闽ICP备14008679号