将现有的jaxb(使用jaxb1.0.1和jaxb 2.0.5)应用程序(在带有jdk5的JBoss 4.3上)迁移到jaxb 2.1.10(随jdk6提供,更新jdk1.6.0_30).
我无法修改客户提供的架构.
我已经从Sun RI删除了jaxws20,jwsdp,jaxp和jaxb jar的所有引用,并且仅使用jdk 6提供的jar.
任何指针?
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)
Run Code Online (Sandbox Code Playgroud) 我正在从1.x版升级项目到jaxb 2.2.7.
我的应用程序有时会工作,但在一些回复中我看到了这个:
java.lang.RuntimeException: javax.xml.bind.MarshalException
- with linked exception:
[com.sun.istack.SAXException2: Instance of "com.mycompany.global.er.decoupling.binding.response.PricePointType$BalanceImpactRates$BalanceImpactRate"
is substituting "java.lang.Object", but
"com.mycompany.global.er.decoupling.binding.response.PricePointType$BalanceImpactRates$BalanceImpactRate"
is bound to an anonymous type.]
Run Code Online (Sandbox Code Playgroud)
这在jaxb 1.0中运行良好.我不知道问题是什么.
这是xsd的摘录(我无法更改,因为客户端正在使用它):
<xs:complexType name="price-pointType">
<xs:sequence>
<xs:element name="id" type="xs:string" />
.........
<xs:element name="duration" type="durationType" />
<xs:element name="order" type="xs:int" />
<xs:element name="min-sub-period" type="xs:int" />
<xs:element name="balance-impacts" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="balance-impact" type="charging-resourceType"
minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="balance-impact-rates" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="balance-impact-rate" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="rate" type="xs:double" />
</xs:sequence>
<xs:attribute name="charging-resource-code" type="xs:string" …Run Code Online (Sandbox Code Playgroud)