-
1. Re: jaxb version used by JBoss AS 7.0Final (date issue/timezone issue)
peterfry Aug 22, 2012 6:48 AM (in response to peterfry)I have a few test cases that all seem to be pointing at the jboss-jaxb-api_2.2_spec-1.0.3.Final.jar file .
If I run
public static void main( String[] args )
{
GregorianCalendar testCal = new GregorianCalendar();
testCal.clear();
testCal.set( 1970, 0, 1 );
Date testDate = testCal.getTime();
System.out.println( "test printing dateTime " + DatatypeConverter.printDateTime( testCal ) );
}
Without any jvm arguments it prints:test printing dateTime 1970-01-01T00:00:00Z
If I pass a JVM argument of -Djava.endorsed.dirs=c:\a_directory_only_containing_jaxb-api.jar , where manifest has the information:
Specification-Title: Java Architecture for XML Binding
Specification-Version: 2.2.1
Specification-Vendor: Sun Microsystems, Inc.
Extension-Name: javax.xml.bindit prints:
test printing dateTime 1970-01-01T00:00:00+01:00
If I pass a jvm argument of -Djava.endorsed.dirs=c:\a_directory_only_containing_jboss-jaxb-api_2.2_spec-1.0.3.Final.jarIt prints:
test printing dateTime 1970-01-01T00:00:00Z
So I think the jboss 7.1 version of jaxb is wrong?
I tried just replacing it to see the version of JAXB from SUN ( 2.2.1) solves the web service problem but I get errors when trying to make web service calls (I can attach those if anybody has ideas )
-
2. Re: jaxb version used by JBoss AS 7.0Final (date issue/timezone issue)
peterfry Aug 22, 2012 6:46 AM (in response to peterfry)Just tried with jaxb-ri-2.2.6 (putting the api, impl and the xjc jar in the endorsed directory) and get
test printing dateTime 1970-01-01T00:00:00+01:00
-
3. Re: jaxb version used by JBoss AS 7.0Final (date issue/timezone issue)
peterfry Aug 22, 2012 8:57 AM (in response to peterfry)This only seems to be a problem when using a DateConverter i.e.
<bindings version="2.1"
xmlns="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xsi:schemaLocation="http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd"
<globalBindings>
<javaType name="java.util.Date" xmlType="xs:date"
parseMethod="uk.co.abusiness.webservices.DateConverter.parseDate"
printMethod="uk.co.abusiness.webservices.DateConverter.printDate"/>
<javaType name="java.util.Date" xmlType="xs:time"
parseMethod="uk.co.abusiness.webservices.DateConverter.parseTime"
printMethod="uk.co.abusiness.webservices.DateConverter.printTime"/>
<javaType name="java.util.Date" xmlType="xs:dateTime"
parseMethod="uk.co.abusiness.webservices.DateConverter.parseDateTime"
printMethod="uk.co.abusiness.webservices.DateConverter.printDateTime"/>
<serializable uid="1" />
</globalBindings>
</bindings>And specifically the printDate, printDateTime, printTime methods. Previously we had followed the various suggestions on the internet and implemented:
Calendar cal = new GregorianCalendar();
cal.setTime( dt );
return DatatypeConverter.printDateTime( cal );It seemed the calls to DatatypeConverter introduced the problem.
Our resolution was to use the JAXB 2.2.1 implementations of the printDate, printDateTime and printTime methods directly/inline (the reference implementation includes the source).