You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by "diego.gutierrez" <di...@lucidworks.com> on 2018/01/09 18:08:36 UTC

ClassCastException using cache and continuous query

Hello,

I'm trying to upgrade Ignite from 1.7.0 to 2.3.0 and I'm getting this
exception:

java.lang.ClassCastException:
com.company.datastore.ignite.model.IgniteFetchItem cannot be cast to
com.company.datastore.ignite.model.IgniteFetchItem.

No other changes were made, just the ignite dependency upgrade.

More context: An ignite cache is used as a work queue, so some items are
added to the cache and some logic should be executed when a new item is
added, for that a local listener is set:

Consumer<Iterable&lt;CacheEntryEvent&lt;? extends String, ? extends
IgniteFetchItem>>> localChangeHandler = (evts) -> {
      for (CacheEntryEvent<? extends String, ? extends IgniteFetchItem> e :
evts) {
             IgniteFetchItem fi = e.getValue();
             ...
      }
this.continousQuery.setLocalListener(new
CacheEntryListener<>(localChangeHandler));


The problem happens in the call to *IgniteFetchItem fi = e.getValue();*

Also, the class *IgniteFetchItem* contains only serializable fields.



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

Re: ClassCastException using cache and continuous query

Posted by Alexey Popov <ta...@gmail.com>.
Hi Diego,

It seems that your error is related to different class Loaders being used. 

I don't have an idea why this happens but please try to clean your "work"
directory in Ignite home (IGNITE_HOME) after 1.8 -> 2.3 upgrade or set up a
new IGNITE_HOME.

Please share you node configs and IgniteFetchItem class if you still face
the issue.

Thank you,
Alexey



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