Skip to content
Advertisement

Can’t find io.jsonwebtoken.impl.DefaultJwtBuilder when starting project in a docker container

When starting my Quarkus project locally with mvn quarkus:dev I have no errors when executing a function which utilizes JJWT. However when I export my project into a docker container it gives me an error stating that it can’t find DefaultJwtBuilder.

When dockerizing my project I first execute

./mvnw package -Pnative -Dquarkus.native.container-build=true

as stated in the Quarkus docs for creating a Linux executable without GraalVM.

Followed by

docker build -f src/main/docker/Dockerfile.native -t quarkus-quickstart/getting-started .

When starting the project with Docker Desktop I get the error.

The dependencies I have in my pom.xml are the following.

JavaScript

The detailed error message is

JavaScript

The dockerfile I use to build my docker image is

JavaScript

Any help would be greatly appreciated.

Advertisement

Answer

It doesn’t work because your are using native mode and the io.jsonwebtoken library seems that does not support it.

Quarkus does its best to integrate libraries and make them work with native mode, by adding the pieces required by native mode. For native mode limitations, please check this link: https://www.graalvm.org/reference-manual/native-image/Limitations/.

Please check Quarkus JWT support that works with native mode: https://quarkus.io/guides/security-jwt.

If you really want to keep using io.jsonwebtoken you may need to provide additional metadata to the native image build: https://quarkus.io/guides/writing-native-applications-tips.

Advertisement