Migrating existing jaxb (uses both jaxb1.0.1 and jaxb 2.0.5) application (on JBoss 4.3 with jdk5) to jaxb 2.1.10 (supplied with jdk6, update jdk1.6.0_30).
I cannot modify the customer-provided schema.
I have removed all references of jaxws20, jwsdp, jaxp and jaxb jars from Sun RI and am using jars provided by jdk 6 only.
Any pointers ??
Caused by: com.sun.istack.SAXException2: Instance of “com.foo.Bar” is substituting “java.lang.Object”, but “com.foo.Bar” is bound to an anonymous type com.foo.Bar@a2e3ss
at com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:247)
at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:662)
at com.sun.xml.bind.v2.runtime.property.ArrayElementProperty.serializeListBody(ArrayElementProperty.java:165)
at com.sun.xml.bind.v2.runtime.property.ArrayERProperty.serializeBody(ArrayERProperty.java:152)
at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:332)
at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:698)
at com.sun.xml.bind.v2.runtime.property.SingleElementNodeProperty.serializeBody(SingleElementNodeProperty.java:152)
at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:332)
at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsSoleContent(XMLSerializer.java:592)
at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeRoot(ClassBeanInfoImpl.java:320)
at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:493)
at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:325)
This can be caused by adding Foo
objects to a List<Bar>
type SOAP parameter.
I had this exact same exception a couple of weeks ago. I would have expected a compilation error, so there must have been some ugly type coercion under the hood to allow it to happen. I didn't investigate any further - replacing Foo
's with Bar
's (which they should have been anyway) fixed the problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With