코딩/Spring

[SpringSecurity] JWT 구현 시 javax/xml/bind/DatatypeConverter

it 끄적이기 2022. 1. 13. 18:06

[SpringSecurity] JWT 구현 시 javax/xml/bind/DatatypeConverter

 

Spring Security 프레임워크와 JsonWebToken 을 이용하여 웹인증을 구현하는 도중,

로그인을 시도해서 서버로부터 토큰을 얻으려고 할때, 웹서버 로그에 다음과 같은 에러가 발생했습니다.

java.lang.NoClassDefFoundError: Could not initialize class javax.xml.bind.DatatypeConverterImpl

 

 

아래와 같이 dependency를 추가해준다.

 

Maven

<dependency>
	<groupId>javax.xml.bind</groupId>
	<artifactId>jaxb-api</artifactId>
    <version>2.1</version>
</dependency>

 

Gradle

// https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api
implementation group: 'javax.xml.bind', name: 'jaxb-api', version: '2.1'

 

https://stackoverflow.com/questions/55606519/getting-exception-java-lang-noclassdeffounderror-could-not-initialize-class-jav

 

Getting exception java.lang.NoClassDefFoundError: Could not initialize class javax.xml.bind.DatatypeConverterImpl

Getting the following exception , while implementing Jwt Spring Security implementation : java.lang.NoClassDefFoundError: Could not initialize class javax.xml.bind.DatatypeConverterImpl . in a Sp...

stackoverflow.com