org.springframework.web.method.annotation.MethodArgumentTypeMismatchException

Failed to convert value of type [java.lang.String] to required type [java.util.Optional]

Samebug tips0

We couldn't find tips for this exception.

Don't give up yet. Paste your full stack trace to get a solution.

Solutions on the web53

  • via Unknown by James Howe,
  • via Unknown by James Howe,
  • via Unknown by Webbug Group,
  • Stack trace

    • org.springframework.web.method.annotation.MethodArgumentTypeMismatchException: Failed to convert value of type [java.lang.String] to required type [java.util.Optional] at org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.resolveArgument(AbstractNamedValueMethodArgumentResolver.java:115) at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:99) at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:161) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:128) Caused by: org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.String] to type [@org.springframework.web.bind.annotation.RequestHeader java.time.Instant] for value 'Thu, 21 Apr 2016 17:11:08 +0100' at org.springframework.core.convert.support.ConversionUtils.invokeConverter(ConversionUtils.java:41) at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:192) at org.springframework.core.convert.support.ObjectToOptionalConverter.convert(ObjectToOptionalConverter.java:75) at org.springframework.core.convert.support.ConversionUtils.invokeConverter(ConversionUtils.java:35) at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:192) at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:173) at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:108) at org.springframework.beans.TypeConverterSupport.doConvert(TypeConverterSupport.java:64) at org.springframework.beans.TypeConverterSupport.convertIfNecessary(TypeConverterSupport.java:47) at org.springframework.validation.DataBinder.convertIfNecessary(DataBinder.java:688) at org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.resolveArgument(AbstractNamedValueMethodArgumentResolver.java:107) ... 4 more Caused by: java.time.format.DateTimeParseException: Text 'Thu, 21 Apr 2016 17:11:08 +0100' could not be parsed at index 0 at java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:1949) at java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1851) at java.time.Instant.parse(Instant.java:395) at org.springframework.format.datetime.standard.InstantFormatter.parse(InstantFormatter.java:40) at org.springframework.format.datetime.standard.InstantFormatter.parse(InstantFormatter.java:35) at org.springframework.format.support.FormattingConversionService$ParserConverter.convert(FormattingConversionService.java:194) at org.springframework.core.convert.support.ConversionUtils.invokeConverter(ConversionUtils.java:35) ... 15 more

    Write tip

    You have a different solution? A short tip here would help you and many other users who saw this issue last week.

    Users with the same issue

    Михайло ТітовМихайло Тітов
    AxeloAxelo
    13 times, last one
    tvrmsmithtvrmsmith
    Once,
    rprp
    Once,
    aidoanaidoan
    3 times, last one
    11 more bugmates