org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type java.lang.String to type @org.springframework.data.repository.query.Param com.nemesis.platform.core.definition.catalog.CatalogVersionModelDefinition

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • Hello, I have my repositories to work with interfaces, instead of entity classes, like this: {code} @Repository(value = ProductRepository.NAME) @RepositoryRestResource(itemResourceRel = ProductModelDefinition.NAME, path = ProductModelDefinition.NAME, collectionResourceRel = ProductModelDefinition.NAME) public interface ProductRepository extends BaseCatalogableEntityRepository<ProductModelDefinition, Long> { @RestResource(exported = false) Page<ProductModelDefinition> findAllByCatalogVersionAndVariantTypeIsNotNull(@Param("catalogVersion") final CatalogVersionModelDefinition catalogVersion, final Pageable pageable); } {code} and it all works fine until I try to call the method {{findAllByCatalogVersionAndVariantTypeIsNotNull}} over rest. Then I get this exception: {code} 2015-02-02 18:53:09,958 org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/storefront].[restDispatcherServlet] [http-nio-8112-exec-7] ERROR: Servlet.service() for servlet [restDispatcherServlet] in context with path [/storefront] threw exception [Request processing failed; nested exception is org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type java.lang.String to type @org.springframework.data.repository.query.Param com.nemesis.platform.core.definition.catalog.CatalogVersionModelDefinition] with root cause org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type java.lang.String to type @org.springframework.data.repository.query.Param com.nemesis.platform.core.definition.catalog.CatalogVersionModelDefinition at org.springframework.core.convert.support.GenericConversionService.handleConverterNotFound(GenericConversionService.java:311) at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:192) at org.springframework.data.repository.support.ReflectionRepositoryInvoker.prepareParameters(ReflectionRepositoryInvoker.java:214) at org.springframework.data.repository.support.ReflectionRepositoryInvoker.invokeQueryMethod(ReflectionRepositoryInvoker.java:179) at org.springframework.data.rest.webmvc.RepositorySearchController.executeQueryMethod(RepositorySearchController.java:278) at org.springframework.data.rest.webmvc.RepositorySearchController.executeSearch(RepositorySearchController.java:168) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) {code} I tried to register a custom converter (from {{String}} to {{CatalogVersionModelDefinition}}), but I only have access to the string parameter and this means I have to register converters for all the entities. If I map the converter to the base interface ({{CatalogVersionModelDefinition}} extends another interface) it doesn't get invoked. Maybe the best solution would be to call the registered {{RepositoryMetadata::findDomainClass()}} method before searching in the conversion service.
    via by Petar Tahchiev,
  • Hello, I have my repositories to work with interfaces, instead of entity classes, like this: {code} @Repository(value = ProductRepository.NAME) @RepositoryRestResource(itemResourceRel = ProductModelDefinition.NAME, path = ProductModelDefinition.NAME, collectionResourceRel = ProductModelDefinition.NAME) public interface ProductRepository extends BaseCatalogableEntityRepository<ProductModelDefinition, Long> { @RestResource(exported = false) Page<ProductModelDefinition> findAllByCatalogVersionAndVariantTypeIsNotNull(@Param("catalogVersion") final CatalogVersionModelDefinition catalogVersion, final Pageable pageable); } {code} and it all works fine until I try to call the method {{findAllByCatalogVersionAndVariantTypeIsNotNull}} over rest. Then I get this exception: {code} 2015-02-02 18:53:09,958 org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/storefront].[restDispatcherServlet] [http-nio-8112-exec-7] ERROR: Servlet.service() for servlet [restDispatcherServlet] in context with path [/storefront] threw exception [Request processing failed; nested exception is org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type java.lang.String to type @org.springframework.data.repository.query.Param com.nemesis.platform.core.definition.catalog.CatalogVersionModelDefinition] with root cause org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type java.lang.String to type @org.springframework.data.repository.query.Param com.nemesis.platform.core.definition.catalog.CatalogVersionModelDefinition at org.springframework.core.convert.support.GenericConversionService.handleConverterNotFound(GenericConversionService.java:311) at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:192) at org.springframework.data.repository.support.ReflectionRepositoryInvoker.prepareParameters(ReflectionRepositoryInvoker.java:214) at org.springframework.data.repository.support.ReflectionRepositoryInvoker.invokeQueryMethod(ReflectionRepositoryInvoker.java:179) at org.springframework.data.rest.webmvc.RepositorySearchController.executeQueryMethod(RepositorySearchController.java:278) at org.springframework.data.rest.webmvc.RepositorySearchController.executeSearch(RepositorySearchController.java:168) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) {code} I tried to register a custom converter (from {{String}} to {{CatalogVersionModelDefinition}}), but I only have access to the string parameter and this means I have to register converters for all the entities. If I map the converter to the base interface ({{CatalogVersionModelDefinition}} extends another interface) it doesn't get invoked. Maybe the best solution would be to call the registered {{RepositoryMetadata::findDomainClass()}} method before searching in the conversion service.
    via by Petar Tahchiev,
  • Entity report does not work
    via GitHub by Mark-de-Haan
    ,
  • Set MongoDb converter programatically
    via Stack Overflow by Daniel
    ,
    • org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type java.lang.String to type @org.springframework.data.repository.query.Param com.nemesis.platform.core.definition.catalog.CatalogVersionModelDefinition at org.springframework.core.convert.support.GenericConversionService.handleConverterNotFound(GenericConversionService.java:311) at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:192) at org.springframework.data.repository.support.ReflectionRepositoryInvoker.prepareParameters(ReflectionRepositoryInvoker.java:214) at org.springframework.data.repository.support.ReflectionRepositoryInvoker.invokeQueryMethod(ReflectionRepositoryInvoker.java:179) at org.springframework.data.rest.webmvc.RepositorySearchController.executeQueryMethod(RepositorySearchController.java:278) at org.springframework.data.rest.webmvc.RepositorySearchController.executeSearch(RepositorySearchController.java:168) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    Users with the same issue

    derprogger
    derprogger2 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    8 more bugmates