You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Java11环境启动Ignite 2.10.0提示无空构造方法错误如何解决

Apache Ignite 2.10.0 Java 11环境启动报错解决方案

问题场景

Java 11容器环境部署apache ignite-core 2.10.0,调用Ignition.start()启动同JVM内的Ignite节点时抛出如下异常:

{"version": "0.2.0", "timestamp": "2021-08-18T08:08:51.363Z", "severity": "error", "service_id": "xxxxxxxxxxxxxxxx", "metadata" : {"category": "xxx"}, "message": "Exception during start processors, node will be stopped and close connections"}
org.apache.ignite.binary.BinaryObjectException: Failed to find empty constructor for class: org.apache.ignite.internal.processors.platform.websession.PlatformDotNetSessionLockResult
at org.apache.ignite.internal.binary.BinaryClassDescriptor.constructor(BinaryClassDescriptor.java:1088)
at org.apache.ignite.internal.binary.BinaryClassDescriptor.(BinaryClassDescriptor.java:309)

根本原因

该问题是Ignite 2.10.0的已知内置缺陷:用于.NET会话支持的内部类PlatformDotNetSessionLockResult未定义默认无参构造方法,Java 11对反射访问权限收紧后,Ignite的二进制序列化机制无法通过反射实例化该类,导致启动失败。

长期可行解决方案(无需修改源码)

  • 方案1(最优):升级Ignite版本至2.11.0及以上
    官方已在2.11.0版本修复该缺陷,直接给PlatformDotNetSessionLockResult补充了无参构造方法,仅需修改项目依赖的ignite-core版本号即可,无需额外调整配置。
  • 方案2(兼容2.10.0版本):关闭未使用的.NET平台组件
    若业务未使用Ignite的.NET互操作、.NET会话托管功能,可直接在Ignite启动配置中禁用.NET相关组件,避免触发该类的序列化逻辑:
    代码配置示例:
    IgniteConfiguration cfg = new IgniteConfiguration();
    PlatformConfiguration platformCfg = new PlatformConfiguration();
    // 置空.NET配置即可禁用相关组件加载
    platformCfg.setDotNetConfiguration(null);
    cfg.setPlatformConfiguration(platformCfg);
    Ignition.start(cfg);
    
    XML配置示例:
    <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
        <property name="platformConfiguration">
            <bean class="org.apache.ignite.configuration.PlatformConfiguration">
                <property name="dotNetConfiguration">
                    <null/>
                </property>
            </bean>
        </property>
    </bean>
    
  • 方案3(兼容2.10.0版本):调整序列化策略+JVM权限配置
    若需要使用.NET相关功能且暂时无法升级版本,可开启Ignite二进制序列化的Unsafe实例化能力,配合Java 11的权限开放参数解决:
    1. 添加JVM启动参数:--add-exports java.base/jdk.internal.misc=ALL-UNNAMED
    2. 配置Ignite二进制序列化参数:
    BinaryConfiguration binaryCfg = new BinaryConfiguration();
    // 开启Unsafe实例化无构造函数类的能力
    binaryCfg.setUseUnsafeConstructors(true);
    IgniteConfiguration cfg = new IgniteConfiguration();
    cfg.setBinaryConfiguration(binaryCfg);
    

注意:不建议长期使用修改源码重打包的临时方案,容易产生依赖冲突、后续版本升级兼容问题,也无法同步官方安全补丁


内容的提问来源于stack exchange,提问作者Pankaj Bhadani

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.05 19:51:00