org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type java.time.OffsetDateTime to type java.util.Calendar

Spring JIRA | Petar Tahchiev | 1 year ago
  1. 0

    Hello, now that hibernate5 is out, I migrated all my JPA entities to use {{OffsetDateTime}} and of course the {{lastModifiedDate}} is now also {{OffsetDateTime}}. However, my tests started failing now with this exception: {code} org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type java.time.OffsetDateTime to type java.util.Calendar at org.springframework.core.convert.support.GenericConversionService.handleConverterNotFound(GenericConversionService.java:313) at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:195) at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:176) at org.springframework.data.auditing.DefaultAuditableBeanWrapperFactory$DateConvertingAuditableBeanWrapper.getAsCalendar(DefaultAuditableBeanWrapperFactory.java:208) at org.springframework.data.auditing.MappingAuditableBeanWrapperFactory$MappingMetadataAuditableBeanWrapper.getLastModifiedDate(MappingAuditableBeanWrapperFactory.java:210) at org.springframework.data.rest.webmvc.AbstractRepositoryRestController.prepareHeaders(AbstractRepositoryRestController.java:180) at org.springframework.data.rest.webmvc.RepositoryEntityController.getItemResource(RepositoryEntityController.java:324) {code} And I saw that in {{AbstractRepositoryRestController:180}} there's a cast to {{java.util.Calendar}} {code} Calendar lastModifiedDate = wrapper.getLastModifiedDate(); {code} And I also noticed the class {{DateTimeConverters}} in {{spring-context}} which is missing an {{OffsetDateTimeToCalendarConverter}} - maybe one should be added?!

    Spring JIRA | 1 year ago | Petar Tahchiev
    org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type java.time.OffsetDateTime to type java.util.Calendar
  2. 0

    Hello, now that hibernate5 is out, I migrated all my JPA entities to use {{OffsetDateTime}} and of course the {{lastModifiedDate}} is now also {{OffsetDateTime}}. However, my tests started failing now with this exception: {code} org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type java.time.OffsetDateTime to type java.util.Calendar at org.springframework.core.convert.support.GenericConversionService.handleConverterNotFound(GenericConversionService.java:313) at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:195) at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:176) at org.springframework.data.auditing.DefaultAuditableBeanWrapperFactory$DateConvertingAuditableBeanWrapper.getAsCalendar(DefaultAuditableBeanWrapperFactory.java:208) at org.springframework.data.auditing.MappingAuditableBeanWrapperFactory$MappingMetadataAuditableBeanWrapper.getLastModifiedDate(MappingAuditableBeanWrapperFactory.java:210) at org.springframework.data.rest.webmvc.AbstractRepositoryRestController.prepareHeaders(AbstractRepositoryRestController.java:180) at org.springframework.data.rest.webmvc.RepositoryEntityController.getItemResource(RepositoryEntityController.java:324) {code} And I saw that in {{AbstractRepositoryRestController:180}} there's a cast to {{java.util.Calendar}} {code} Calendar lastModifiedDate = wrapper.getLastModifiedDate(); {code} And I also noticed the class {{DateTimeConverters}} in {{spring-context}} which is missing an {{OffsetDateTimeToCalendarConverter}} - maybe one should be added?!

    Spring JIRA | 1 year ago | Petar Tahchiev
    org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type java.time.OffsetDateTime to type java.util.Calendar
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    testing,spring-security,jhipster , Jhipster - JpaRepository “principal.username” @Query - org.springframework.expression.spel.SpelEvaluationException

    databasefaq.com | 1 year ago
    org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 10): Property or field 'username' cannot be found on object of type 'java.lang.String' - maybe not public?

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.springframework.web.util.NestedServletException

      Request processing failed; nested exception is org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type java.time.OffsetDateTime to type java.util.Calendar

      at org.springframework.core.convert.support.GenericConversionService.handleConverterNotFound()
    2. Spring Core
      GenericConversionService.convert
      1. org.springframework.core.convert.support.GenericConversionService.handleConverterNotFound(GenericConversionService.java:313)
      2. org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:195)
      3. org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:176)
      3 frames
    3. Spring Data Core
      MappingAuditableBeanWrapperFactory$MappingMetadataAuditableBeanWrapper.getLastModifiedDate
      1. org.springframework.data.auditing.DefaultAuditableBeanWrapperFactory$DateConvertingAuditableBeanWrapper.getAsCalendar(DefaultAuditableBeanWrapperFactory.java:208)
      2. org.springframework.data.auditing.MappingAuditableBeanWrapperFactory$MappingMetadataAuditableBeanWrapper.getLastModifiedDate(MappingAuditableBeanWrapperFactory.java:210)
      2 frames
    4. Spring Data REST - WebMVC
      RepositoryEntityController.getItemResource
      1. org.springframework.data.rest.webmvc.AbstractRepositoryRestController.prepareHeaders(AbstractRepositoryRestController.java:180)
      2. org.springframework.data.rest.webmvc.RepositoryEntityController.getItemResource(RepositoryEntityController.java:324)
      2 frames