We have been using Apsose Email to get messages from an Exchange EWS Server.
Recently we were forced to make an upgrade to Open JDK 17.
I checked the documentation and played around with different dependencies but to no avail I always end up with an IllegalAccessError for [javax.xml.bind.JAXBContextFactory]:
javax.resource.spi.work.WorkCompletedException: java.lang.IllegalAccessError: Error while searching for service [javax.xml.bind.JAXBContextFactory]
at org.springframework.jca.work.SimpleTaskWorkManager$DelegatingWorkAdapter.run(SimpleTaskWorkManager.java:244)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.IllegalAccessError: Error while searching for service [javax.xml.bind.JAXBContextFactory]
at com.aspose.email.zg.a(SourceFile:246)
at com.aspose.email.zg.a(SourceFile:261)
at com.aspose.email.zg.a(SourceFile:435)
at com.aspose.email.EWSClient.a(SourceFile:440)
at com.aspose.email.EWSClient.getEWSClient(SourceFile:386)
at com.aspose.email.EWSClient.getEWSClient(SourceFile:371)
at com.aspose.email.EWSClient.getEWSClient(SourceFile:182)
… 3 more
Exception in thread “ThreadPoolTaskExecutor-70828” java.lang.IllegalAccessError: Error while searching for service [javax.xml.bind.JAXBContextFactory]
at com.aspose.email.zg.a(SourceFile:246)
at com.aspose.email.zg.a(SourceFile:261)
at com.aspose.email.zg.a(SourceFile:435)
at com.aspose.email.EWSClient.a(SourceFile:440)
at com.aspose.email.EWSClient.getEWSClient(SourceFile:386)
at com.aspose.email.EWSClient.getEWSClient(SourceFile:371)
at com.aspose.email.EWSClient.getEWSClient(SourceFile:182)
We are using aspose-email for Java 21.6.
I hope anyone is able to help us here!
Kind regards,
Gernot
Hello @GernotK,
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): EMAILJAVA-35303
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
Hello @GernotK,
In OpenJDK 17, the JAXB (Java Architecture for XML Binding) is not included in the JDK itself. This was a change that started from JDK 11, where the JAXB module was removed from the JDK and had to be included separately as an external dependency.
To use JAXB in an OpenJDK 17 project, you’ll need to add the JAXB dependencies to your project.
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.3.0.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.messaging.saaj</groupId>
<artifactId>saaj-impl</artifactId>
<version>1.5.1</version>
</dependency>
Jakarta dependencies (aspose-email-24.6-jdk16.jakarta.jar)
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>jakarta.xml.soap</groupId>
<artifactId>jakarta.xml.soap-api</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.messaging.saaj</groupId>
<artifactId>saaj-impl</artifactId>
<version>3.0.1</version>
</dependency>
Hi Sergey,
we have received a Licence for 24.6 and I am using that one now.
I included the Jakarta dependencies you have listed and they are packaged correclty into the jar.
But this then fails with:
java.lang.RuntimeException: javax.xml.soap.SOAPException: Unable to create message factory for SOAP: Error while searching for service [javax.xml.soap.MessageFactory]
at com.aspose.email.zh.a(SourceFile:315)
at com.aspose.email.zh.a(SourceFile:441)
at com.aspose.email.EWSClient.a(SourceFile:477)
at com.aspose.email.EWSClient.getEWSClient(SourceFile:423)
at com.aspose.email.EWSClient.getEWSClient(SourceFile:408)
at com.aspose.email.EWSClient.getEWSClient(SourceFile:160)
aspose_email_jars.png (4.8 KB)
Hello @GernotK,
Please verify if you are using the Aspose.Email release for Jakarta.
Aspose.Email for Jakarta is compatible with the Jakarta EE platform
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-email</artifactId>
<version>24.6</version>
<classifier>jdk16.jakarta</classifier>
</dependency>
Hello @sergey.vivsiuk,
many thanks, that was the issue. So now it’s time to happily change our Plugin to use the new version of aspose-email.
Wish you a nice day, and again many thanks for the help!
Gernot
Hello @GernotK,
Good luck with updating your plugin to the new version of Aspose.Email.
Wish you a great day too!