Search code examples
javaspring-bootkotlingradlejira-rest-java-api

Strange Issues with javax.ws.rs.core.UriBuilder


Today I updated a command line application to Spring Boot 3.0.6

I receive a BeanCreationException exception when starting the application. Reason is

Caused by: java.lang.ClassNotFoundException: javax.ws.rs.core.UriBuilder

which is needed internaly by com.atlassian.jira.rest.client.api.JiraRestClient. In IDEA, when I search for javax.ws.rs.core.UriBuilder I do not find any class.

So I included

implementation 'javax.ws.rs:javax.ws.rs-api:2.1.1'

in my Gradle build. Now I receive a

Caused by: java.lang.LinkageError: ClassCastException: attempting to cast
jar:file:/XXX/.gradle/caches/modules-2/files-2.1/javax.ws.rs/javax.ws.rs-api/2.1.1/d3466bc9321fe84f268a1adb3b90373fc14b0eb5/javax.ws.rs-api-2.1.1.jar!/javax/ws/rs/ext/RuntimeDelegate.class to
jar:file:/XXX/.gradle/caches/modules-2/files-2.1/javax.ws.rs/javax.ws.rs-api/2.1.1/d3466bc9321fe84f268a1adb3b90373fc14b0eb5/javax.ws.rs-api-2.1.1.jar!/javax/ws/rs/ext/RuntimeDelegate.class

both lines/files are identically.

Things I tried so far:

  • Checking for different versions of javax.ws.rs with gradlew dependencies
  • Clean build

Has anyone an idea how to solve this and why is UriBuilder gone at all?


Solution

  • The reason is I think according to the Spring-Boot Release Notes (https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.0-Release-Notes), it is clearly mentioned it has been migrated from Java EE to Jakarta EE APIs (in this case javax.ws.rs and your Spring-Boot version is Spring Boot 3.0.6).

    Spring Boot 3.0 has migrated from Java EE to Jakarta EE APIs for all dependencies. Wherever possible, Jakarta EE 10 compatible dependencies have been chosen, including:

    It has further included the compatible version to use is Jakarta WS RS 3.1