As Ilya said, the underlying error is: > Caused by: java.lang.ClassCastException: > org.apache.ignite.internal.binary.BinaryObjectImpl cannot be cast to > com.model.Customer > at > com.jio.digitalapi.edif.util.operations.DataPreloadFromThirdPartyDB$1.apply(DataPreloadFromThirdPartyDB.java:36) > ~[ignite-util-1.0.1.jar:?]
As a guess — this is not tested — you’d need something like: IgniteCache<String, Object> cache = ignite.cache(cacheName); cache.loadCache((k,v) -> { String firstName; if (v instanceof BinaryObject) { BinaryObject vb = (BinaryObject)v; firstName = v.field(“firstName”); } else { firstName = v.getFirstName(); } return ("XXXX".equalsIgnoreCase(firstName)); }); Regards, Stephen > On 22 Jun 2021, at 12:21, Kamlesh Joshi <kamlesh.jo...@ril.com> wrote: > > Sending again to reflect in portal ! > > Thanks and Regards, > Kamlesh Joshi > > From: Kamlesh Joshi > Sent: 21 June 2021 17:25 > To: user@ignite.apache.org <mailto:user@ignite.apache.org> > Subject: Conditional data Preloading from third party persistence > > Hi Igniters, > > Am trying to preload certain data from third party persistence, but am > getting below error while doing that. I have been using below snippet for the > same. Can anyone guide, if am doing something wrong here. Any specific > changes needed to be done on data model side? > > IgniteCache<String, Customer> cache = ignite.cache(cacheName); > cache.loadCache(new IgniteBiPredicate<String, Customer>() { > @Override > public boolean apply(String k, Customer v) { > if ("XXXX".equalsIgnoreCase(v.getFirstName())) { > return true; > } else { > return false; > } > } > }); > > > Custom data model jars are already available on cluster class path. > > > org.apache.ignite.IgniteException: Failed to load cache: CustomerCache > at > org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2.execute(GridClosureProcessor.java:1858) > ~[ignite-core-2.7.6.jar:2.7.6] > at > org.apache.ignite.internal.processors.job.GridJobWorker$2.call(GridJobWorker.java:568) > ~[ignite-core-2.7.6.jar:2.7.6] > at > org.apache.ignite.internal.util.IgniteUtils.wrapThreadLoader(IgniteUtils.java:6820) > [ignite-core-2.7.6.jar:2.7.6] > at > org.apache.ignite.internal.processors.job.GridJobWorker.execute0(GridJobWorker.java:562) > [ignite-core-2.7.6.jar:2.7.6] > at > org.apache.ignite.internal.processors.job.GridJobWorker.body(GridJobWorker.java:491) > [ignite-core-2.7.6.jar:2.7.6] > at > org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:120) > [ignite-core-2.7.6.jar:2.7.6] > at > org.apache.ignite.internal.processors.job.GridJobProcessor.processJobExecuteRequest(GridJobProcessor.java:1125) > [ignite-core-2.7.6.jar:2.7.6] > at > org.apache.ignite.internal.processors.job.GridJobProcessor$JobExecutionListener.onMessage(GridJobProcessor.java:1923) > [ignite-core-2.7.6.jar:2.7.6] > at > org.apache.ignite.internal.managers.communication.GridIoManager.invokeListener(GridIoManager.java:1569) > [ignite-core-2.7.6.jar:2.7.6] > at > org.apache.ignite.internal.managers.communication.GridIoManager.processRegularMessage0(GridIoManager.java:1197) > [ignite-core-2.7.6.jar:2.7.6] > at > org.apache.ignite.internal.managers.communication.GridIoManager.access$4200(GridIoManager.java:127) > [ignite-core-2.7.6.jar:2.7.6] > at > org.apache.ignite.internal.managers.communication.GridIoManager$9.run(GridIoManager.java:1093) > [ignite-core-2.7.6.jar:2.7.6] > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) > [?:1.8.0_271] > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) > [?:1.8.0_271] > at java.lang.Thread.run(Thread.java:748) [?:1.8.0_271] > Caused by: org.apache.ignite.IgniteException: Failed to load cache: > CustomerCache > at > org.apache.ignite.internal.util.IgniteUtils.convertException(IgniteUtils.java:1029) > [ignite-core-2.7.6.jar:2.7.6] > at > org.apache.ignite.internal.processors.cache.GridCacheAdapter$LoadCacheJob.localExecute(GridCacheAdapter.java:5681) > ~[ignite-core-2.7.6.jar:2.7.6] > at > org.apache.ignite.internal.processors.cache.GridCacheAdapter$LoadCacheJobV2.localExecute(GridCacheAdapter.java:5725) > ~[ignite-core-2.7.6.jar:2.7.6] > at > org.apache.ignite.internal.processors.cache.GridCacheAdapter$TopologyVersionAwareJob.execute(GridCacheAdapter.java:6361) > ~[ignite-core-2.7.6.jar:2.7.6] > at > org.apache.ignite.compute.ComputeJobAdapter.call(ComputeJobAdapter.java:132) > ~[ignite-core-2.7.6.jar:2.7.6] > at > org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2.execute(GridClosureProcessor.java:1855) > ~[ignite-core-2.7.6.jar:2.7.6] > ... 14 more > Caused by: org.apache.ignite.IgniteCheckedException: Failed to load cache: > CustomerCache > at > org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter.loadCache(GridCacheStoreManagerAdapter.java:543) > ~[ignite-core-2.7.6.jar:2.7.6] > at > org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter.localLoadCache(GridDhtCacheAdapter.java:630) > ~[ignite-core-2.7.6.jar:2.7.6] > at > org.apache.ignite.internal.processors.cache.GridCacheProxyImpl.localLoadCache(GridCacheProxyImpl.java:222) > ~[ignite-core-2.7.6.jar:2.7.6] > at > org.apache.ignite.internal.processors.cache.GridCacheAdapter$LoadCacheJob.localExecute(GridCacheAdapter.java:5676) > ~[ignite-core-2.7.6.jar:2.7.6] > at > org.apache.ignite.internal.processors.cache.GridCacheAdapter$LoadCacheJobV2.localExecute(GridCacheAdapter.java:5725) > ~[ignite-core-2.7.6.jar:2.7.6] > at > org.apache.ignite.internal.processors.cache.GridCacheAdapter$TopologyVersionAwareJob.execute(GridCacheAdapter.java:6361) > ~[ignite-core-2.7.6.jar:2.7.6] > at > org.apache.ignite.compute.ComputeJobAdapter.call(ComputeJobAdapter.java:132) > ~[ignite-core-2.7.6.jar:2.7.6] > at > org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2.execute(GridClosureProcessor.java:1855) > ~[ignite-core-2.7.6.jar:2.7.6] > ... 14 more > Caused by: javax.cache.integration.CacheLoaderException: Failed to load > cache: CustomerCache > at > org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore.loadCache(CacheAbstractJdbcStore.java:819) > ~[ignite-core-2.7.6.jar:2.7.6] > at > org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore.loadCache(GridCacheWriteBehindStore.java:417) > ~[ignite-core-2.7.6.jar:2.7.6] > at > org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter.loadCache(GridCacheStoreManagerAdapter.java:520) > ~[ignite-core-2.7.6.jar:2.7.6] > at > org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter.localLoadCache(GridDhtCacheAdapter.java:630) > ~[ignite-core-2.7.6.jar:2.7.6] > at > org.apache.ignite.internal.processors.cache.GridCacheProxyImpl.localLoadCache(GridCacheProxyImpl.java:222) > ~[ignite-core-2.7.6.jar:2.7.6] > at > org.apache.ignite.internal.processors.cache.GridCacheAdapter$LoadCacheJob.localExecute(GridCacheAdapter.java:5676) > ~[ignite-core-2.7.6.jar:2.7.6] > at > org.apache.ignite.internal.processors.cache.GridCacheAdapter$LoadCacheJobV2.localExecute(GridCacheAdapter.java:5725) > ~[ignite-core-2.7.6.jar:2.7.6] > at > org.apache.ignite.internal.processors.cache.GridCacheAdapter$TopologyVersionAwareJob.execute(GridCacheAdapter.java:6361) > ~[ignite-core-2.7.6.jar:2.7.6] > at > org.apache.ignite.compute.ComputeJobAdapter.call(ComputeJobAdapter.java:132) > ~[ignite-core-2.7.6.jar:2.7.6] > at > org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2.execute(GridClosureProcessor.java:1855) > ~[ignite-core-2.7.6.jar:2.7.6] > ... 14 more > Caused by: java.lang.ClassCastException: > org.apache.ignite.internal.binary.BinaryObjectImpl cannot be cast to > com.model.Customer > at > com.jio.digitalapi.edif.util.operations.DataPreloadFromThirdPartyDB$1.apply(DataPreloadFromThirdPartyDB.java:36) > ~[ignite-util-1.0.1.jar:?] > at > org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter.loadEntry(GridDhtCacheAdapter.java:661) > ~[ignite-core-2.7.6.jar:2.7.6] > at > org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter.access$600(GridDhtCacheAdapter.java:104) > ~[ignite-core-2.7.6.jar:2.7.6] > at > org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter$5.apply(GridDhtCacheAdapter.java:634) > ~[ignite-core-2.7.6.jar:2.7.6] > at > org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter$5.apply(GridDhtCacheAdapter.java:630) > ~[ignite-core-2.7.6.jar:2.7.6] > at > org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter$3.apply(GridCacheStoreManagerAdapter.java:536) > ~[ignite-core-2.7.6.jar:2.7.6] > at > org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore$1.call(CacheAbstractJdbcStore.java:470) > ~[ignite-core-2.7.6.jar:2.7.6] > at > org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore$1.call(CacheAbstractJdbcStore.java:434) > ~[ignite-core-2.7.6.jar:2.7.6] > at java.util.concurrent.FutureTask.run(FutureTask.java:266) > ~[?:1.8.0_271] > ... 3 more > > > Thanks and Regards, > Kamlesh Joshi > > > "Confidentiality Warning: This message and any attachments are intended only > for the use of the intended recipient(s), are confidential and may be > privileged. If you are not the intended recipient, you are hereby notified > that any review, re-transmission, conversion to hard copy, copying, > circulation or other use of this message and any attachments is strictly > prohibited. If you are not the intended recipient, please notify the sender > immediately by return email and delete this message and any attachments from > your system. > > Virus Warning: Although the company has taken reasonable precautions to > ensure no viruses are present in this email. The company cannot accept > responsibility for any loss or damage arising from the use of this email or > attachment." >