Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
renetrefft opened this issue Jul 7, 2024 · 5 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug
Milestone

Comments

@renetrefft
Copy link

renetrefft commented Jul 7, 2024

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

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jul 7, 2024
@snicoll
Copy link
Member

snicoll commented Jul 8, 2024

@renetrefft please don't paste things in text like that. It looks like you think a build file is enough to reproduce the issue but it isn't. Also, the fact that it works in your IDE but not on an assembled jar makes it more likely to be a problem in your setup, which we don't have.

Can you edit your description and replace that with an actual sample we can run? You can attach a zip to this issue or push the code to a GitHub repository.

@snicoll snicoll added the status: waiting-for-feedback We need additional information before we can continue label Jul 8, 2024
@jhoeller jhoeller added the in: web Issues in web modules (web, webmvc, webflux, websocket) label Jul 8, 2024
@renetrefft
Copy link
Author

@snicoll I have updated my description and attached a demo project.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Jul 8, 2024
@snicoll
Copy link
Member

snicoll commented Jul 9, 2024

@renetrefft thank you for the sample, I can reproduce the problem as you've described. We're investigating.

@snicoll snicoll changed the title JAXB deserialization broken on Spring WebClient with JdkClientHttpConnector JaxbContextContainer does not define the ClassLoader to use to retrieve the JAXBContext to use Jul 9, 2024
@snicoll snicoll added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged or decided on status: feedback-provided Feedback has been provided labels Jul 9, 2024
@snicoll snicoll added this to the 6.1.x milestone Jul 9, 2024
@snicoll snicoll self-assigned this Jul 12, 2024
@snicoll snicoll modified the milestones: 6.1.x, 6.1.12 Jul 12, 2024
@Grixa37
Copy link

Grixa37 commented Dec 13, 2024

Same problem in AbstractJaxb2HttpMessageConverter

@bclozel
Copy link
Member

bclozel commented Dec 13, 2024

@Grixa37 plezse open a new issue with a minimal sample.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug
Projects
None yet
Development

No branches or pull requests

6 participants