It took a long time and it was quite difficult, so I made a memorandum.
During development, there was talk of updating the Java version of a project that was working so far to 11.
In conclusion, I got stuck with an endless error containing a message like the one below.
JAXBContext cannot be resolved The import javax.xml.bind cannot be resolved
There were other errors, but the point is that the previously used libraries such as javax.xml.bind suddenly became unusable.
Java11(jdk-11.0.1) Spring Tool Suite 3.9.6.RELEASE
Add the following to pom.xml
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>javax.activation-api</artifactId>
<version>1.2.0</version>
</dependency>
You need to prepare a library that is said to be missing.
There was an item called Removed Features and Options in Oracle's JDK 11 Release Notes. It seems that some system properties will be unavailable from Java 11.
↓ Copy the area that was related to you. (The library where the deficit was angry)
In addition, the following system properties are no longer applicable due to the the removal of the Java EE and CORBA modules:
com.sun.xml.internal.ws.client.ContentNegotiation com.sun.xml.internal.ws.legacyWebMethod javax.xml.bind.context.factory javax.xml.bind.JAXBContext javax.xml.soap.MetaFactory javax.xml.ws.spi.Provider jaxb.fragment jaxb.noNamespaceSchemaLocation jaxb.schemaLocation jaxb.formatted.output jaxb.encoding
The whole story is written in the release notes.
■ Release notes https://www.oracle.com/technetwork/java/javase/11-relnote-issues-5012449.html
■ Removed Features and Options https://www.oracle.com/technetwork/java/javase/11-relnote-issues-5012449.html#Removed
There are many other things such as mail.mime missing.
The project that used the library deleted here until now was that if you update to Java 11 without preparation, an error will naturally occur.
A page I found while searching to solve the above error (I didn't know the cause at that time)
https://stackoverflow.com/questions/43574426/how-to-resolve-java-lang-noclassdeffounderror-javax-xml-bind-jaxbexception-in-j
https://github.com/authzforce/restful-pdp/issues/4
Recommended Posts