Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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>
like image 752
Adam Sojka Avatar asked Sep 10 '25 23:09

Adam Sojka


1 Answers

For me helped adding that dependencies to pom.xml :)

       <dependency>
        <groupId>jakarta.mail</groupId>
        <artifactId>jakarta.mail-api</artifactId>
        <version>2.1.0</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.eclipse.angus</groupId>
        <artifactId>jakarta.mail</artifactId>
        <version>1.0.0</version>
    </dependency>
like image 67
Mariusz Avatar answered Sep 13 '25 14:09

Mariusz