Java apache ignite加载缓存ClassCastException

Java apache ignite加载缓存ClassCastException,java,ignite,Java,Ignite,我正在尝试使用ApacheIgnite,我正在使用IgniteWeb控制台生成节点 我需要从数据库中配置2个缓存并启用持久性存储,因为这两个表有很多数据 以下是我所做的(控制台) publicstaticcacheconfiguration cacheMInoutlineCache()引发异常{ CacheConfiguration ccfg=新的CacheConfiguration(); ccfg.setName(“MInoutlineCache”); ccfg.setCacheMode(Ca

我正在尝试使用ApacheIgnite,我正在使用IgniteWeb控制台生成节点

我需要从数据库中配置2个缓存并启用持久性存储,因为这两个表有很多数据

以下是我所做的(控制台)

publicstaticcacheconfiguration cacheMInoutlineCache()引发异常{
CacheConfiguration ccfg=新的CacheConfiguration();
ccfg.setName(“MInoutlineCache”);
ccfg.setCacheMode(CacheMode.LOCAL);
ccfg.setatomictymode(cacheatomictymode.ATOMIC);
ccfg.setCopyOnRead(真);
CacheJdbcPojoStoreFactory cacheStoreFactory=new CacheJdbcPojoStoreFactory();
setDataSourceFactory(新工厂(){
/**{@inheritardoc}**/
@重写公共数据源create(){
返回DataSources.INSTANCE\u dsOracle\u Compiere;
};
});
setquantial(新的Oraclequantial());
setTypes(jdbcTypeMInoutline(ccfg.getName());
ccfg.setCacheStoreFactory(cacheStoreFactory);
ccfg.setReadThrough(真);
ccfg.setWriteThrough(真);
ArrayList qryEntities=新的ArrayList();
QueryEntity qryEntity=新QueryEntity();
setKeyType(“java.lang.Long”);
qryEntity.setValueType(“com.gmail.talcorpdz.model.MInoutline”);
qryEntity.setTableName(“M_INOUTLINE”);
qryEntity.setKeyFieldName(“mInoutlineId”);
HashSet keyFields=新HashSet();
添加(“mInoutlineId”);
qryEntity.setKeyFields(关键字段);
LinkedHashMap字段=新建LinkedHashMap();
fields.put(“adClientId”、“java.lang.Long”);
qryEntity.设置字段(字段);
HashMap别名=新HashMap();
别名.put(“mInoutlineId”、“M_inooutlineid”);
qryEntity.setAlias(别名);
ArrayList索引=新的ArrayList();
QueryIndex=新的QueryIndex();
index.setName(“IDX$$\U 00010002”);
setIndexType(QueryIndexType.SORTED);
LinkedHashMap indFlds=新LinkedHashMap();
indFlds.put(“MATTRIBUTESTENSTANCEID”,假);
indFlds.put(“mInoutId”,假);
qryEntity.setIndexes(索引);
qryEntity.add(qryEntity);
ccfg.设置查询实体(QRY实体);
/**
*@作者塔勒布
* 
*规范1.0:不需要架构解决方案
* https://stackoverflow.com/a/58930331/4388228
* */
ccfg.setSqlSchema(“公共”);
返回ccfg;
}
我相信我错过了配置存储,因为必须帮助内存使用磁盘空间

下面是异常的堆栈跟踪

[11:49:58]\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu
[11:49:58]   /  _/ ___/ |/ /  _/_  __/ __/ 
[11:49:58]  _/ // (7 7    // /  / / / _/   
[11:49:58] /___/\___/_/|_/___/ /_/ /___/  
[11:49:58] 
[11:49:58]版本2.7.6#20190911-sha1:21f7ca41
[11:49∶58] 2019版权(C)Apache软件基金会
[11:49:58] 
[11:49:58]点火文件:http://ignite.apache.org
[11:49:58] 
[11:49:58]安静模式。
[11:49:58]^--通过“JavaLogger[quiet=true,config=null]进行日志记录”
[11:49:58]^--要查看**完整**控制台日志,请在此处添加-DIGNITE_QUIET=false或“-v”点火。{sh|bat}
[11:49:58] 
[11:49:58]操作系统:Linux 4.19.0-kali5-amd64-amd64
[11:49:58]虚拟机信息:Java(TM)SE运行时环境1.8.0_201-b09 Oracle Corporation Java HotSpot(TM)64位服务器虚拟机25.201-b09
[11:49:58]请设置系统属性“-Djava.net.preferIPv4Stack=true”,以避免在混合环境中可能出现的问题。
[11:49:58]初始堆大小为124MB(应不小于512MB,使用-Xms512m-Xmx512m)。
[11:49:58]配置的插件:
[11:49:58]^--无
[11:49:58] 
[11:49:58]配置的故障处理程序:[hnd=StopNodeOrHaltFailureHandler[tryStop=false,timeout=0,super=AbstractFailureHandler[ignoredFailureTypes=[SYSTEM\u WORKER\u BLOCKED,SYSTEM\u CRITICAL\u OPERATION\u timeout]]
[11:49:59]消息队列限制设置为0,这可能导致在完全异步或主同步模式下运行缓存操作时,由于发送方和接收方的消息队列增长而出现潜在的OOME。
[11:49:59]安全状态[身份验证=关闭,tls/ssl=关闭]
[11:49:59]REST协议不会在客户端节点上启动。要在客户端节点上启动协议,请设置'-DIGNITE_REST_start_on_client=true'系统属性。
[11:50:00]在本地计算机上启动的节点需要80%以上的物理RAM,这可能会由于交换(请减小JVM堆大小、数据区域大小或检查点缓冲区大小)而导致显著的速度减慢。[必需=4979MB,可用=7867MB]
[11:50:00]网格“attiryak”的性能建议(如有可能进行修复)
[11:50:00]要禁用,请设置-DIGNITE_PERFORMANCE_SUGGESTIONS_DISABLED=true
[11:50:00]^--启用G1垃圾收集器(将“-XX:+UseG1GC”添加到JVM选项)
[11:50:00]^——指定JVM堆的最大大小(将“-Xmx[g | g | m | m | k | k]”添加到JVM选项)
[11:50:00]^——如果获取“OOME:direct buffer memory”(将-XX:MaxDirectMemorySize=[g | g | m | m | k | k]”添加到JVM选项,则设置最大直接内存大小)
[11:50:00]^--禁用对System.gc()调用的处理(将“-XX:+DisableExplicitGC”添加到JVM选项)
[11:50:00]有关更多性能建议,请参阅本页:https://apacheignite.readme.io/docs/jvm-and-system-tuning
[11:50:00] 
[11:50:00]启动控制台管理和监控运行ignitevisorcmd.{sh|bat}
[11:50:00]配置的数据区域:
[11:50:00]^--默认值[initSize=512.0 MiB,maxSize=1.0 GiB,persistence=true]
[11:50:00] 
[11:50:00]点火节点已启动正常(id=7ad24962,实例名称=attiryak)
[11:50:00]>>>Ignite cluster未激活(可用功能有限)。请使用control.(sh|bat)脚本或Ignite cluster界面激活。
[11:50:00]拓扑快照[ver=2,locNode=7ad24962,服务器=1,客户端=1,状态=INACTIVE,CPU=8,堆外=2.0GB,堆内=3.4GB]
>>正在加载缓存。。。
2019年11月19日上午11:50:01或

    /**
     * Configure grid.
     * 
     * @return Ignite configuration.
     * @throws Exception If failed to construct Ignite configuration instance.
     **/
    public static IgniteConfiguration createConfiguration() throws Exception {
        IgniteConfiguration cfg = new IgniteConfiguration();

        cfg.setClientMode(true);
        cfg.setIgniteInstanceName("attiryak");

        TcpDiscoverySpi discovery = new TcpDiscoverySpi();

        TcpDiscoveryMulticastIpFinder ipFinder = new TcpDiscoveryMulticastIpFinder();

        ipFinder.setAddresses(Arrays.asList("127.0.0.1:47500..47510"));

        discovery.setIpFinder(ipFinder);

        cfg.setDiscoverySpi(discovery);

        AtomicConfiguration atomicCfg = new AtomicConfiguration();

        atomicCfg.setCacheMode(CacheMode.LOCAL);

        cfg.setAtomicConfiguration(atomicCfg);

        DataStorageConfiguration dataStorageCfg = new DataStorageConfiguration();

        dataStorageCfg.setPageSize(16384);
        dataStorageCfg.setConcurrencyLevel(2);
        dataStorageCfg.setSystemRegionInitialSize(52428800L);
        dataStorageCfg.setSystemRegionMaxSize(209715200L);

        DataRegionConfiguration dataRegionCfg = new DataRegionConfiguration();

        dataRegionCfg.setInitialSize(536870912L);
        dataRegionCfg.setMaxSize(1073741824L);
        dataRegionCfg.setMetricsEnabled(true);
        dataRegionCfg.setPersistenceEnabled(true);

        dataStorageCfg.setDefaultDataRegionConfiguration(dataRegionCfg);

        cfg.setDataStorageConfiguration(dataStorageCfg);

        cfg.setCacheConfiguration(
            cacheMInoutlineCache(),
            cacheMInoutlineconfirmCache()
        );

        return cfg;
    }
    public static CacheConfiguration cacheMInoutlineCache() throws Exception {
        CacheConfiguration ccfg = new CacheConfiguration();

        ccfg.setName("MInoutlineCache");
        ccfg.setCacheMode(CacheMode.LOCAL);
        ccfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
        ccfg.setCopyOnRead(true);

        CacheJdbcPojoStoreFactory cacheStoreFactory = new CacheJdbcPojoStoreFactory();

        cacheStoreFactory.setDataSourceFactory(new Factory<DataSource>() {
            /** {@inheritDoc} **/
            @Override public DataSource create() {
                return DataSources.INSTANCE_dsOracle_Compiere;
            };
        });

        cacheStoreFactory.setDialect(new OracleDialect());

        cacheStoreFactory.setTypes(jdbcTypeMInoutline(ccfg.getName()));

        ccfg.setCacheStoreFactory(cacheStoreFactory);

        ccfg.setReadThrough(true);
        ccfg.setWriteThrough(true);

        ArrayList<QueryEntity> qryEntities = new ArrayList<>();

        QueryEntity qryEntity = new QueryEntity();

        qryEntity.setKeyType("java.lang.Long");
        qryEntity.setValueType("com.gmail.talcorpdz.model.MInoutline");
        qryEntity.setTableName("M_INOUTLINE");
        qryEntity.setKeyFieldName("mInoutlineId");

        HashSet<String> keyFields = new HashSet<>();

        keyFields.add("mInoutlineId");

        qryEntity.setKeyFields(keyFields);

        LinkedHashMap<String, String> fields = new LinkedHashMap<>();

        fields.put("adClientId", "java.lang.Long");

        qryEntity.setFields(fields);

        HashMap<String, String> aliases = new HashMap<>();

        aliases.put("mInoutlineId", "M_INOUTLINE_ID");
        qryEntity.setAliases(aliases);

        ArrayList<QueryIndex> indexes = new ArrayList<>();

        QueryIndex index = new QueryIndex();

        index.setName("IDX$$_00010002");
        index.setIndexType(QueryIndexType.SORTED);

        LinkedHashMap<String, Boolean> indFlds = new LinkedHashMap<>();

        indFlds.put("mAttributesetinstanceId", false);
        indFlds.put("mInoutId", false);
        qryEntity.setIndexes(indexes);
        qryEntities.add(qryEntity);

        ccfg.setQueryEntities(qryEntities);

        /**
         * @author taleb 
         * 
         * spec 1.0 : no schema needed solution
         * https://stackoverflow.com/a/58930331/4388228
         * */
        ccfg.setSqlSchema("PUBLIC");

        return ccfg;
    }
[11:49:58]    __________  ________________ 
[11:49:58]   /  _/ ___/ |/ /  _/_  __/ __/ 
[11:49:58]  _/ // (7 7    // /  / / / _/   
[11:49:58] /___/\___/_/|_/___/ /_/ /___/  
[11:49:58] 
[11:49:58] ver. 2.7.6#20190911-sha1:21f7ca41
[11:49:58] 2019 Copyright(C) Apache Software Foundation
[11:49:58] 
[11:49:58] Ignite documentation: http://ignite.apache.org
[11:49:58] 
[11:49:58] Quiet mode.
[11:49:58]   ^-- Logging by 'JavaLogger [quiet=true, config=null]'
[11:49:58]   ^-- To see **FULL** console log here add -DIGNITE_QUIET=false or "-v" to ignite.{sh|bat}
[11:49:58] 
[11:49:58] OS: Linux 4.19.0-kali5-amd64 amd64
[11:49:58] VM information: Java(TM) SE Runtime Environment 1.8.0_201-b09 Oracle Corporation Java HotSpot(TM) 64-Bit Server VM 25.201-b09
[11:49:58] Please set system property '-Djava.net.preferIPv4Stack=true' to avoid possible problems in mixed environments.
[11:49:58] Initial heap size is 124MB (should be no less than 512MB, use -Xms512m -Xmx512m).
[11:49:58] Configured plugins:
[11:49:58]   ^-- None
[11:49:58] 
[11:49:58] Configured failure handler: [hnd=StopNodeOrHaltFailureHandler [tryStop=false, timeout=0, super=AbstractFailureHandler [ignoredFailureTypes=[SYSTEM_WORKER_BLOCKED, SYSTEM_CRITICAL_OPERATION_TIMEOUT]]]]
[11:49:59] Message queue limit is set to 0 which may lead to potential OOMEs when running cache operations in FULL_ASYNC or PRIMARY_SYNC modes due to message queues growth on sender and receiver sides.
[11:49:59] Security status [authentication=off, tls/ssl=off]
[11:49:59] REST protocols do not start on client node. To start the protocols on client node set '-DIGNITE_REST_START_ON_CLIENT=true' system property.
[11:50:00] Nodes started on local machine require more than 80% of physical RAM what can lead to significant slowdown due to swapping (please decrease JVM heap size, data region size or checkpoint buffer size) [required=4979MB, available=7867MB]
[11:50:00] Performance suggestions for grid 'attiryak' (fix if possible)
[11:50:00] To disable, set -DIGNITE_PERFORMANCE_SUGGESTIONS_DISABLED=true
[11:50:00]   ^-- Enable G1 Garbage Collector (add '-XX:+UseG1GC' to JVM options)
[11:50:00]   ^-- Specify JVM heap max size (add '-Xmx<size>[g|G|m|M|k|K]' to JVM options)
[11:50:00]   ^-- Set max direct memory size if getting 'OOME: Direct buffer memory' (add '-XX:MaxDirectMemorySize=<size>[g|G|m|M|k|K]' to JVM options)
[11:50:00]   ^-- Disable processing of calls to System.gc() (add '-XX:+DisableExplicitGC' to JVM options)
[11:50:00] Refer to this page for more performance suggestions: https://apacheignite.readme.io/docs/jvm-and-system-tuning
[11:50:00] 
[11:50:00] To start Console Management & Monitoring run ignitevisorcmd.{sh|bat}
[11:50:00] Data Regions Configured:
[11:50:00]   ^-- default [initSize=512.0 MiB, maxSize=1.0 GiB, persistence=true]
[11:50:00] 
[11:50:00] Ignite node started OK (id=7ad24962, instance name=attiryak)
[11:50:00] >>> Ignite cluster is not active (limited functionality available). Use control.(sh|bat) script or IgniteCluster interface to activate.
[11:50:00] Topology snapshot [ver=2, locNode=7ad24962, servers=1, clients=1, state=INACTIVE, CPUs=8, offheap=2.0GB, heap=3.4GB]
>> Loading caches...
Nov 19, 2019 11:50:01 AM org.apache.ignite.logger.java.JavaLogger error
SEVERE: Failed to activate node components [nodeId=7ad24962-e5c8-4f0b-8b99-1c42a3c91c01, client=true, topVer=AffinityTopologyVersion [topVer=2, minorTopVer=1]]
java.lang.ClassCastException: org.apache.ignite.internal.pagemem.impl.PageMemoryNoStoreImpl cannot be cast to org.apache.ignite.internal.processors.cache.persistence.pagemem.PageMemoryEx
    at org.apache.ignite.internal.processors.cache.persistence.GridCacheOffheapManager.getOrAllocateCacheMetas(GridCacheOffheapManager.java:728)
    at org.apache.ignite.internal.processors.cache.persistence.GridCacheOffheapManager.initDataStructures(GridCacheOffheapManager.java:123)
    at org.apache.ignite.internal.processors.cache.IgniteCacheOffheapManagerImpl.start(IgniteCacheOffheapManagerImpl.java:196)
    at org.apache.ignite.internal.processors.cache.CacheGroupContext.start(CacheGroupContext.java:937)
    at org.apache.ignite.internal.processors.cache.GridCacheProcessor.startCacheGroup(GridCacheProcessor.java:2251)
    at org.apache.ignite.internal.processors.cache.GridCacheProcessor.prepareCacheStart(GridCacheProcessor.java:2146)
    at org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager.processCacheStartRequests(CacheAffinitySharedManager.java:898)
    at org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager.onCacheChangeRequest(CacheAffinitySharedManager.java:798)
    at org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture.onClusterStateChangeRequest(GridDhtPartitionsExchangeFuture.java:1114)
    at org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture.init(GridDhtPartitionsExchangeFuture.java:736)
    at org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$ExchangeWorker.body0(GridCachePartitionExchangeManager.java:2681)
    at org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$ExchangeWorker.body(GridCachePartitionExchangeManager.java:2553)
    at org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:120)
    at java.lang.Thread.run(Thread.java:748)

>> Loading cache: MInoutlineCache
Nov 19, 2019 11:50:02 AM org.apache.ignite.logger.java.JavaLogger error
SEVERE: Failed to process custom exchange task: ClientCacheChangeDummyDiscoveryMessage [reqId=587e6edb-95ee-4208-a525-a35ca441bf7c, cachesToClose=null, startCaches=[MInoutlineCache]]
java.lang.ClassCastException: org.apache.ignite.internal.pagemem.impl.PageMemoryNoStoreImpl cannot be cast to org.apache.ignite.internal.processors.cache.persistence.pagemem.PageMemoryEx
    at org.apache.ignite.internal.processors.cache.persistence.GridCacheOffheapManager.getOrAllocateCacheMetas(GridCacheOffheapManager.java:728)
    at org.apache.ignite.internal.processors.cache.persistence.GridCacheOffheapManager.initDataStructures(GridCacheOffheapManager.java:123)
    at org.apache.ignite.internal.processors.cache.IgniteCacheOffheapManagerImpl.start(IgniteCacheOffheapManagerImpl.java:196)
    at org.apache.ignite.internal.processors.cache.CacheGroupContext.start(CacheGroupContext.java:937)
    at org.apache.ignite.internal.processors.cache.GridCacheProcessor.startCacheGroup(GridCacheProcessor.java:2251)
    at org.apache.ignite.internal.processors.cache.GridCacheProcessor.prepareCacheStart(GridCacheProcessor.java:2146)
    at org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager.processClientCacheStartRequests(CacheAffinitySharedManager.java:438)
    at org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager.processClientCachesChanges(CacheAffinitySharedManager.java:637)
    at org.apache.ignite.internal.processors.cache.GridCacheProcessor.processCustomExchangeTask(GridCacheProcessor.java:391)
    at org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$ExchangeWorker.processCustomTask(GridCachePartitionExchangeManager.java:2489)
    at org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$ExchangeWorker.body0(GridCachePartitionExchangeManager.java:2634)
    at org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$ExchangeWorker.body(GridCachePartitionExchangeManager.java:2553)
    at org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:120)
    at java.lang.Thread.run(Thread.java:748)