I have a number of XmlAdapter implementations. These work just fine. However, they contains a lot of shared code, so I tried to refactor most of it into an abstract super class. This compiles just fine, but WebLogic will then ignore the XmlAdapters for unmarshalling incoming request. I've put a breakpoint in the unmarshal method of the base class but that was never called.
The old (working) version:
The non-working version with base class:
With this code unmarshalling now fails. MyClass and BaseClass do not have a non-arg constructor so I get an exception about that constructor missing. If I add it, I get an exception that MyClass cannot be cast to String.
Am I doing something wrong, or is WebLogic (MOXy) unable to handle this simple case? If I use JAXB.unmarshal in a standalone program it works, so it's probably MOXy that's causing the problems.
Disclaimer: our client has specified that we should WebLogic. We can't switch to something we know better (and has fewer issues).
We are using 220.127.116.11, so we will consider that. Since we're going to use JSON only we are also considering Jackson; we've already found out we can use that by creating a sub class of JacksonJsonProvider and marking it with @Provider.
However, I think I have found the cause. For MOXy to pickup the bound type or value type, that must be a generic value of the concrete class. By moving the String part to the concrete class it works:
This is a bit of a hack, and Eclipse (correctly) complains that I shouldn't use final class String as a bound.