RESOLVED - Spring Boot Starter Mail - failed to access class com.sun.activation.registries.LogSupport from class javax.activation.MimetypesFileTypeMap

Viewed 546

I want to share the solution for above issue when using Spring Boot Starter Mail and attempt to create instance of MimeMessageHelper results in exception: failed to access class com.sun.activation.registries.LogSupport from class javax.activation.MimetypesFileTypeMap

The issue is behind the jaxb-core dependency in version 4.0.0 which brings angus-activation library dependency. The library if loaded first doesn't have a public class of LogSupport. The correct source of LogSupport is from com.sun.activation:jakarta.activation library.

Solution is to exclude the following in jaxb-core dependency:

<dependency>
 <groupId>com.sun.xml.bind</groupId>
 <artifactId>jaxb-core</artifactId>
 <version>4.0.0</version>
 <exclusions>
  <exclusion>
   <groupId>org.eclipse.angus</groupId>
   <artifactId>angus-activation</artifactId>
  </exclusion>
 </exclusions>
</dependency>

At the same time the following dependency should be available:

<dependency>
 <groupId>com.sun.activation</groupId>
 <artifactId>jakarta.activation</artifactId>
 <version>2.0.1</version>
</dependency>
2 Answers

add

<dependency>
    <groupId>jakarta.xml.bind</groupId>
    <artifactId>jakarta.xml.bind-api</artifactId>
    <version>4.0.0</version>
</dependency>

<dependency>
    <groupId>javax.xml.bind</groupId>
    <artifactId>jaxb-api</artifactId>
    <version>2.3.1</version>
</dependency>

Downgrade jaxws-rt to version 2.3.1 solve the problem for me

Related