You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by amit <ak...@gmail.com> on 2016/10/20 13:53:12 UTC

ClassCastException while fetching data from IgniteCache (with custom persistent store)

hi, i am getting ClassCastException while fetching data from IgniteCache.

below is the code fragment:
CacheConfiguration<SubscriberKey, Subscriber> cacheCfg 
            	= new CacheConfiguration<SubscriberKey,
Subscriber>(CACHE_NAME);
...

IgniteCache<SubscriberKey, Subscriber> cache =
ignite.getOrCreateCache(cacheCfg)
...
logger.debug("data: {}",cache.get(id));    // works fine, prints complete
row
Subscriber val = cache.get(id);      //throws ClassCastException

exception msg:
java.lang.ClassCastException: example.datagrid.model.Subscriber cannot be
cast to example.datagrid.model.Subscriber



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/ClassCastException-while-fetching-data-from-IgniteCache-with-custom-persistent-store-tp8377.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: ClassCastException while fetching data from IgniteCache (with custom persistent store)

Posted by Oleks K <ol...@gmail.com>.
I faced the same issue.
It appeared that Spring Boot is adding it's own classloader in "dev" mode.
Everything worked fine after I removed spring boot devtools jar from the
classpath.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: ClassCastException while fetching data from IgniteCache (with custom persistent store)

Posted by amit <ak...@gmail.com>.
Val,
Thanks for the quick reply.
Peer class loading is not configured. and cache is running under spring-boot
app.

you are right is a class-loader issue.





--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/ClassCastException-while-fetching-data-from-IgniteCache-with-custom-persistent-store-tp8377p8394.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: ClassCastException while fetching data from IgniteCache (with custom persistent store)

Posted by vkulichenko <va...@gmail.com>.
This looks like a class loading issue. Do you have peer class loading
enabled? Are you running within an application server or other environment
with multiple class loaders? I recommend to set a breakpoint inside the
get() method and check why there are classes loaded by different class
loaders.

-Val



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/ClassCastException-while-fetching-data-from-IgniteCache-with-custom-persistent-store-tp8377p8383.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.