以下著作:
public Date getDate() {
return date;
}
并产生类似的东西:
<date>2010-03-23T17:43:50.879Z</date>
我可以使用XmlGregorianCalendar来回xsd:date或xsd: 时间类型罚款:
@XmlSchemaType(name="date")
public XmlGregorianCalendar getDate() {
return date;
}
产生类似的东西:
<date>2010-03-23</date>
但是,试图返回xsd:时间不变:
@XmlSchemaType(name="datetime")
public XmlGregorianCalendar getDate() {
return date;
}
造成这种 st痕:
java.lang.NullPointerException
at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl.checkXmlGregorianCalendarFieldRef(RuntimeBuiltinLeafInfoImpl.java:864)
at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl.access$200(RuntimeBuiltinLeafInfoImpl.java:111)
at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$13.print(RuntimeBuiltinLeafInfoImpl.java:536)
...snip...
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:619)
这根本不提我的法典。
Im using tomcat 6.0.24, java 1.6.0_16-b01