2016-12-27 75 views
0

我有CodecNotFoundException与下面的stacktrace,而试图 插入数据使用用于与cassandra进行映射的datastax java驱动程序的注释。不一致的错误/异常Codec找不到请求的操作:[float <-> java.lang.Object]和[int <-> java.lang.Object]

异常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) 

异常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) 

的问题是我得到这两个不同的异常,当尝试执行相同的代码。 (相同的表,相同的插入操作,没有变化)(例如对于第一次执行我得到异常与float和第二次或第三次我得到了与int之一) 我检查了我的表两次,似乎并没有任何类型的问题,但为什么我得到这个异常?

由于我的表格大约有50列,大约有8个UDT,所以很难在这里显示整个模式。我还使用bean的属性验证了UDT字段类型。遐,我正在使用Scala做所有这些东西。

说明:我试过更新Guava依赖关系,但它在FutureCallBack被删除时出现问题。

回答

0

这对我来说似乎是一个简单的“绑定”问题。正如错误清楚地表明的那样,您将int/float字段绑定到对象,并且驱动程序无法创建该关联,因为它不知道如何执行该关联。

修复很简单,您必须确保每个CF在应用程序级别完成其关联。

如果你无法理解它何时失败,那么把你的表定义放在这里(即使它很大),并且记得在这里发布将数据绑定到列的代码。

+0

我知道它应该具有约束力的问题但是我检查两次。即使有约束力的错误,为什么它显示不同的例外?而我的表模式有8个UDT,我不介意,但你认为我应该在这里发布9个表模式和9个bean类? –

0
+0

@Phillip我已经通过这些链接。我学习了这些文档的映射,并在我的应用中关注它,但我仍然遇到这个问题。我还在其他表中应用了映射,并且在同一应用中按预期工作。 –

相关问题