Skip to content

JaxbContextContainer does not define the ClassLoader to use to retrieve the JAXBContext to use #33158

Closed
@renetrefft

Description

@renetrefft

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).

spring-xml-deserializer-bug.zip

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions