我正在尝试将 Ignite 与 Cassandra 集成。我正在使用持久性策略作为 BLOB。当我运行该程序时,它显示错误,如“com.datastax.driver.core.exceptions.CodecNotFoundException:找不到请求操作的编解码器:com.datastax.driver.core 上的 [varchar <-> java.nio.HeapByteBuffer]。 CodecRegistry.notFound(CodecRegistry.java:679) "
这是我的持久化 xml 文件
<persistence keyspace="sam" table="key">
<keyPersistence class="java.lang.String" strategy="BLOB" column="key"/>
<valuePersistence class="java.lang.String" strategy="BLOB" column="value"/>
</persistence>
主要.cpp
int main()
{
IgniteConfiguration cfg;
cfg.springCfgPath = "apache-ignite-fabric-2.0.0-bin/cassandra-config.xml";
Ignite grid = Ignition::Start(cfg);
Cache<Test, Test> cache = grid.GetCache<Test, Test>("cache1");
Test obj;
cache.LoadCache ();
Test key;
key.key = "123dfsdfs";
obj.value = "sdfsf";
cache.Put (key,obj);
return 0;
}
最佳答案
错误意味着 Cassandra 中列的类型是 varchar
,但您正试图将 BLOB 写入其中。因此失败。
但是为什么要对字符串使用BLOB
策略呢?您可以改为使用 PRIMITIVE
策略将字符串写入 varchar
列。
关于c++ - Ignite 与 Cassandra 集成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44254079/