org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [org.bson.BsonUndefined] to type [java.math.BigDecimal]

Spring JIRA | Sylvain LAURENT | 6 months ago
  1. 0

    Currently (as of 1.8.2) when reading an "undefined" value from mongo, we have this exception : {quote} org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [org.bson.BsonUndefined] to type [java.math.BigDecimal] at org.springframework.core.convert.support.GenericConversionService.handleConverterNotFound(GenericConversionService.java:313) ~[spring-core-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:195) ~[spring-core-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:176) ~[spring-core-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.data.mongodb.core.convert.MappingMongoConverter.getPotentiallyConvertedSimpleRead(MappingMongoConverter.java:822) ~[spring-data-mongodb-1.8.2.RELEASE.jar:na] {quote} It would be nice to have a way of converting sunch BsonUndefined to null out of the box. For my own usage, I created this converter factory : {code:java} @ReadingConverter public class BsonUndefinedToNullObjectConverterFactory implements ConverterFactory<BsonUndefined, @Nullable Object> { @Override public <T extends @Nullable Object> Converter<BsonUndefined, T> getConverter(Class<T> targetType) { return o -> null; } } {code} It works, with the small glitch of this warning which I think is not correct for this situation : {quote} WARN o.s.d.m.c.convert.CustomConversions - - Registering converter from class org.bson.BsonUndefined to class java.lang.Object as reading converter although it doesn't convert from a Mongo supported type! You might wanna check you annotation setup at the converter implementation. {quote}

    Spring JIRA | 6 months ago | Sylvain LAURENT
    org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [org.bson.BsonUndefined] to type [java.math.BigDecimal]
  2. 0

    Currently (as of 1.8.2) when reading an "undefined" value from mongo, we have this exception : {quote} org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [org.bson.BsonUndefined] to type [java.math.BigDecimal] at org.springframework.core.convert.support.GenericConversionService.handleConverterNotFound(GenericConversionService.java:313) ~[spring-core-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:195) ~[spring-core-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:176) ~[spring-core-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.data.mongodb.core.convert.MappingMongoConverter.getPotentiallyConvertedSimpleRead(MappingMongoConverter.java:822) ~[spring-data-mongodb-1.8.2.RELEASE.jar:na] {quote} It would be nice to have a way of converting sunch BsonUndefined to null out of the box. For my own usage, I created this converter factory : {code:java} @ReadingConverter public class BsonUndefinedToNullObjectConverterFactory implements ConverterFactory<BsonUndefined, @Nullable Object> { @Override public <T extends @Nullable Object> Converter<BsonUndefined, T> getConverter(Class<T> targetType) { return o -> null; } } {code} It works, with the small glitch of this warning which I think is not correct for this situation : {quote} WARN o.s.d.m.c.convert.CustomConversions - - Registering converter from class org.bson.BsonUndefined to class java.lang.Object as reading converter although it doesn't convert from a Mongo supported type! You might wanna check you annotation setup at the converter implementation. {quote}

    Spring JIRA | 6 months ago | Sylvain LAURENT
    org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [org.bson.BsonUndefined] to type [java.math.BigDecimal]
  3. 0

    No converter found capable of converting from type org.bson.BsonUndefined

    Stack Overflow | 7 months ago | Dipali Vasani
    org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type org.bson.BsonUndefined to type java.lang.String
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Configurar Grails con MySql | groovy | Iteramos.com

    iteramos.com | 1 year ago
    org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type java.lang.Class<?> to type java.lang.String
  6. 0

    GitHub comment 9215#143602919

    GitHub | 1 year ago | smartiniOnGitHub
    org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type java.lang.Class<?> to type java.lang.String

  1. shiva768 1 times, last 12 months ago
9 unregistered visitors
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.core.convert.ConverterNotFoundException

    No converter found capable of converting from type [org.bson.BsonUndefined] to type [java.math.BigDecimal]

    at org.springframework.core.convert.support.GenericConversionService.handleConverterNotFound()
  2. Spring Core
    GenericConversionService.convert
    1. org.springframework.core.convert.support.GenericConversionService.handleConverterNotFound(GenericConversionService.java:313)[spring-core-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    2. org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:195)[spring-core-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    3. org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:176)[spring-core-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    3 frames
  3. Spring Data MongoDB - Core
    MappingMongoConverter.getPotentiallyConvertedSimpleRead
    1. org.springframework.data.mongodb.core.convert.MappingMongoConverter.getPotentiallyConvertedSimpleRead(MappingMongoConverter.java:822)[spring-data-mongodb-1.8.2.RELEASE.jar:na]
    1 frame