Spring Boot
Error io.jsonwebtoken.lang.UnknownClassException (Maven 방식)
녹녹1
2023. 8. 7. 02:58
Session Stroage에 저장시키는 방식에서 JWT 방식으로 수정하고 있는데 진짜 한 번 실행 시킬 때마다 오류가 났다.. ^^
그 중 UnknownClassException 오류도 있었다
io.jsonwebtoken.lang.UnknownClassException: Unable to find an implementation for interface io.jsonwebtoken.io.Serializer using java.util.ServiceLoader. Ensure you include a backing implementation .jar in the classpath, for example jjwt-impl.jar, or your own .jar for custom implementations.
gpt한테 물어보니까 jjwt-imple dependency를 추가하라는데
이미 pom.xml에다가
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
<version>2.7.13</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-api</artifactId>
<version>0.11.2</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-impl</artifactId>
<version>0.11.2</version>
<scope>runtime</scope>
</dependency>
dependency들을 다 추가해 둔 상태였다.
에러가 계속 떠서 지웠다가도 해보고 프로젝트를 clean했다가 재빌드도 해봤다
그런데 알고보니
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-jackson</artifactId>
<version>0.11.2</version>
<scope>runtime</scope>
</dependency>
잭슨을 추가하면 해결되는 문제였다.
ㅋㅋ ㅠㅠ 다른 사람들은 나처럼 헤메지 않기를 바라며..