0

I've a small java web app in which I send messages on a service bus queue when a user click on a button. I want to display the messages on my jsp page. But when I make the call

resultQM = service.receiveQueueMessage(queueName, opts);

I get the following exception. Thanks in advance for your help.

 java.lang.IllegalArgumentException: org.codehaus.jackson.map.JsonMappingException: Can not construct instance of java.util.Date from String value 'Sun, 03 Jun 2012 13:54:40 GMT': not a valid representation (error: Can not parse date "Sun, 03 Jun 2012 13:54:40 GMT": not compatible with any of standard forms ("yyyy-MM-dd'T'HH:mm:ss.SSSZ", "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", "EEE, dd MMM yyyy HH:mm:ss zzz", "yyyy-MM-dd"))
 at [Source: [B@8719e; line: 1, column: 70] (through reference chain: com.microsoft.windowsazure.services.serviceBus.implementation.BrokerProperties["LockedUntilUtc"])
    com.microsoft.windowsazure.services.serviceBus.implementation.BrokerPropertiesMapper.fromString(BrokerPropertiesMapper.java:41)
    com.microsoft.windowsazure.services.serviceBus.implementation.ServiceBusRestProxy.receiveMessage(ServiceBusRestProxy.java:187)
    com.microsoft.windowsazure.services.serviceBus.implementation.ServiceBusRestProxy.receiveQueueMessage(ServiceBusRestProxy.java:151)
    com.microsoft.windowsazure.services.serviceBus.implementation.ServiceBusExceptionProcessor.receiveQueueMessage(ServiceBusExceptionProcessor.java:108)
    messaging.QueueListener.getMessage(QueueListener.java:22)
    org.apache.jsp.index_jsp._jspService(index_jsp.java:116)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
Scott Stanchfield
  • 29,742
  • 9
  • 47
  • 65
orleant
  • 33
  • 3

4 Answers4

0

I think the exception is clear enough? There is a message that holds a string containing a date, and the library can't parse the string to a valid date.

"Sun, 03 Jun 2012 13:54:40 GMT": not compatible with any of standard forms ("yyyy-MM-dd'T'HH:mm:ss.SSSZ", "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", "EEE, dd MMM yyyy HH:mm:ss zzz", "yyyy-MM-dd")
Leon Cullens
  • 12,276
  • 10
  • 51
  • 85
  • Yes but I don't know how to fix this since I'm not the one who manipulate the string... It come from the underlying library, and I don't know the how my code is implicated... – orleant Jun 03 '12 at 18:23
  • I've try to deploy the app directly on the cloud and it work fine... I'm still wonder why it doesn't work on the emulator. – orleant Jun 03 '12 at 19:19
  • That was because the machine in the cloud are probably in US locale. – Albert Cheng Mar 21 '13 at 18:09
0

I suggest you to check if your local machine's clock is correct. Also try to create a SimpleDateFormat, as described on Jersey + Jackson deserialization failure with date object (a similar exception).

Community
  • 1
  • 1
Ming Xu - MSFT
  • 2,116
  • 1
  • 11
  • 13
0

Set the default system locale to US before calling receiveQueueMessage:

Locale.setDefault(Locale.US);

Cause:

The Windows Azure SDK for Java uses Jackson, which uses the default system locale when creating SimpleDateFormat objects for parsing dates. Windows Azure Service Bus returns dates formatted to string using RFC-1123 and ENGLISH locale. RFC-1123 date format contains day of the week and the parser fails when your default locale is not ENGLISH and has different day of week names.

Source: Alexander Racheev's answer in the MSDN Forum.

Fernando Correia
  • 21,803
  • 13
  • 83
  • 116
0

In the latest version of Windows Azure SDK for Java, Version 0.4.2. This should have been fixed, let us know if anyone can still repro this.

Albert Cheng
  • 657
  • 6
  • 17