users@jaxb.java.net

BinderImpl.associativeUnmarshal ClassCastException casting to JAXBElement

From: Jason Harrop <jharrop_at_gmail.com>
Date: Wed, 14 Sep 2011 00:07:41 +1000

Hi

I've run into a strange problem using a Binder.

I do:

    Binder<Node> binder = myContext.createBinder();
    binder.unmarshal( doc ); // org.w3c.dom.Document

Usually (ie for most input dom documents using this method) this works fine.

But for one dom doc, I'm getting the stack trace copied below.

If I replace the Binder with an Unmarshaller:

    Unmarshaller u = jc.createUnmarshaller();
    u.unmarshal( doc );

for this troublesome dom doc, unmarshalling is successful.

So something specific to the binder is going wrong.

This is with JAXB in JDK 1.6.0_27.

Any thoughts?

thanks

Jason


java.lang.ClassCastException: org.docx4j.wml.PPr cannot be cast to
javax.xml.bind.JAXBElement
        at com.sun.xml.internal.bind.v2.runtime.ElementBeanInfoImpl$IntercepterLoader.intercept(ElementBeanInfoImpl.java:230)
        at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.endElement(UnmarshallingContext.java:522)
        at com.sun.xml.internal.bind.v2.runtime.unmarshaller.InterningXmlVisitor.endElement(InterningXmlVisitor.java:66)
        at com.sun.xml.internal.bind.v2.runtime.unmarshaller.SAXConnector.endElement(SAXConnector.java:143)
        at com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:239)
        at com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:265)
        at com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:234)
        at com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:265)
        at com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:234)
        at com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:265)
        at com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:234)
        at com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:265)
        at com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:234)
        at com.sun.xml.internal.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:111)
        at com.sun.xml.internal.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:94)
        at com.sun.xml.internal.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:87)
        at com.sun.xml.internal.bind.v2.runtime.BinderImpl.associativeUnmarshal(BinderImpl.java:145)
        at com.sun.xml.internal.bind.v2.runtime.BinderImpl.unmarshal(BinderImpl.java:116)