Dan
Dan

Reputation: 1033

JAXB Unmarshalling works on one server but not the other

I have an application that I run locally and on our demo server. When I run the code locally it can take an XML response and unmarshal it into a Response Object, just as one would expect.

When I run that code on our demo server (EXACT same code) unmarshalling produces a null result.

I've looked and made sure that both servers are configured the same and they're both getting the same response XML.

Any ideas as to why this might be happening?

Upvotes: 2

Views: 1186

Answers (1)

Pranab Thakuria
Pranab Thakuria

Reputation: 77

You might be using org.springframework.oxm.jaxb.Jaxb2Marshaller to unmarshall XML response into a Response Object in your local environment(Windows). But the same code when you are running in server(which could be either unix or linux environment) fails to unmarshall and produces a null result.

So instead of org.springframework.oxm.jaxb.Jaxb2Marshaller use org.springframework.oxm.xstream.XStreamMarshaller to unmarshall which is able to unmarshall in all the different environments.

https://programmingproblemsandsolutions.blogspot.com/2019/03/jaxb-unmarshalling-works-locallywindows.html

Upvotes: 1

Related Questions