org.springframework.beans.ConversionNotSupportedException: Failed to convert value of type 'java.lang.String' to required type '....environment.Environment'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [....environment.Environment]: no matching editors or conversion strategy found

Spring JIRA | Ferenc Gratzer | 5 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    The same converter class and xml config work with Spring 3.0.5 and 3.0.6, but not with 3.0.7. Only changing the Spring version breaks it. {code:java} public class EnvironmentConverter implements Converter<String, Environment> { public Environment convert(String source) {} } {code} servlet.xml: {code:xml} <bean id="conversionService" class="org.springframework.context.support.ConversionServiceFactoryBean"> <property name="converters"> <set> <bean class="....controller.util.StringToEntityConverterFactory" /> <bean class="....web.util.EnvironmentConverter" /> </set> </property> </bean> {code} Log: {code} org.springframework.beans.ConversionNotSupportedException: Failed to convert value of type 'java.lang.String' to required type '....environment.Environment'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [....environment.Environment]: no matching editors or conversion strategy found at org.springframework.beans.SimpleTypeConverter.convertIfNecessary(SimpleTypeConverter.java:58) at org.springframework.validation.DataBinder.convertIfNecessary(DataBinder.java:553) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveRequestParam(HandlerMethodInvoker.java:507) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveHandlerArguments(HandlerMethodInvoker.java:340) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:171) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:436) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:424) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:669) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:585) at javax.servlet.http.HttpServlet.service(HttpServlet.java:710) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) {code}

    Spring JIRA | 5 years ago | Ferenc Gratzer
    org.springframework.beans.ConversionNotSupportedException: Failed to convert value of type 'java.lang.String' to required type '....environment.Environment'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [....environment.Environment]: no matching editors or conversion strategy found
  2. 0

    The same converter class and xml config work with Spring 3.0.5 and 3.0.6, but not with 3.0.7. Only changing the Spring version breaks it. {code:java} public class EnvironmentConverter implements Converter<String, Environment> { public Environment convert(String source) {} } {code} servlet.xml: {code:xml} <bean id="conversionService" class="org.springframework.context.support.ConversionServiceFactoryBean"> <property name="converters"> <set> <bean class="....controller.util.StringToEntityConverterFactory" /> <bean class="....web.util.EnvironmentConverter" /> </set> </property> </bean> {code} Log: {code} org.springframework.beans.ConversionNotSupportedException: Failed to convert value of type 'java.lang.String' to required type '....environment.Environment'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [....environment.Environment]: no matching editors or conversion strategy found at org.springframework.beans.SimpleTypeConverter.convertIfNecessary(SimpleTypeConverter.java:58) at org.springframework.validation.DataBinder.convertIfNecessary(DataBinder.java:553) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveRequestParam(HandlerMethodInvoker.java:507) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveHandlerArguments(HandlerMethodInvoker.java:340) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:171) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:436) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:424) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:669) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:585) at javax.servlet.http.HttpServlet.service(HttpServlet.java:710) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) {code}

    Spring JIRA | 5 years ago | Ferenc Gratzer
    org.springframework.beans.ConversionNotSupportedException: Failed to convert value of type 'java.lang.String' to required type '....environment.Environment'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [....environment.Environment]: no matching editors or conversion strategy found
  3. 0

    Why isn't spring using my Converter<String, Date>?

    Stack Overflow | 6 years ago | Amir Raminfar
    org.springframework.beans.ConversionNotSupportedException: Failed to convert value of type 'java.lang.String' to required type 'java.util.Date'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [java.util.Date]: no matching editors or conversion strategy found
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type

    Stack Overflow | 2 years ago | Ahmed
    org.springframework.beans.ConversionNotSupportedException: Failed to convert value of type 'java.lang.String' to required type 'model.TypeSites'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [model.TypeSites]: no matching editors or conversion strategy found

    Root Cause Analysis

    1. org.springframework.beans.ConversionNotSupportedException

      Failed to convert value of type 'java.lang.String' to required type '....environment.Environment'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [....environment.Environment]: no matching editors or conversion strategy found

      at org.springframework.beans.SimpleTypeConverter.convertIfNecessary()
    2. Spring Beans
      SimpleTypeConverter.convertIfNecessary
      1. org.springframework.beans.SimpleTypeConverter.convertIfNecessary(SimpleTypeConverter.java:58)
      1 frame
    3. Spring Context
      DataBinder.convertIfNecessary
      1. org.springframework.validation.DataBinder.convertIfNecessary(DataBinder.java:553)
      1 frame
    4. Spring
      HandlerMethodInvoker.invokeHandlerMethod
      1. org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveRequestParam(HandlerMethodInvoker.java:507)
      2. org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveHandlerArguments(HandlerMethodInvoker.java:340)
      3. org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:171)
      3 frames
    5. Spring MVC
      FrameworkServlet.doPost
      1. org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:436)
      2. org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:424)
      3. org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
      4. org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
      5. org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:669)
      6. org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:585)
      6 frames
    6. JavaServlet
      HttpServlet.service
      1. javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
      2. javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      2 frames
    7. Glassfish Core
      ApplicationFilterChain.doFilter
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      2 frames