Details
-
Improvement
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
2.19.0
-
None
-
Novice
Description
When trying to convert JavaObjects with BigDecimal fields, an exception is thrown (see below).
Apparently, the reason for that is that the MongoDB driver doesn't convert BigDecimals natively, which is why you need to specify an own converter class.
However, Camel <=2.18.3 didn't throw this error, so I assume that Camel brought its own Big Decimal converter class in previous versions that is now broken.
Downgrading to 2.18.3 fixed the error for me.
The issue showed up with the old camel-mongodb and the new camel-mongodb3 component.
Stacktrace --------------------------------------------------------------------------------------------------------------------------------------- org.apache.camel.component.mongodb3.CamelMongoDbException: org.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for class java.math.BigDecimal. at org.apache.camel.component.mongodb3.MongoDbComponent.wrapInCamelMongoDbException(MongoDbComponent.java:64) at org.apache.camel.component.mongodb3.MongoDbProducer.process(MongoDbProducer.java:117) at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61) at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:145) at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77) at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:541) at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:198) at org.apache.camel.processor.Pipeline.process(Pipeline.java:120) at org.apache.camel.processor.Pipeline.process(Pipeline.java:83) at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:198) at org.apache.camel.component.seda.SedaConsumer.sendToConsumers(SedaConsumer.java:298) at org.apache.camel.component.seda.SedaConsumer.doRun(SedaConsumer.java:207) at org.apache.camel.component.seda.SedaConsumer.run(SedaConsumer.java:154) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: org.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for class java.math.BigDecimal. at org.bson.codecs.configuration.CodecCache.getOrThrow(CodecCache.java:46) at org.bson.codecs.configuration.ProvidersCodecRegistry.get(ProvidersCodecRegistry.java:63) at org.bson.codecs.configuration.ChildCodecRegistry.get(ChildCodecRegistry.java:51) at org.bson.codecs.DocumentCodec.writeValue(DocumentCodec.java:174) at org.bson.codecs.DocumentCodec.writeMap(DocumentCodec.java:189) at org.bson.codecs.DocumentCodec.writeValue(DocumentCodec.java:172) at org.bson.codecs.DocumentCodec.writeMap(DocumentCodec.java:189) at org.bson.codecs.DocumentCodec.writeValue(DocumentCodec.java:172) at org.bson.codecs.DocumentCodec.writeIterable(DocumentCodec.java:197) at org.bson.codecs.DocumentCodec.writeValue(DocumentCodec.java:170) at org.bson.codecs.DocumentCodec.writeMap(DocumentCodec.java:189) at org.bson.codecs.DocumentCodec.encode(DocumentCodec.java:131) at org.bson.codecs.DocumentCodec.encode(DocumentCodec.java:45) at org.bson.codecs.BsonDocumentWrapperCodec.encode(BsonDocumentWrapperCodec.java:63) at org.bson.codecs.BsonDocumentWrapperCodec.encode(BsonDocumentWrapperCodec.java:29) at com.mongodb.connection.InsertCommandMessage.writeTheWrites(InsertCommandMessage.java:101) at com.mongodb.connection.InsertCommandMessage.writeTheWrites(InsertCommandMessage.java:43) at com.mongodb.connection.BaseWriteCommandMessage.encodeMessageBodyWithMetadata(BaseWriteCommandMessage.java:129) at com.mongodb.connection.RequestMessage.encodeWithMetadata(RequestMessage.java:160) at com.mongodb.connection.WriteCommandProtocol.sendMessage(WriteCommandProtocol.java:220) at com.mongodb.connection.WriteCommandProtocol.execute(WriteCommandProtocol.java:101) at com.mongodb.connection.InsertCommandProtocol.execute(InsertCommandProtocol.java:67) at com.mongodb.connection.InsertCommandProtocol.execute(InsertCommandProtocol.java:37) at com.mongodb.connection.DefaultServer$DefaultServerProtocolExecutor.execute(DefaultServer.java:168) at com.mongodb.connection.DefaultServerConnection.executeProtocol(DefaultServerConnection.java:289) at com.mongodb.connection.DefaultServerConnection.insertCommand(DefaultServerConnection.java:118) at com.mongodb.operation.MixedBulkWriteOperation$Run$2.executeWriteCommandProtocol(MixedBulkWriteOperation.java:465) at com.mongodb.operation.MixedBulkWriteOperation$Run$RunExecutor.execute(MixedBulkWriteOperation.java:656) at com.mongodb.operation.MixedBulkWriteOperation$Run.execute(MixedBulkWriteOperation.java:411) at com.mongodb.operation.MixedBulkWriteOperation$1.call(MixedBulkWriteOperation.java:177) at com.mongodb.operation.MixedBulkWriteOperation$1.call(MixedBulkWriteOperation.java:168) at com.mongodb.operation.OperationHelper.withConnectionSource(OperationHelper.java:422) at com.mongodb.operation.OperationHelper.withConnection(OperationHelper.java:413) at com.mongodb.operation.MixedBulkWriteOperation.execute(MixedBulkWriteOperation.java:168) at com.mongodb.operation.MixedBulkWriteOperation.execute(MixedBulkWriteOperation.java:74) at com.mongodb.Mongo.execute(Mongo.java:845) at com.mongodb.Mongo$2.execute(Mongo.java:828) at com.mongodb.MongoCollectionImpl.executeSingleWriteRequest(MongoCollectionImpl.java:550) at com.mongodb.MongoCollectionImpl.insertOne(MongoCollectionImpl.java:317) at com.mongodb.MongoCollectionImpl.insertOne(MongoCollectionImpl.java:307) at org.apache.camel.component.mongodb3.MongoDbProducer.lambda$createDoInsert$6(MongoDbProducer.java:408) at org.apache.camel.component.mongodb3.MongoDbProducer.lambda$wrap$0(MongoDbProducer.java:252) at org.apache.camel.component.mongodb3.MongoDbProducer.invokeOperation(MongoDbProducer.java:132) at org.apache.camel.component.mongodb3.MongoDbProducer.process(MongoDbProducer.java:115) ... 14 more [2017-05-22 11:08:57] SedaConsumer WARN Error processing exchange. Exchange[]. Caused by: [org.apache.camel.component.mongodb3.CamelMongoDbException - org.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for class java.math.BigDecimal.] org.apache.camel.component.mongodb3.CamelMongoDbException: org.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for class java.math.BigDecimal. at org.apache.camel.component.mongodb3.MongoDbComponent.wrapInCamelMongoDbException(MongoDbComponent.java:64) at org.apache.camel.component.mongodb3.MongoDbProducer.process(MongoDbProducer.java:117) at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61) at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:145) at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77) at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:541) at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:198) at org.apache.camel.processor.Pipeline.process(Pipeline.java:120) at org.apache.camel.processor.Pipeline.process(Pipeline.java:83) at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:198) at org.apache.camel.component.seda.SedaConsumer.sendToConsumers(SedaConsumer.java:298) at org.apache.camel.component.seda.SedaConsumer.doRun(SedaConsumer.java:207) at org.apache.camel.component.seda.SedaConsumer.run(SedaConsumer.java:154) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: org.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for class java.math.BigDecimal. at org.bson.codecs.configuration.CodecCache.getOrThrow(CodecCache.java:46) at org.bson.codecs.configuration.ProvidersCodecRegistry.get(ProvidersCodecRegistry.java:63) at org.bson.codecs.configuration.ChildCodecRegistry.get(ChildCodecRegistry.java:51) at org.bson.codecs.DocumentCodec.writeValue(DocumentCodec.java:174) at org.bson.codecs.DocumentCodec.writeMap(DocumentCodec.java:189) at org.bson.codecs.DocumentCodec.writeValue(DocumentCodec.java:172) at org.bson.codecs.DocumentCodec.writeMap(DocumentCodec.java:189) at org.bson.codecs.DocumentCodec.writeValue(DocumentCodec.java:172) at org.bson.codecs.DocumentCodec.writeIterable(DocumentCodec.java:197) at org.bson.codecs.DocumentCodec.writeValue(DocumentCodec.java:170) at org.bson.codecs.DocumentCodec.writeMap(DocumentCodec.java:189) at org.bson.codecs.DocumentCodec.encode(DocumentCodec.java:131) at org.bson.codecs.DocumentCodec.encode(DocumentCodec.java:45) at org.bson.codecs.BsonDocumentWrapperCodec.encode(BsonDocumentWrapperCodec.java:63) at org.bson.codecs.BsonDocumentWrapperCodec.encode(BsonDocumentWrapperCodec.java:29) at com.mongodb.connection.InsertCommandMessage.writeTheWrites(InsertCommandMessage.java:101) at com.mongodb.connection.InsertCommandMessage.writeTheWrites(InsertCommandMessage.java:43) at com.mongodb.connection.BaseWriteCommandMessage.encodeMessageBodyWithMetadata(BaseWriteCommandMessage.java:129) at com.mongodb.connection.RequestMessage.encodeWithMetadata(RequestMessage.java:160) at com.mongodb.connection.WriteCommandProtocol.sendMessage(WriteCommandProtocol.java:220) at com.mongodb.connection.WriteCommandProtocol.execute(WriteCommandProtocol.java:101) at com.mongodb.connection.InsertCommandProtocol.execute(InsertCommandProtocol.java:67) at com.mongodb.connection.InsertCommandProtocol.execute(InsertCommandProtocol.java:37) at com.mongodb.connection.DefaultServer$DefaultServerProtocolExecutor.execute(DefaultServer.java:168) at com.mongodb.connection.DefaultServerConnection.executeProtocol(DefaultServerConnection.java:289) at com.mongodb.connection.DefaultServerConnection.insertCommand(DefaultServerConnection.java:118) at com.mongodb.operation.MixedBulkWriteOperation$Run$2.executeWriteCommandProtocol(MixedBulkWriteOperation.java:465) at com.mongodb.operation.MixedBulkWriteOperation$Run$RunExecutor.execute(MixedBulkWriteOperation.java:656) at com.mongodb.operation.MixedBulkWriteOperation$Run.execute(MixedBulkWriteOperation.java:411) at com.mongodb.operation.MixedBulkWriteOperation$1.call(MixedBulkWriteOperation.java:177) at com.mongodb.operation.MixedBulkWriteOperation$1.call(MixedBulkWriteOperation.java:168) at com.mongodb.operation.OperationHelper.withConnectionSource(OperationHelper.java:422) at com.mongodb.operation.OperationHelper.withConnection(OperationHelper.java:413) at com.mongodb.operation.MixedBulkWriteOperation.execute(MixedBulkWriteOperation.java:168) at com.mongodb.operation.MixedBulkWriteOperation.execute(MixedBulkWriteOperation.java:74) at com.mongodb.Mongo.execute(Mongo.java:845) at com.mongodb.Mongo$2.execute(Mongo.java:828) at com.mongodb.MongoCollectionImpl.executeSingleWriteRequest(MongoCollectionImpl.java:550) at com.mongodb.MongoCollectionImpl.insertOne(MongoCollectionImpl.java:317) at com.mongodb.MongoCollectionImpl.insertOne(MongoCollectionImpl.java:307) at org.apache.camel.component.mongodb3.MongoDbProducer.lambda$createDoInsert$6(MongoDbProducer.java:408) at org.apache.camel.component.mongodb3.MongoDbProducer.lambda$wrap$0(MongoDbProducer.java:252) at org.apache.camel.component.mongodb3.MongoDbProducer.invokeOperation(MongoDbProducer.java:132) at org.apache.camel.component.mongodb3.MongoDbProducer.process(MongoDbProducer.java:115) ... 14 more