首页 > 解决方案 > 使用 Apache Ignite 重新部署 JBoss WAR 时,无法编组自定义事件:StartRoutineDiscoveryMessage

问题描述

我正在努力做到这一点,以便我可以使用具有 apache ignite 的 WAR 重新部署 JBoss 7.1.0 集群。

我正在像这样启动缓存:

    System.setProperty("IGNITE_UPDATE_NOTIFIER", "false");
    
    igniteConfiguration = new IgniteConfiguration();
    
    int failureDetectionTimeout = Integer.parseInt(getProperty("IGNITE_TCP_DISCOVERY_FAILURE_DETECTION_TIMEOUT", "60000"));
    
    igniteConfiguration.setFailureDetectionTimeout(failureDetectionTimeout);

    String igniteVmIps = getProperty("IGNITE_VM_IPS");
    List<String> addresses = Arrays.asList("127.0.0.1:47500");
    if (StringUtils.isNotBlank(igniteVmIps)) {
        addresses = Arrays.asList(igniteVmIps.split(","));
    }
    
    int networkTimeout = Integer.parseInt(getProperty("IGNITE_TCP_DISCOVERY_NETWORK_TIMEOUT", "60000"));
    boolean failureDetectionTimeoutEnabled = Boolean.parseBoolean(getProperty("IGNITE_TCP_DISCOVERY_FAILURE_DETECTION_TIMEOUT_ENABLED", "true"));
    
    int tcpDiscoveryLocalPort = Integer.parseInt(getProperty("IGNITE_TCP_DISCOVERY_LOCAL_PORT", "47500"));
    int tcpDiscoveryLocalPortRange = Integer.parseInt(getProperty("IGNITE_TCP_DISCOVERY_LOCAL_PORT_RANGE", "0"));
    
    TcpDiscoverySpi tcpDiscoverySpi = new TcpDiscoverySpi();
    tcpDiscoverySpi.setLocalPort(tcpDiscoveryLocalPort);
    tcpDiscoverySpi.setLocalPortRange(tcpDiscoveryLocalPortRange);
    tcpDiscoverySpi.setNetworkTimeout(networkTimeout);
    tcpDiscoverySpi.failureDetectionTimeoutEnabled(failureDetectionTimeoutEnabled);
    TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
    ipFinder.setAddresses(addresses);
    tcpDiscoverySpi.setIpFinder(ipFinder);

    igniteConfiguration.setDiscoverySpi(tcpDiscoverySpi);

    Ignite ignite = Ignition.start(igniteConfiguration);

    ignite.cluster().active(true);

然后,当应用程序取消部署时,我将停止缓存:

ignite.close();

当我尝试重新部署时,在初始化期间出现以下错误。

 org.apache.ignite.spi.IgniteSpiException: Failed to marshal custom event: StartRoutineDiscoveryMessage [startReqData=StartRequestData [prjPred=org.apache.ignite.internal.cluster.ClusterGroupAdapter$CachesFilter@7385a997, clsName=null, depInfo=null, hnd=org.apache.ignite.internal.GridEventConsumeHandler@2aec6952, bufSize=1, interval=0, autoUnsubscribe=true], keepBinary=false, deserEx=null, routineId=bbe16e8e-2820-4ba0-a958-d5f644498ba2]

如果我完全重新启动服务器,则启动正常。

我在关机过程中错过了一些魔法吗?

标签: javaignite

解决方案


我知道我做错了什么,这是我从票证中遗漏的代码。

ignite.events(ignite.cluster().forCacheNodes(cacheConfig.getKey())).remoteListen(locLsnr, rmtLsnr,
                            EVT_CACHE_OBJECT_PUT, EVT_CACHE_OBJECT_READ, EVT_CACHE_OBJECT_REMOVED);

当它尝试两次注册此代码时,它导致了那个奇怪的错误。

我现在在它周围放置了一个 try-catch 忽略,事情似乎还可以。


推荐阅读