Bean引发的异常:java.lang.NoClassDefFoundError:com / auth0 / jwt / algorithms / Algorithm

时间:2019-04-12 16:20:38

标签: java java-ee glassfish jwt jwt-auth

我正在尝试生成jwt令牌,并使用JWT库提供的算法对其进行签名。调用其余服务登录名时,该方法尝试创建令牌时出现此错误。

javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean: java.lang.NoClassDefFoundError: com/auth0/jwt/algorithms/Algorithm
    at com.sun.ejb.containers.EJBContainerTransactionManager.checkExceptionClientTx(EJBContainerTransactionManager.java:668)
    at com.sun.ejb.containers.EJBContainerTransactionManager.postInvokeTx(EJBContainerTransactionManager.java:509)

我的进口

import com.auth0.jwt.JWT;
import com.auth0.jwt.algorithms.Algorithm;

创建令牌方法

try {
         Algorithm algorithm = Algorithm.HMAC512("secret");       
         token
      =JWT.create().withSubject(username).withIssuer("OAuth").sign(algorithm);
        } catch (Exception e) {
            return null;
        }

jwt jar包含在库中 http://prntscr.com/nb4447

由于Jwt库是通过在Maven中作为依赖项导入而提供的,因此我无法弄清楚该错误的显示方式。

有人知道吗?

0 个答案:

没有答案
相关问题