I am having CodecNotFoundException with the below stacktrace, while trying to insert data using annotations of datastax java driver for mapping with cassandra.
Exception 1::
Exception in thread "main" com.datastax.driver.core.exceptions.CodecNotFoundException: Codec not found for requested operation: [float <-> java.lang.Object]
at com.datastax.driver.core.exceptions.CodecNotFoundException.copy(CodecNotFoundException.java:56)
at com.datastax.driver.core.exceptions.CodecNotFoundException.copy(CodecNotFoundException.java:25)
at com.datastax.driver.mapping.DriverThrowables.propagateCause(DriverThrowables.java:41)
at com.datastax.driver.mapping.Mapper.save(Mapper.java:275)
at com.coreanalytics.componentConfig.ChartConfigInteraction.saveChartConf(ChartConfigInteraction.scala:14)
at com.coreanalytics.componentConfig.testing$.delayedEndpoint$com$coreanalytics$componentConfig$testing$1(ChartConfigInteraction.scala:23)
at com.coreanalytics.componentConfig.testing$delayedInit$body.apply(ChartConfigInteraction.scala:18)
at scala.Function0$class.apply$mcV$sp(Function0.scala:34)
at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
at scala.App$$anonfun$main$1.apply(App.scala:76)
at scala.App$$anonfun$main$1.apply(App.scala:76)
at scala.collection.immutable.List.foreach(List.scala:381)
at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:35)
at scala.App$class.main(App.scala:76)
at com.coreanalytics.componentConfig.testing$.main(ChartConfigInteraction.scala:18)
at com.coreanalytics.componentConfig.testing.main(ChartConfigInteraction.scala)
Exception 2::
Exception in thread "main" com.datastax.driver.core.exceptions.CodecNotFoundException: Codec not found for requested operation: [int <-> java.lang.Object]
at com.datastax.driver.core.exceptions.CodecNotFoundException.copy(CodecNotFoundException.java:56)
at com.datastax.driver.core.exceptions.CodecNotFoundException.copy(CodecNotFoundException.java:25)
at com.datastax.driver.mapping.DriverThrowables.propagateCause(DriverThrowables.java:41)
at com.datastax.driver.mapping.Mapper.save(Mapper.java:275)
at com.coreanalytics.componentConfig.ChartConfigInteraction.saveChartConf(ChartConfigInteraction.scala:14)
at com.coreanalytics.componentConfig.testing$.delayedEndpoint$com$coreanalytics$componentConfig$testing$1(ChartConfigInteraction.scala:23)
at com.coreanalytics.componentConfig.testing$delayedInit$body.apply(ChartConfigInteraction.scala:18)
at scala.Function0$class.apply$mcV$sp(Function0.scala:34)
at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
at scala.App$$anonfun$main$1.apply(App.scala:76)
at scala.App$$anonfun$main$1.apply(App.scala:76)
at scala.collection.immutable.List.foreach(List.scala:381)
at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:35)
at scala.App$class.main(App.scala:76)
at com.coreanalytics.componentConfig.testing$.main(ChartConfigInteraction.scala:18)
at com.coreanalytics.componentConfig.testing.main(ChartConfigInteraction.scala)
The problem is I am getting this two different exception when try to execute the same code. (same table, same insert operation, no change) (e.g. for first time execution I get exception with float
and than second or third time I got with the int
one)
I have checked my table twice, it doesn't seem there is any issue with types, but than why I am getting this exception ?
As my table having around 50 columns with around 8 UDTs it is difficult to show the whole schema here. I also verified UDTs field type with beans' properties. And ya, I am using Scala
do all these stuffs.
Note: I have tried updating Guava
dependency but It has problem with FutureCallBack as it is removed.
The CodecNotFoundException is thrown if the cql type does not match the type of the java attribute that should be mapped.
See the following links:
This seems to be a similar questions: Datastax Cassandra Driver throwing CodecNotFoundException