Closed
Description
Consuming a XML API using Spring WebClient fails if JdkClientHttpConnector
is configured. This exception is thrown:
...
Caused by: java.lang.ClassNotFoundException: org.glassfish.jaxb.runtime.v2.ContextFactory
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) ~[na:na]
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) ~[na:na]
...
Attached is a simple project to demonstrate the issue. Please execute Gradle task assemble
to build the JAR file. Then run the application with java -jar ...
. My environment is Eclipse Temurin JDK 21.0.3+9 on Windows 10 22H2 x64.
When running from IntelliJ IDEA directly instead, the issue does not occur.
Not affected are Spring RestClient and RestTemplate when also configured with JDK HttpClient (JdkClientHttpRequestFactory
).