報錯原因
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).
原因總結
很明顯,報錯原因是secret key參數(shù) 長度不夠
打開nacos文件夾 -> conf -> application.properties
找到以下配置:
nacos.core.auth.plugin.nacos.token.secret.key=
在后面添加隨機參數(shù)作為nacos的加密密鑰,
規(guī)則是加密密鑰長度 >=256 bits 或者 >= 32 bytes
我添加了50位英文、數(shù)字成功運行文章來源:http://www.zghlxwxcb.cn/news/detail-515576.html
執(zhí)行
startup.cmd -m standalone
最終結果
成功點亮文章來源地址http://www.zghlxwxcb.cn/news/detail-515576.html
到了這里,關于解決Nacos2.2.1啟動報錯的文章就介紹完了。如果您還想了解更多內容,請在右上角搜索TOY模板網以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網!