java.lang.ClassNotFoundException: Correspondence when it comes with javax.xml.bind.JAXBException

Update to Java 9

Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582) ~[na:na]
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:185) ~[na:na]
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496) ~[na:na]

When it comes, let's add jaxb-api to the dependency. With gradle

compile group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.0'

With Maven

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

The latest version at that time is recommended.

Reason

Starting with Java 9, [some J2EE classes are no longer visible from the JDK by default](https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-F640FA9D-FB66-4D85 -AD2B-D931174C09A3) is the cause.

Java startup options can also be used, but considering the future, it is better to describe the dependency in the build system.

Recommended Posts

java.lang.ClassNotFoundException: Correspondence when it comes with javax.xml.bind.JAXBException
When I used Slick on Rails, it competed with Turbolinks.