I have an API that receives a JWT token for authorization.
Once it starts the process of working with the token to authenticate it throws this error:
Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter
I read that in Java 11 they removed the java.xml.bind library from the JDK. I added these two dependencies as suggested in the answer:
implementation "jakarta.xml.bind:jakarta.xml.bind-api:3.0.0"
and
implementation "org.glassfish.jaxb:jaxb-runtime:3.0.0"
.
Also tried implementation "jakarta.xml.bind:jakarta.xml.bind-api:3.0.0"
and implementation 'com.sun.xml.bind:jaxb-impl:3.0.0'
.
But I still get the same error and I cannot find any other solution to this.
I use Java 11 and Spring boot 2.6.6.
Thanks for the help
i solved this problem by removing old jjwt 0.9.1 and add these
implementation 'io.jsonwebtoken:jjwt-api:0.11.5'
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.11.5'
runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.11.5'
As @andréootide said JJWT needs DatatypeConverter from javax.xml.bind..... I solved my problem by adding
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With