- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 Spring Boot 运行 Ignite。我的目的是在 Ignite 中对 BinaryObject 执行 SqlFieldQuery,提到我没有任何实体类,在运行时使用 QueryEntity 创建实体。这是我的以下代码:
CacheConfiguration<Integer, BinaryObject> cachecfg = new CacheConfiguration<>();
cachecfg.setQueryEntities(new ArrayList<QueryEntity>()
{
{
QueryEntity e = new QueryEntity();
e.setKeyType("java.lang.Integer");
e.setValueType("BinaryTest");
e.setFields(new LinkedHashMap<String, String>() {
{
put("name", "java.lang.String");
}
});
add(e);
}
});
cachecfg.setName("MY_CACHE");
IgniteCache<Integer, BinaryObject> ignitecache = igniteInstance.createCache(cachecfg).withKeepBinary();
BinaryObjectBuilder builder = igniteInstance.binary().builder("BinaryTest");
builder.setField("name", "Test");
ignitecache.put(1, builder.build());
QueryCursor<List<?>> query = ignitecache.query(new SqlFieldsQuery("select name from BinaryTest"));
System.out.println(query.getAll());
当我运行此代码时,出现错误:
class org.apache.ignite.IgniteCheckedException: Failed to validate cache
configuration (make sure all objects in cache configuration are
serializable): MY_CACHE
我可能缺少一些序列化配置。有什么问题吗?
最佳答案
摆脱双括号初始化,在这种情况下,您最终会得到一个匿名类,它是具有实例初始值设定项的 ArrayList 的子类。匿名类始终包含对封闭类的引用,在您的情况下,它试图被序列化。
所以选择:
CacheConfiguration<Integer, BinaryObject> cachecfg = new CacheConfiguration<>();
QueryEntity e = new QueryEntity();
e.setKeyType("java.lang.Integer");
e.setValueType("BinaryTest");
LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
map.put("name", "java.lang.String");
e.setFields(map);
ArrayList<QueryEntity> list = new ArrayList<QueryEntity>();
list.add(e);
cachecfg.setQueryEntities(list);
cachecfg.setName("MY_CACHE");
IgniteCache<Integer, BinaryObject> ignitecache = igniteInstance.createCache(cachecfg).withKeepBinary();
关于java - 如何解决ignitecheckedException : make sure all objects in cache configuration are serializable,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50284878/
我有一个正在执行大量删除操作的存储过程。数十万条记录。它不会从应用程序运行,但我仍然担心,我的一个客户不小心运行了它(由于他们的“好奇心”,我早些时候遇到了问题):D 是的。有备份和类似的东西,但我在
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 要求提供代码的问题必须表现出对所解决问题的最低限度的了解。包括尝试的解决方案、为什么它们不起作用以及预期结果
在我的一些表格上,我有一个额外的弹出确认“你确定吗?”在它真正破坏记录之前。我正在使用 Rails 4 和 simple_form。这是一个例子。 我有一个名为 Promotions 的模型和另一个名
论文重新审视了深度神经网络中的不确定性估计技术,并整合了一套技术以增强其可靠性。论文的研究表明,多种技术(包括模型正则化、分类器改造和优化策略)的综合应用显着提高了图像分类任务中不确定性预测的准
我有以下代码: class ServiceA { def save(Object object) { if (somethingBadComesBack) { th
我已将 [空购物车] 按钮添加到我的 Woocommerce 购物车页面。 太棒了。 我想添加一个弹出窗口来询问用户“您确定吗?” 万一他们购物了两个小时,然后错误地点击了这个按钮。 我认为这是自定义
最近在这方面来来回回。尝试使用 Putty 将 SSH 隧道从我机器上的本地主机端口附加到可访问 Internet 的 SSH 服务器另一端的内部端口。 Putty 不会检查端口是否可用。在打开 Pu
Shiny 的新手在这里。 我正在尝试编写一个 R Shiny 脚本,我想要做的一件事是生成给定日期和不同地区的给定广告商的广告浏览次数的直方图。 我的表有以下列(带有示例数据): Date I
我有一些影响生产服务器的 Jenkins 工作。最好有一个“你确定要这样做吗?”当用户运行这些作业之一时的对话框。我还没有找到一个插件。有没有人尝试过这样做? 最佳答案 你可以添加一个“你确定吗?”构
早安开发者, 我正在尝试在 powershell 中创建删除功能。我想要这样的东西: function deleteEnv(){ $result = [System.Windows.For
我有以下代码: JsonElement deviceConfig = null; JsonObject status = getRestAPI().Connectivity().get
#include #include #include #include #include "battleshipgrid.h" using namespace std; battleshipg
最近我在处理一个未初始化的变量时遇到了很多麻烦。 在Java中,变量的默认值为null,因此如果使用未初始化的变量,很可能会抛出异常。如果我理解,在 C++ 中,变量是用内存中的任何数据初始化的。这意
我这辈子都想不起来如何绕过恼人的提示 你确定吗? Y/N 删除文件时。 我好像记得是这样的: del C:\Test && ECHO Y 最佳答案 使用del/F/Q强制删除只读文件(/F)和目录,不
我有一个带有 submit_tag 的表单。 我既要设置内容值,又要有一个确认意图的 js 弹出窗口。 我试过了 the suggestion in this answer和 what the doc
我曾经问过一个问题here如果 Windows DLL 由 Microsoft 签名。我意识到它们是,一个好 friend 告诉我 SigCheck实用程序可以提供有关文件签名的信息;但还有一个问题:
我经常发现,当程序员或分配任务的人不能真正理解解决方案的工作方式时,他们会随机添加一些东西,直到它起作用为止。 示例: 重新绘制由于某种原因未按程序员希望绘制的窗口: Invalidate(); Re
我有一个 Rails 应用程序,并且想要模拟 onunload 效果以在离开更改之前进行提示。环顾四周时,我发现了Are You Sure? . 我已经在表单上实现了它,它可以在页面刷新时工作,但它不
目前,我的取消按钮有这个 jQuery 代码 $('#cancel').click(function () { $('#edit').show(); $('#savechanges,
我希望使用 MediaIOUploadBase 向 CLI 提供上传进度,并且我可以看到有一个名为 MediaUploadProgress 的类,但它不是上传的包装器,因此我假设它是从事件上传中以某种
我是一名优秀的程序员,十分优秀!