2

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?

Dan
  • 979
  • 1
  • 8
  • 29
  • It is possible you are getting a different jaxb provider in your 2 different environments. Search for "how to specify a particular jaxb implementation" – StvnBrkdll Sep 27 '16 at 00:30
  • It is possible. I did check the context however and do see that it "knows about" the classes it's unmarshalling. – Dan Sep 27 '16 at 00:58
  • Have you found your solution? Today (2016-12-24) I had a similar problem and I posted about it here: http://stackoverflow.com/questions/41308531/jaxb-unmarshalling-failed-on-one-machine-but-not-others-also-worked-in-unit-te If you have some insight please share with us. Thanks! Happy Holidays! – leeyuiwah Dec 24 '16 at 14:56
  • 1
    @leeyuiwah, looks like you found your answer. I had the exact same issue of multiple versions of the same class being loaded by my classloader. – Dan Jan 17 '17 at 07:34
  • I am facing the same issue, how did you solve it? – user1997656 Dec 05 '19 at 20:38

1 Answers1

1

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