Ignition.start中的空指针异常

时间:2018-01-04 15:22:33

标签: ignite

启动Apache Ignite客户端时(Ignite版本2.3.0,连接到(单个)群集节点似乎首先工作。但后来我得到以下异常

Jan 04, 2018 5:18:23 PM org.apache.ignite.logger.java.JavaLogger error
SEVERE: Failed to process custom exchange task: ClientCacheChangeDummyDiscoveryMessage [reqId=c1d6d9fd-a2be-4826-9459-05912ad1f5a5, cachesToClose=null, startCaches=[risfahrt_v5_matched_intern_partitioned_by_fahrtid]]
java.lang.NullPointerException
at org.apache.ignite.internal.processors.cache.CacheGroupContext.<init>(CacheGroupContext.java:191)
at org.apache.ignite.internal.processors.cache.GridCacheProcessor.startCacheGroup(GridCacheProcessor.java:1850)
at org.apache.ignite.internal.processors.cache.GridCacheProcessor.prepareCacheStart(GridCacheProcessor.java:1792)
at org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager.processClientCacheStartRequests(CacheAffinitySharedManager.java:428)
at org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager.processClientCachesChanges(CacheAffinitySharedManager.java:611)
at org.apache.ignite.internal.processors.cache.GridCacheProcessor.processCustomExchangeTask(GridCacheProcessor.java:338)
at org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$ExchangeWorker.processCustomTask(GridCachePartitionExchangeManager.java:2142)
at org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$ExchangeWorker.body(GridCachePartitionExchangeManager.java:2231)
at org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:110)
at java.lang.Thread.run(Thread.java:745)

Ignite客户端启动如下:

    IgniteConfiguration igniteConfiguration = new IgniteConfiguration();
    igniteConfiguration.setClientMode(clientMode);
    TcpDiscoverySpi tcpDiscoverySpi = new TcpDiscoverySpi();
    TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
    ipFinder.setAddresses(servers);
    tcpDiscoverySpi.setIpFinder(ipFinder);
    igniteConfiguration.setDiscoverySpi(tcpDiscoverySpi);

    Ignite ignite = Ignition.start(igniteConfiguration);

缓存配置如下:

CacheConfiguration<String, V> cacheConfiguration = new CacheConfiguration<>();
cacheConfiguration.setName(cacheName);
cacheConfiguration.setCacheMode(CacheMode.PARTITIONED);
NearCacheConfiguration<String, V> nearCacheConfiguration = new NearCacheConfiguration<>();
nearCacheConfiguration.setNearEvictionPolicy(new LruEvictionPolicy<>(nearCacheSize));
IgniteCache<String, V> cache = ignite.getOrCreateCache(cacheConfiguration, nearCacheConfiguration);

1 个答案:

答案 0 :(得分:0)

解决方案是避免缓存名称中的下划线(“_”)。在这样做之后,一切都没有问题。