使用 JJWT 导致 "java.lang.SecurityException: Invalid signature file digest for Manifest main attributes"

Using JJWT causes "java.lang.SecurityException: Invalid signature file digest for Manifest main attributes"

为什么在使用 Java JSON Web 令牌 (JJWT) 时出现 "java.lang.SecurityException: Invalid signature file digest for Manifest main attributes" 错误?

我的代码是(以最简单的形式从 https://github.com/jwtk/jjwt 复制而来):

Key key = MacProvider.generateKey();

String compactJws = Jwts.builder()
    .setSubject("Joe")
    .signWith(SignatureAlgorithm.HS512, key)
    .compact();
return compactJws;

异常停止于 "Key key = MacProvider.generateKey();"。如果我注释掉该行,它将在下一行停止 ("String compactJws =...")

请帮忙!

好的。我解决了我自己的问题。这是 jar 文件没有正确编译。我从某处下载了一个 jar,它工作正常。