tags:

views:

361

answers:

1

Hi,

I'm running into a problem that I think is related to updating JAXB to the latest version. I'm running a marshal command that returns:

??? Java exception occurred: javax.xml.bind.MarshalException - with linked exception: [java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to java.lang.String] at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.write(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.marshal(Unknown Source) at javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(Unknown Source) Caused by: java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to java.lang.String at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.reportError(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.reportError(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.reflect.AdaptedLister$ListIteratorImpl.next(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.property.ArrayElementProperty.serializeListBody(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.property.ArrayERProperty.serializeBody(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.childAsXsiType(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.property.SingleElementNodeProperty.serializeBody(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.childAsSoleContent(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.ClassBeanInfoImpl.serializeRoot(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.childAsRoot(Unknown Source) ... 3 more Caused by: java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to java.lang.String at javax.xml.bind.annotation.adapters.NormalizedStringAdapter.marshal(Unknown Source) ... 13 more

This code used to work with Jaxb1, but now returns this. Any ideas?

A: 

It used to work with the same input? The error is telling you that the marshaller is for some reason trying to cast a string array to a single string ("[L" = array).

Jason S