Announcement Announcement Module
No announcement yet.
Incorrect time conversion in message marshalling Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Incorrect time conversion in message marshalling

    I created an application that watches for occurring change events and publishing messages on the JMS topic for other applications to see.
    It is working as intended without a problem except one thing. When marshaling message to XML format, time is converted incorrectly.

    I have the following bean definition:
        <bean id="eventSender" class="org.springframework.jms.core.JmsTemplate">
            <property name="connectionFactory" ref="pooledAmqJmsConnectionFactory" />
            <property name="pubSubDomain" value="true"/>
            <property name="defaultDestination" ref="eventDestination"/>
            <property name="messageConverter" ref="oxmMessageConverter"/>
      <bean id="oxmMessageConverter" class="">
        <property name="marshaller" ref="coreJaxbMarshaller" />
        <property name="unmarshaller" ref="coreJaxbMarshaller" />
        <property name="targetType" ref="textMessageType" />
      <bean id="textMessageType" class="" factory-method="valueOf"
        <constructor-arg value="TEXT" />
    Bounded class was generated from the XSD file and has property
        @XmlElement(required = true)
        @XmlSchemaType(name = "date")
        protected XMLGregorianCalendar occured;
    I made a breakpoint in the debugger on this line:
    and checked the value of property occured. It was "Dec-2-2013 14:47:02.236"
    When I click on continue, message was sent to ActiveMQ and recipient got it successfully.
    However, it was dated in XML "Dec-2-2013 08:00:00".
    I tried it multiple times and looks like marshaller always cut it to the round hours and 5 to 8 hours off correct time.
    I don't need millisecond precision but I do need to provide correct time of the event at least up to a minute.
    If someone knows how to make it work, I'd appreciate a tip

  • #2
    Sorry for not getting to this sooner. We are in the process of moving to StackOverflow for our forums.

    This question is probably a better candidate for StackOverflow, perhaps against the #spring-xml tag.
    If you do post it there, please reply here with the link.