java.lang.IllegalStateException: The given Private Key is null.


2023-04-06 18:21:55.529  INFO 18008 --- [nio-9901-exec-1] c.t.vgc.rootCA.utils.JWTUtils            : privateKeyPath:D:\awakenProjects\rootca\src\main\resources\client.pkcs8.key
Could not reconstruct the private key
2023-04-06 18:21:55.628 ERROR 18008 --- [nio-9901-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is com.auth0.jwt.exceptions.SignatureGenerationException: The Token's Signature couldn't be generated when signing using the Algorithm: SHA256withECDSA] with root cause

java.lang.IllegalStateException: The given Private Key is null.
    at com.auth0.jwt.algorithms.ECDSAAlgorithm.sign(ECDSAAlgorithm.java:60) ~[java-jwt-3.8.0.jar:na]
    at com.auth0.jwt.JWTCreator.sign(JWTCreator.java:333) ~[java-jwt-3.8.0.jar:na]
    at com.auth0.jwt.JWTCreator.access$100(JWTCreator.java:24) ~[java-jwt-3.8.0.jar:na]

好了 解决了 环境变量配错了 导致私钥没取到

私钥 没有获取成功,后面判断 私钥为空了,所以报错了,检查 一下 私钥是怎么获取的

不知道你这个问题是否已经解决, 如果还没有解决的话:

如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^