spring-bootjerseyapache-nifijava-17jersey-client

Upgrading spring boot 3 with Jersey client: ClassCastException: attempting to castjar:file:


I'm upgrading my java spring boot app to spring boot 3.

I upgraded org.glassfish.jersey.core:jersey-client from version 2 to 3.1.3, that use jakarta instead of javax package.

The problem is that one of my dependencies using old package 'javax', for example the image below is the code that it failed: ClientBuilder.newBuilder(): enter image description here

Is there any solution that I can force that package to use jakarta or I have to implement the api and upgrade it my self?

Thank you for your help!

here is the error when I start the app:

Caused by: java.lang.LinkageError: ClassCastException: attempting to castjar:file:

/C:/Users/QOV3783/.gradle/caches/modules-2/files-2.1/javax/javaee-api/8.0.1/515a40c1f19802a18a187f59bfbe445a62218a04/javaee-api-8.0.1.jar!/javax/ws/rs/client/ClientBuilder.class 

to jar:file:

/C:/Users/QOV3783/.gradle/caches/modules-2/files-2.1/javax/javaee-api/8.0.1/515a40c1f19802a18a187f59bfbe445a62218a04/javaee-api-8.0.1.jar!/javax/ws/rs/client/ClientBuilder.class

Solution

  • The package that I used is nifi-registry-client version 1.23.2: https://mvnrepository.com/artifact/org.apache.nifi.registry/nifi-registry-client

    My solution is that I have to implement all the methods that I used in my code, and upgraded all the javax errors to jarkata by my self.