spring-ws を使用して実装された SOAP Web サービスで使用される xsd があります。タイプの 1 つは次のように定義されます。
<xsd:complexType name="DateTimeWithTimeZone">
<xsd:annotation>
<xsd:documentation>An extension to the standard dateTime, that forces the use of a proper time zone.</xsd:documentation>
</xsd:annotation>
<xsd:attribute name="DateTime" type="xsd:dateTime" use="required">
<xsd:annotation>
<xsd:documentation>The date time value</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="TimeZone" type="xsd:string" use="optional" default="UTC">
<xsd:annotation>
<xsd:documentation>The time zone of the relevant date/time, should be a standard time zone from the Time Zone database at http://www.iana.org/time-zones</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
私の問題は、JBoss のロード時に次の例外が発生することです。
ERROR [org.springframework.web.context.ContextLoader] Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'marshaller' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.oxm.UncategorizedMappingException: Unknown JAXB exception; nested exception is com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
@XmlAttribute/@XmlValue need to reference a Java type that maps to text in XML.
this problem is related to the following location:
at protected javax.xml.datatype.XMLGregorianCalendar com.example.schema.DateTimeWithTimeZone.dateTime
at com.example.schema.DateTimeWithTimeZone
...
生成された Java ファイルは次のとおりです。
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "DateTimeWithTimeZone")
public class DateTimeWithTimeZone {
@XmlAttribute(name = "DateTime", required = true)
@XmlSchemaType(name = "dateTime")
protected XMLGregorianCalendar dateTime;
@XmlAttribute(name = "TimeZone")
protected String timeZone;
public XMLGregorianCalendar getDateTime() {
return dateTime;
}
public void setDateTime(XMLGregorianCalendar value) {
this.dateTime = value;
}
public String getTimeZone() {
if (timeZone == null) {
return "UTC";
} else {
return timeZone;
}
}
public void setTimeZone(String value) {
this.timeZone = value;
}
}
この例外を取り除くにはどうすればよいですか?