IllegalStateException: For MAC signing you do not need to specify the verifier key separately...

一.异常现象

我在SpringCloud微服务项目中,利用SpringSecurity整合OAuth2,结合RSA非对称加密算法实现jwt token的时候,遇到了如下异常信息:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfiguration': Unsatisfied dependency expressed through field 'tokenStore'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tokenStore' defined in class path resource ....: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.oauth2.provider.token.TokenStore]: Factory method 'tokenStore' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'accessTokenConverter' defined in class path resource ... Invocation of init method failed; nested exception is java.lang.IllegalStateException: For MAC signing you do not need to specify the verifier key separately, and if you do it must match the signing key
.....
Caused by: java.lang.IllegalStateException: For MAC signing you do not need to specify the verifier key separately, and if you do it must match the signing keyat org.springframework.util.Assert.state(Assert.java:73) ~[spring-core-5.0.11.RELEASE.jar:5.0.11.RELEASE]at ....

二.异常原因

出现这个问题的原因,一般都是因为自己的RSA公钥文件写错了!

比如我一开始利用keytool工具导出的公钥,然后把公钥复制粘贴到自己的public.txt文件中,结果少粘贴了3个“---”,就导致了该问题的产生!如下图标红区域所示:

三.解决办法

一定要确保自己的public.txt公钥文件格式和内容正确!从keytool中导出的时候仔细点就好了!

IllegalStateException: For MAC signing you do not need to specify the verifier key separately异常解决相关推荐

  1. JDK8 stream toMap() java.lang.IllegalStateException: Duplicate key异常解决(key重复)

    测试又报bug啦 接到测试小伙伴的问题,说是一个接口不返回数据了,好吧,虽然不是我写的接口任务落到头上也得解决,本地调试了一下,好家伙,直接抛了个异常出来,这又是哪位大哥喝醉了写的代码... Exce ...

  2. java.lang.IllegalStateException: Failed to load ApplicationContext selenium 异常 解决

    java.lang.IllegalStateException: Failed to load ApplicationContext selenium 异常 解决 参考文章: (1)java.lang ...

  3. Mac系统终端命令行不执行命令 总出现command not found解决方法

    Mac系统终端命令行不执行命令 总出现command not found解决方法 参考文章: (1)Mac系统终端命令行不执行命令 总出现command not found解决方法 (2)https: ...

  4. Mac Mounty正常卸载方法(mount failed异常解决)

    Mac Mounty正常卸载方法(mount failed异常解决) tags: Mac ● 挂载失败 由于磁盘未正常卸载, 部分扇区被污染导致无法正常加载, 需进行磁盘修复: Windows系统下使 ...

  5. Mac更新后ae不能打开,ae安装后打开报错解决方法

    Mac更新后ae不能打开,mac最新系统ae打不开,ae安装后打开报错怎么办?有网友提问,装的AE2021版本,之前还好好的,突然某天就打不开了,重装AE也没用,怎么都打不开,每次都提示这个?如何解决 ...

  6. 【mac使用技巧】程序坞上的下载不见了该如何解决呢?

    苹果电脑程序坞上的下载不见了怎么办?下面小编分享如何解决这个问题.一起来看看吧! 1.首先在程序坞上点击"访达"文件夹. 2.打开访达后,可以在左侧的功能列表中看到"下载 ...

  7. mac python3打包成窗体程序_使用pyinstaller将python程序打包成exe/苹果软件的方法与异常解决 - pytorch中文网...

    一.安装pyinstaller 通过清华镜像安装比较快 # 二者选其一执行,第二条快 pip3 installer pyinstaller # 清华镜像安装 # pip3 install -i htt ...

  8. 在Mac OS10.15版本及之后Adobe AIR.framework损坏无法打开的解决办法

    在Mac OS10.15版本及之后Adobe AIR.framework损坏无法打开的解决办法 一.问题描述 如果你最近将你的Mac OS升级到了Mac OS Catalina,你可能会注意到之前基于 ...

  9. nested exception is java.lang.IllegalStateException: refreshAfterWrite requires a LoadingCache异常解决

    nested exception is java.lang.IllegalStateException: refreshAfterWrite requires a LoadingCache异常解决 问 ...

  10. CodeSign error: code signing is required for product type Application in SDK iOS XXX的解决办法

    转自:http://www.tuicool.com/articles/jYRNbm 在真机测试的时候往往会突然出现这样一个错误,code signing is required for product ...

最新文章

  1. Swarm 如何实现 Failover?- 每天5分钟玩转 Docker 容器技术(98)
  2. 电脑键盘中英文按键有哪些?有什么作用?
  3. IOS 获取农历方法(转)
  4. (王道408考研操作系统)第二章进程管理-第二节1:调度的基本概念及分类以及进程优先级
  5. 开源xen对比_女实习生在Xen Project上摇摆开源
  6. sql生成(查询数据的存储过程)代码的存储过程
  7. hash算法_Hash 一致性算法的 Java 实现
  8. 浏览器打不开CSDN博客网站解决方法
  9. 【教你在win7中开启四声道效果】
  10. 用PPT制作简易红蓝底一寸照
  11. 基于龙芯CPU中标麒麟操作系统的国产半实物仿真系统ETestDEV
  12. 大学计算机课能旷课吗,计算机课旷课检讨书
  13. P255Java练习
  14. 算法分析与设计实验报告——实现汽车加油问题
  15. c# Excel 添加组合Range区域,方便选择Select()删除 Delete()
  16. 计算机核心期刊排名及简介一览
  17. python 画折线图怎么控制x轴间隔_用Python设置matplotlib.plot的坐标轴刻度间隔以及刻度范围...
  18. [ctf.show.reverse] 红包六
  19. appendChild()方法
  20. Redis 全实践(超长文预警)

热门文章

  1. 算法图解(递归调用栈)
  2. limits学习之各数据类型的范围及相关属性
  3. 浩辰cad电气2021 安装教程
  4. 微信群发工具,纯Python编写~
  5. llvm如何使用vc编译器_使用LLVM框架创建可用的编译器,第1部分
  6. HIVE 实现均匀抽样
  7. 功能测试数据测试之错误推测方法
  8. pyTest官方手册(Release 4.2)之蹩脚翻译(2)
  9. 假AI?如何辨识 AI 界的snake oil
  10. java 判断标点符号_Java判断中英文符号、标点的实现