본문 바로가기

Dot ./에러 모음

[Spring Error] Jwt 오류(io.jsonwebtoken.lang.UnknownClassException: Unable to load class named [io.jsonwebtoken.impl.DefaultJwtBuilder]from the thread context, current, or system/application ClassLoaders. All heuristics have been exhausted. Class coul..

Jwt 오류(io.jsonwebtoken.lang.UnknownClassException: Unable to load class named...

Springboot에 jwt를 연결하여 토큰을 발급받으려고 하는데 오류가 났다.

io.jsonwebtoken.lang.UnknownClassException
: Unable to load class named [io.jsonwebtoken.impl.DefaultJwtBuilder]
from the thread context, current, or system/application ClassLoaders. 
All heuristics have been exhausted. Class could not be found.
    ...
    ...
    ...

 

원인은 또 의존성문제..!

 

io.jsonwebtoken.lang.UnknownClassException: Unable to load class named [io.jsonwebtoken.impl.DefaultJwtParser] is thrown when pa

I am getting a runtime exception while passing jwt string for Claims. implementation('io.jsonwebtoken:jjwt-api:0.10.5') runtimeOnly('io.jsonwebtoken:jjwt-jackson:0.10.5') Claims cla...

github.com

 

나의 프로젝트는 아래와 같이 해결했다

// jwt
implementation 'io.jsonwebtoken:jjwt-api:0.10.7'

//오류 해결을 위해 추가로 넣은 의존성
runtime 'io.jsonwebtoken:jjwt-impl:0.10.7'
runtime 'io.jsonwebtoken:jjwt-jackson:0.10.7'

 

만약, RSASSA-PSS (PS256, PS384을 사용하려는 경우, PS512) 알고리즘을 사용하려면 이것을 추가해라.

 'org.bouncycastle : bcprov-jdk15on : 1.60'

 

 

JSON 처리에 gson을 사용하려면 이를 추가하자. (gson이란?)

compile 'io.jsonwebtoken:jjwt-gson:0.10.7'

 

 

jwt에 더 자세한 정보가 궁금하다면 여기로

 

jwtk/jjwt

Java JWT: JSON Web Token for Java and Android. Contribute to jwtk/jjwt development by creating an account on GitHub.

github.com

 

아래는 jwt에서 제공한 gralde 의존성 최신버전이다.