I think, that this is a bug. I migrate application from earlier version of Spring Boot and java 8 to 2.3.2.RELEASE and Java 11 Because I do some xml parsing I added to my gradle project some dependencies - missing in Java 11
implementation "javax.xml.bind:jaxb-api:2.3.1"
implementation "com.sun.xml.bind:jaxb-core:2.3.0"
implementation "com.sun.xml.bind:jaxb-impl:2.3.1"
implementation "com.sun.activation:javax.activation:1.2.0"
implementation "javax.xml.soap:javax.xml.soap-api:1.4.0"
implementation "com.sun.xml.messaging.saaj:saaj-impl:1.5.2"
implementation "javax.xml.soap:saaj-api:1.3.5"
When I run my application directly from IDE ( Intelij) it run fine, but when I create jar with Spring boot
plugins {
id "io.spring.dependency-management" version "1.0.9.RELEASE"
id 'org.springframework.boot' version '2.3.2.RELEASE'
id 'java'
id 'eclipse'
id 'idea'
id 'application'
}
bootJar {
launchScript()
requiresUnpack '**/jaxb-*.jar'
}
I have ClassNotFoundException
021-09-24 12:50:26.840 ERROR 7128 --- [Pool-3-worker-3] p.b.search.loaders.GeneralFileLoader : loadFile XX19.xml error:javax.xml.bind.JAXBException: Implementation of JAXB-API has not been found on module path or classpath.
- with linked exception:
[java.lang.ClassNotFoundException: com.sun.xml.bind.v2.ContextFactory]
javax.xml.bind.JAXBException: Implementation of JAXB-API has not been found on module path or classpath.
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:278) ~[jaxb-api-2.3.1.jar:2.3.0]
at javax.xml.bind.ContextFinder.find(ContextFinder.java:397) ~[jaxb-api-2.3.1.jar:2.3.0]
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:721) ~[jaxb-api-2.3.1.jar:2.3.0]
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:662) ~[jaxb-api-2.3.1.jar:2.3.0]
Of course class com.sun.xml.bind.v2.ContextFactory exists in jaxb-impl-2.3.1.jar
So it looks there is some problem with classloading
A use
ForkJoinPool forkJoinPool = new ForkJoinPool(poolSize);
to parse XMl and this exception happens in forkJoinPool.submit
Comment From: wilkinsona
The default thread context class loader used by a ForkJoinPool
changed in Java 11. Please see https://github.com/spring-projects/spring-boot/issues/19427 for some further details.
Also, please note that Spring Boot 2.3.x has reached the end of its OSS support period. You should upgrade to 2.4.x or 2.5.x at your earliest convenience.