org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.String] to type [@org.springframework.web.bind.annotation.RequestParam @org.springframework.format.annotation.DateTimeFormat java.time.LocalDate] for value '7/11/16'; nested exception is java.time.format.DateTimeParseException: Text '7/11/16' could not be parsed at index 0","path":"/tomorrow"}

Spring JIRA | Fabien MARSAUD | 7 months ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    First things first, I'm not sure it's the right place to log this issue. It may be @Netflix/feign. Please advise. It is no longer possible to use a Feign client accepting a java.time.LocalDate as a method param where it is supposed to comply with a given format like @DateTimeFormat(iso = ISO.DATE). If you do, you get a *java.time.format.DateTimeParseException: Text '7/11/16' could not be parsed at index 0"*, where it's clear the serialization format is NOT the requested ISO-8601 uuuu-MM-dd but M/d/uu. I put the whole stacktrace below. I made a stripped project to reproduce the issue: https://github.com/fabmars/feign-localdate-bug Just import, run ApplicationServer, ApplicationClient, they are supposed to query a local eureka server, and hit http://localhost:8080/bug It's worth noticing that LocalDate's used to be serialized correctly back in spring-cloud-netflix:1.0.7, you may even try it in my example project. So there is a strong suspiscion there is a regression since spring-cloud-netflix:1.1.0 at least (before Brixton, even). {code} 2016-07-11 21:48:32.838 ERROR 9398 --- [nio-8080-exec-7] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is com.netflix.hystrix.exception.HystrixRuntimeException: getTomorrow failed and no fallback available.] with root cause feign.FeignException: status 400 reading TimeClient#getTomorrow(LocalDate,String); content: {"timestamp":1468266512745,"status":400,"error":"Bad Request","exception":"org.springframework.web.method.annotation.MethodArgumentTypeMismatchException","message":"Failed to convert value of type [java.lang.String] to required type [java.time.LocalDate]; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.String] to type [@org.springframework.web.bind.annotation.RequestParam @org.springframework.format.annotation.DateTimeFormat java.time.LocalDate] for value '7/11/16'; nested exception is java.time.format.DateTimeParseException: Text '7/11/16' could not be parsed at index 0","path":"/tomorrow"} at feign.FeignException.errorStatus(FeignException.java:62) ~[feign-core-8.16.2.jar:8.16.2] at feign.codec.ErrorDecoder$Default.decode(ErrorDecoder.java:91) ~[feign-core-8.16.2.jar:8.16.2] at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:134) ~[feign-core-8.16.2.jar:8.16.2] at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:76) ~[feign-core-8.16.2.jar:8.16.2] at feign.hystrix.HystrixInvocationHandler$1.run(HystrixInvocationHandler.java:97) ~[feign-hystrix-8.16.2.jar:8.16.2] at com.netflix.hystrix.HystrixCommand$1.call(HystrixCommand.java:293) ~[hystrix-core-1.5.3.jar:1.5.3] at com.netflix.hystrix.HystrixCommand$1.call(HystrixCommand.java:289) ~[hystrix-core-1.5.3.jar:1.5.3] at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:46) ~[rxjava-1.1.5.jar:1.1.5] at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35) ~[rxjava-1.1.5.jar:1.1.5] at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:50) ~[rxjava-1.1.5.jar:1.1.5] at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.1.5.jar:1.1.5] at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:50) ~[rxjava-1.1.5.jar:1.1.5] at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.1.5.jar:1.1.5] at rx.Observable.unsafeSubscribe(Observable.java:8460) ~[rxjava-1.1.5.jar:1.1.5] at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:51) ~[rxjava-1.1.5.jar:1.1.5] at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35) ~[rxjava-1.1.5.jar:1.1.5] at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:50) ~[rxjava-1.1.5.jar:1.1.5] at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.1.5.jar:1.1.5] at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:50) ~[rxjava-1.1.5.jar:1.1.5] at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.1.5.jar:1.1.5] at rx.Observable.unsafeSubscribe(Observable.java:8460) ~[rxjava-1.1.5.jar:1.1.5] at rx.internal.operators.OperatorSubscribeOn$1.call(OperatorSubscribeOn.java:94) ~[rxjava-1.1.5.jar:1.1.5] at com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:56) ~[hystrix-core-1.5.3.jar:1.5.3] at com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:47) ~[hystrix-core-1.5.3.jar:1.5.3] at com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction.call(HystrixContexSchedulerAction.java:69) ~[hystrix-core-1.5.3.jar:1.5.3] at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55) ~[rxjava-1.1.5.jar:1.1.5] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[na:1.8.0_72] at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_72] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[na:1.8.0_72] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[na:1.8.0_72] at java.lang.Thread.run(Thread.java:745) [na:1.8.0_72] {code}

    Spring JIRA | 7 months ago | Fabien MARSAUD
    org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.String] to type [@org.springframework.web.bind.annotation.RequestParam @org.springframework.format.annotation.DateTimeFormat java.time.LocalDate] for value '7/11/16'; nested exception is java.time.format.DateTimeParseException: Text '7/11/16' could not be parsed at index 0","path":"/tomorrow"}
  2. 0

    Feign client doesn't serialize java.time.LocalDate's correctly

    GitHub | 7 months ago | fabmars
    org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.String] to type [@org.springframework.web.bind.annotation.RequestParam @org.springframework.format.annotation.DateTimeFormat java.time.LocalDate] for value '7/11/16'; nested exception is java.time.format.DateTimeParseException: Text '7/11/16' could not be parsed at index 0","path":"/tomorrow"}

    Root Cause Analysis

    1. org.springframework.core.convert.ConversionFailedException

      Failed to convert from type [java.lang.String] to type [@org.springframework.web.bind.annotation.RequestParam @org.springframework.format.annotation.DateTimeFormat java.time.LocalDate] for value '7/11/16'; nested exception is java.time.format.DateTimeParseException: Text '7/11/16' could not be parsed at index 0","path":"/tomorrow"}

      at feign.FeignException.errorStatus()
    2. feign-core
      SynchronousMethodHandler.invoke
      1. feign.FeignException.errorStatus(FeignException.java:62)[feign-core-8.16.2.jar:8.16.2]
      2. feign.codec.ErrorDecoder$Default.decode(ErrorDecoder.java:91)[feign-core-8.16.2.jar:8.16.2]
      3. feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:134)[feign-core-8.16.2.jar:8.16.2]
      4. feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:76)[feign-core-8.16.2.jar:8.16.2]
      4 frames
    3. feign.hystrix
      HystrixInvocationHandler$1.run
      1. feign.hystrix.HystrixInvocationHandler$1.run(HystrixInvocationHandler.java:97)[feign-hystrix-8.16.2.jar:8.16.2]
      1 frame
    4. hystrix-core
      HystrixCommand$1.call
      1. com.netflix.hystrix.HystrixCommand$1.call(HystrixCommand.java:293)[hystrix-core-1.5.3.jar:1.5.3]
      2. com.netflix.hystrix.HystrixCommand$1.call(HystrixCommand.java:289)[hystrix-core-1.5.3.jar:1.5.3]
      2 frames
    5. rxjava
      OperatorSubscribeOn$1.call
      1. rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:46)[rxjava-1.1.5.jar:1.1.5]
      2. rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)[rxjava-1.1.5.jar:1.1.5]
      3. rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:50)[rxjava-1.1.5.jar:1.1.5]
      4. rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)[rxjava-1.1.5.jar:1.1.5]
      5. rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:50)[rxjava-1.1.5.jar:1.1.5]
      6. rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)[rxjava-1.1.5.jar:1.1.5]
      7. rx.Observable.unsafeSubscribe(Observable.java:8460)[rxjava-1.1.5.jar:1.1.5]
      8. rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:51)[rxjava-1.1.5.jar:1.1.5]
      9. rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)[rxjava-1.1.5.jar:1.1.5]
      10. rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:50)[rxjava-1.1.5.jar:1.1.5]
      11. rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)[rxjava-1.1.5.jar:1.1.5]
      12. rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:50)[rxjava-1.1.5.jar:1.1.5]
      13. rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)[rxjava-1.1.5.jar:1.1.5]
      14. rx.Observable.unsafeSubscribe(Observable.java:8460)[rxjava-1.1.5.jar:1.1.5]
      15. rx.internal.operators.OperatorSubscribeOn$1.call(OperatorSubscribeOn.java:94)[rxjava-1.1.5.jar:1.1.5]
      15 frames
    6. hystrix-core
      HystrixContexSchedulerAction.call
      1. com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:56)[hystrix-core-1.5.3.jar:1.5.3]
      2. com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:47)[hystrix-core-1.5.3.jar:1.5.3]
      3. com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction.call(HystrixContexSchedulerAction.java:69)[hystrix-core-1.5.3.jar:1.5.3]
      3 frames
    7. rxjava
      ScheduledAction.run
      1. rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)[rxjava-1.1.5.jar:1.1.5]
      1 frame
    8. Java RT
      Thread.run
      1. java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[na:1.8.0_72]
      2. java.util.concurrent.FutureTask.run(FutureTask.java:266)[na:1.8.0_72]
      3. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[na:1.8.0_72]
      4. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[na:1.8.0_72]
      5. java.lang.Thread.run(Thread.java:745)[na:1.8.0_72]
      5 frames