gpt4 book ai didi

java - Wildfly 10 UnmarshalException 响应中的空日期标签

转载 作者:行者123 更新时间:2023-12-02 03:42:48 26 4
gpt4 key购买 nike

我们正在将应用程序从 Jboss 6 迁移到 Wildfly 10,大多数 Web 服务都运行正常,但我们面临来自外部 Web 服务的响应中日期标签为空的问题:

java.security.PrivilegedActionException: javax.xml.bind.UnmarshalException
- with linked exception:
[com.sun.istack.SAXParseException2; lineNumber: 1; columnNumber: 784; ]


Caused by: java.lang.IllegalArgumentException:
at org.apache.xerces.jaxp.datatype.XMLGregorianCalendarImpl$Parser.parseBigInteger(Unknown Source)
at org.apache.xerces.jaxp.datatype.XMLGregorianCalendarImpl$Parser.parse(Unknown Source)
at org.apache.xerces.jaxp.datatype.XMLGregorianCalendarImpl.<init>(Unknown Source)
at org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl.newXMLGregorianCalendar(Unknown Source)
at __redirected.__DatatypeFactory.newXMLGregorianCalendar(__DatatypeFactory.java:180)
at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$12.parse(RuntimeBuiltinLeafInfoImpl.java:592)
... 158 more

行和列是以下元素的开始

...<ADATE><date />...

如您所见,日期为空并导致解析器失败(我认为是基于证据)

这是该 XML 元素的 WSDL 定义的片段:

   <xsd:element name="ADATE">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="date" minOccurs="1" maxOccurs="100" type="xsd:date"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>

我们使用 Apache CXF 3.1.6 生成了客户端类:wsdl2java -frontend jaxws21 ....

  • 使用 SEIStub 实现时,调用适用于 Web 服务。
  • 在 Wildfly 中使用相同的代码时,无法抛出所描述的异常。
  • 这就是所需的全部信息吗?

是否可以在 Wildfly 10 中配置另一种 JAXB 实现?如何配置?

谢谢

最佳答案

XML 中有错误:标记日期为空,但架构表明它必须具有某些值。尝试在其中写入正确的日期。

如果你想让它为空,你可以这样写

 xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

在 XML 中和

 nillable="true" 

在 XSD 中。

关于java - Wildfly 10 UnmarshalException 响应中的空日期标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36653143/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com