Announcement Announcement Module
Collapse
No announcement yet.
Incorrect time conversion in message marshalling Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • 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:
    Code:
        <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>
      <bean id="oxmMessageConverter" class="org.springframework.jms.support.converter.MarshallingMessageConverter">
        <property name="marshaller" ref="coreJaxbMarshaller" />
        <property name="unmarshaller" ref="coreJaxbMarshaller" />
        <property name="targetType" ref="textMessageType" />
      </bean>
      <bean id="textMessageType" class="org.springframework.jms.support.converter.MessageType" factory-method="valueOf"
        lazy-init="false">
        <constructor-arg value="TEXT" />
      </bean>
    Bounded class was generated from the XSD file and has property
    Code:
        @XmlElement(required = true)
        @XmlSchemaType(name = "date")
        protected XMLGregorianCalendar occured;
    I made a breakpoint in the debugger on this line:
    Code:
                eventSender.convertAndSend(e);
    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.

    Thanks!

    Comment

    Working...
    X