When loading data, error
But once again run when the error has disappeared
[2019-04-18T16:47:46,396][INFO ][main][GridDiscoveryManager] Topology snapshot [ver=8, locNode=be992a42, servers=3, clients=1, state=ACTIVE, CPUs=16, offheap=4.7GB, heap=7.0GB]
[2019-04-18T16:47:46,485][ERROR][exchange-worker-#38%ignite-baodao%][GridCachePartitionExchangeManager] Failed to process custom exchange task: ClientCacheChangeDummyDiscoveryMessage [reqId=24b3fdc4-c1a2-428a-bd00-d654483b5ecf, cachesToClose=null, startCaches=[ty_zyb]]
org.apache.ignite.IgniteException: Spring application context resource is not injected.
at org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory.create(CacheJdbcPojoStoreFactory.java:171) ~[ignite-core-2.7.0.jar:2.7.0]
at org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory.create(CacheJdbcPojoStoreFactory.java:100) ~[ignite-core-2.7.0.jar:2.7.0]
at org.apache.ignite.internal.processors.cache.GridCacheProcessor.createCache(GridCacheProcessor.java:1558) ~[ignite-core-2.7.0.jar:2.7.0]
at org.apache.ignite.internal.processors.cache.GridCacheProcessor.prepareCacheStart(GridCacheProcessor.java:2146) ~[ignite-core-2.7.0.jar:2.7.0]
at org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager.processClientCacheStartRequests(CacheAffinitySharedManager.java:438) ~[ignite-core-2.7.0.jar:2.7.0]
at org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager.processClientCachesChanges(CacheAffinitySharedManager.java:637) ~[ignite-core-2.7.0.jar:2.7.0]
at org.apache.ignite.internal.processors.cache.GridCacheProcessor.processCustomExchangeTask(GridCacheProcessor.java:391) ~[ignite-core-2.7.0.jar:2.7.0]
at org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$ExchangeWorker.processCustomTask(GridCachePartitionExchangeManager.java:2475) [ignite-core-2.7.0.jar:2.7.0]
at org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$ExchangeWorker.body0(GridCachePartitionExchangeManager.java:2620) [ignite-core-2.7.0.jar:2.7.0]
at org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$ExchangeWorker.body(GridCachePartitionExchangeManager.java:2539) [ignite-core-2.7.0.jar:2.7.0]
at org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:120) [ignite-core-2.7.0.jar:2.7.0]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_144]
[2019-04-18T16:48:56,032][INFO ][ignite-update-notifier-timer][GridUpdateNotifier] Update status is not available.
Reference Code createCache
private GridCacheContext createCache(CacheConfiguration<?, ?> cfg,
CacheGroupContext grp,
@Nullable CachePluginManager pluginMgr,
DynamicCacheDescriptor desc,
AffinityTopologyVersion locStartTopVer,
CacheObjectContext cacheObjCtx,
boolean affNode,
boolean updatesAllowed,
boolean disabledAfterStart)
throws IgniteCheckedException {
assert cfg != null;
if (cfg.getCacheStoreFactory() instanceof GridCacheLoaderWriterStoreFactory) {
GridCacheLoaderWriterStoreFactory factory = (GridCacheLoaderWriterStoreFactory)cfg.getCacheStoreFactory();
prepare(cfg, factory.loaderFactory(), false);
prepare(cfg, factory.writerFactory(), false);
}
else
prepare(cfg, cfg.getCacheStoreFactory(), false);
CacheStore cfgStore = cfg.getCacheStoreFactory() != null ? cfg.getCacheStoreFactory().create() : null;
//此处省略后面N行
This code is to create a cache on the client, and will judge cacheStoreFactory
By debug code and found this one to the execution time, got the end of the path server has been created, and this path is the cacheStoreFactory
But my local client to delete the jdbcSource out, making it impossible to create a database based on cacheStore
This indicates that the client cache is also required with the same cache store server configuration
Check the code reveals that the error occurred in the
if (appCtx == null)
throw new IgniteException("Spring application context resource is not injected.");
This is not because not get bean, and appCtx there is no need to find where the value is initialized?
This value is obtained by calling a method to get
List<DynamicCacheDescriptor> startDescs = clientCachesToStart(msg.requestId(), msg.startRequests());
I found a strange phenomenon, the initial restart the cluster, and then run the program directly to the client is not just an error
There are three steps,
Step one: Start Cluster
Step 2: Create table using jdbc inserted data
Step 3: Create jdbcStore use function mode, data from the database load
If these three steps performed in the order is no problem, after the implementation, go to the second step on the error.
That after jdbcStore created, think about a client calls, you have to have jdbcStore initialization
There is such a need to analyze the different ways what the problem is?
To be continued