Java Question

Wildfly 10 UnmarshalException in empty date tags in the response

We are migrating our application from Jboss 6 to Wildfly 10, most the web services are running ok, but we are facing a problem with empty date tags in the response from an external web service: 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(
at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$12.parse(
... 158 more

The line and column are the start of the following element

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

As you can see date is empty and causes the parser to fail (I assume that based on the evidence)

This is a fragment of the WSDL definition for that XML element:

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

We have generated our client classes with Apache CXF 3.1.6 as: wsdl2java -frontend jaxws21 ....

  • When using SEIStub implementation the call works for the webservice.

  • When using the same code inside of Wildfly it does not work throwing the described exception.

  • Is this all info needed?

Is there any way another JAXB implementation that can be configured in Wildfly 10?, how?


Answer Source

We created an extension of the XmlAdapter and we declared the class in the (from the response folder -> "sysrpc", an old cxf) as following:

package XXX; 

import javax.xml.bind.annotation.adapters.XmlAdapter;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;

import java.util.Date;

public class XMLGregorianCalendarXmlAdapter extends XmlAdapter<String, XMLGregorianCalendar>{

public XMLGregorianCalendar unmarshal(String v) throws Exception {
    if(v==null ||  v.trim().isEmpty()) {
        return null;
    return DatatypeFactory.newInstance().newXMLGregorianCalendar(v);

public String marshal(XMLGregorianCalendar v) throws Exception {
    return v==null ? null : /*do something with the XMLGregorianCalendar */;


Then in the

@javax.xml.bind.annotation.XmlSchema(namespace = "urn:external-web-service:SYSRPC")
package YYYY.sysrpc;