During upgrade of an existing project we were experiencing some interesting dependency issues in regards to spring-boot-starter-jpa in regards to jakarta-activation.
I don't really understand the issue - but without explicitly including the dependency to jakarta-activation-api in my pom.xml the dependency seems to not be available.
<dependency>
<groupId>jakarta.activation</groupId>
<artifactId>jakarta.activation-api</artifactId>
<version>2.1.1</version>
</dependency>
it also helps if I include a dependency towards (and thus pulling in a more recent version of this dependency) - but I don't know what this might break...
<dependency>
<groupId>org.eclipse.angus</groupId>
<artifactId>angus-activation</artifactId>
<version>2.0.0</version>
</dependency>
For testing purposes on the other side spring-boot-starter-test seems to be pulling in jakarta.activation-api via jakarta.xml.bind-api.
I created an example project to showcase the issue. https://github.com/EagerSloth/MimetypesFileTypeMapIssue
It includes the additional dependency to jakarta.activation-api in the pom.xml.
Without it the project won't compile...
Comment From: wilkinsona
This is due to a change in Hibernate 6 where its dependency on the JAX-B runtime has changed from a compile dependency to a runtime dependency. You can see the affects of this using mvn dependency:tree
Here's the output from Spring Boot 2.7.8 (Hibernate 5.6):
[INFO] --- maven-dependency-plugin:3.3.0:tree (default-cli) @ MimetypesFileTypeMapIssue ---
[INFO] com.example:MimetypesFileTypeMapIssue:war:0.0.1-SNAPSHOT
[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:2.7.8:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-aop:jar:2.7.8:compile
[INFO] | | +- org.springframework:spring-aop:jar:5.3.25:compile
[INFO] | | \- org.aspectj:aspectjweaver:jar:1.9.7:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-jdbc:jar:2.7.8:compile
[INFO] | | +- com.zaxxer:HikariCP:jar:4.0.3:compile
[INFO] | | \- org.springframework:spring-jdbc:jar:5.3.25:compile
[INFO] | +- jakarta.transaction:jakarta.transaction-api:jar:1.3.3:compile
[INFO] | +- jakarta.persistence:jakarta.persistence-api:jar:2.2.3:compile
[INFO] | +- org.hibernate:hibernate-core:jar:5.6.14.Final:compile
[INFO] | | +- org.jboss.logging:jboss-logging:jar:3.4.3.Final:compile
[INFO] | | +- net.bytebuddy:byte-buddy:jar:1.12.22:compile
[INFO] | | +- antlr:antlr:jar:2.7.7:compile
[INFO] | | +- org.jboss:jandex:jar:2.4.2.Final:compile
[INFO] | | +- com.fasterxml:classmate:jar:1.5.1:compile
[INFO] | | +- org.hibernate.common:hibernate-commons-annotations:jar:5.1.2.Final:compile
[INFO] | | \- org.glassfish.jaxb:jaxb-runtime:jar:2.3.7:compile
[INFO] | | +- org.glassfish.jaxb:txw2:jar:2.3.7:compile
[INFO] | | +- com.sun.istack:istack-commons-runtime:jar:3.0.12:compile
[INFO] | | \- com.sun.activation:jakarta.activation:jar:1.2.2:runtime
And here's the output from Spring Boot 3.0.2 (Hibernate 6.1):
[INFO] --- maven-dependency-plugin:3.3.0:tree (default-cli) @ MimetypesFileTypeMapIssue ---
[INFO] com.example:MimetypesFileTypeMapIssue:war:0.0.1-SNAPSHOT
[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:3.0.2:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-aop:jar:3.0.2:compile
[INFO] | | +- org.springframework:spring-aop:jar:6.0.4:compile
[INFO] | | \- org.aspectj:aspectjweaver:jar:1.9.19:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-jdbc:jar:3.0.2:compile
[INFO] | | +- com.zaxxer:HikariCP:jar:5.0.1:compile
[INFO] | | \- org.springframework:spring-jdbc:jar:6.0.4:compile
[INFO] | +- org.hibernate.orm:hibernate-core:jar:6.1.6.Final:compile
[INFO] | | +- jakarta.persistence:jakarta.persistence-api:jar:3.1.0:compile
[INFO] | | +- jakarta.transaction:jakarta.transaction-api:jar:2.0.1:compile
[INFO] | | +- org.jboss.logging:jboss-logging:jar:3.5.0.Final:runtime
[INFO] | | +- org.hibernate.common:hibernate-commons-annotations:jar:6.0.2.Final:runtime
[INFO] | | +- org.jboss:jandex:jar:2.4.2.Final:runtime
[INFO] | | +- com.fasterxml:classmate:jar:1.5.1:runtime
[INFO] | | +- net.bytebuddy:byte-buddy:jar:1.12.22:runtime
[INFO] | | +- org.glassfish.jaxb:jaxb-runtime:jar:4.0.1:runtime
[INFO] | | | \- org.glassfish.jaxb:jaxb-core:jar:4.0.1:runtime
[INFO] | | | +- org.eclipse.angus:angus-activation:jar:1.0.0:runtime
If you require a compile-time dependency on the Activation API, you should declare one as you have done.