我遇到了一个问题,我认为这与将JAXB更新到最新版本有关。我正在运行一个返回的marshal命令:
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
此代码用于处理Jaxb1,但现在返回此代码。有什么想法吗?
答案 0 :(得分:0)
它曾经使用相同的输入?该错误告诉您marshaller由于某种原因试图将字符串数组转换为单个字符串(“[L”=数组)。