I need to populate a JAX Bean from XML, however there is no setter method. I get the following message below
Failed to invoke public javax.xml.datatype.XMLGregorianCalendar() with no args
I wrote the following methods to take a date and convert it to XMLGregorianCalendar, and then call setter in my wrapper class. However, I still get the exception. Is there a standard way of processing this data type that I am viewing? My wrapper class may not call it, but Netbeans for some reason will not allow me to attach a debugger to it.
public XMLGregorianCalendar asXMLGregorianCalendar(java.util.Date date) throws DatatypeConfigurationException { DatatypeFactory datatypeFactory = DatatypeFactory.newInstance(); if (date == null) { return null; } else { GregorianCalendar gc = new GregorianCalendar(); gc.setTimeInMillis(date.getTime()); return datatypeFactory.newXMLGregorianCalendar(gc); } }
The installer in Bean is below
public void setDeliveryDate(XMLGregorianCalendar value) { this.deliveryDate = value; }
java binding jaxb
Edgecase
source share