avatar

java.lang.RuntimeException java.nio.charset.MalformedInputException Input length = 1

异常信息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
java.lang.RuntimeException: java.nio.charset.MalformedInputException: Input length = 1
at org.springframework.security.jwt.codec.Codecs.utf8Decode(Codecs.java:82)
at org.springframework.security.jwt.codec.Codecs.utf8Decode(Codecs.java:74)
at org.springframework.security.jwt.JwtHeaderHelper.parseParams(JwtHelper.java:126)
at org.springframework.security.jwt.JwtHeaderHelper.create(JwtHelper.java:115)
at org.springframework.security.jwt.JwtHelper.decode(JwtHelper.java:53)
at org.springframework.security.jwt.JwtHelper.decodeAndVerify(JwtHelper.java:76)
at com.changgou.oauth.ParseJwtTest.parseJWT(ParseJwtTest.java:13)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
Caused by: java.nio.charset.MalformedInputException: Input length = 1
at java.nio.charset.CoderResult.throwException(CoderResult.java:281)
at java.nio.charset.CharsetDecoder.decode(CharsetDecoder.java:816)
at org.springframework.security.jwt.codec.Codecs.utf8Decode(Codecs.java:79)
... 28 more

异常截图

异常截图一
异常截图二

异常原因

1
1.基于公钥解析jwt令牌,原因未知,重新基于私钥生成jwt再解析即可
文章作者: 123
文章链接: https://gao5805123.github.io/123/2020/05/03/java.lang.RuntimeException%20java.nio.charset.MalformedInputException%20Input%20length%20=%201/
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 123
打赏
  • 微信
    微信
  • 支付宝
    支付宝