You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "HAOFENG DENG (Jira)" <ji...@apache.org> on 2020/02/05 08:14:00 UTC

[jira] [Updated] (IGNITE-12623) ClassCastException on Thin client when get cache value with List and Map

     [ https://issues.apache.org/jira/browse/IGNITE-12623?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

HAOFENG DENG updated IGNITE-12623:
----------------------------------
    Priority: Critical  (was: Major)

> ClassCastException on Thin client when get cache value with List and Map
> ------------------------------------------------------------------------
>
>                 Key: IGNITE-12623
>                 URL: https://issues.apache.org/jira/browse/IGNITE-12623
>             Project: Ignite
>          Issue Type: Bug
>          Components: cache, clients
>    Affects Versions: 2.7.6
>         Environment: Ubuntu
> Java 11
> Ignite 2.7.6
>            Reporter: HAOFENG DENG
>            Priority: Critical
>
> I use the thin java client
> I Create a ArrayList and put the Person object into it.
> {code:java}
> try (IgniteClient igniteClient = Ignition.startClient(new ClientConfiguration().setAddresses("127.0.0.1:10800"))) {
>     final ClientCache<String, List<Person>> demo = igniteClient.getOrCreateCache("demo");
>     final List<Person> personList = new java.util.ArrayList<>();
>     personList.add(new Person("apache", 100));
>     personList.add(new Person("Ignite", 13));
>     demo.put("test", personList);
> }
> {code}
> And when I take it out of the list
> {code:java}
> try (IgniteClient igniteClient = Ignition.startClient(new ClientConfiguration().setAddresses("127.0.0.1:10800"))) {
>     final ClientCache<String, List<Person>> demo = igniteClient.getOrCreateCache("demo");
>     final List<Person> personList = demo.get("test");
>     final Person person = personList.get(0);
> }{code}
>  
> I get the following exceptions:
> {code:java}
> java.lang.ClassCastException: class org.apache.ignite.internal.binary.BinaryObjectImpl cannot be cast to class com.peeandgee.Person (org.apache.ignite.internal.binary.BinaryObjectImpl and com.peeandgee.Person are in unnamed module of loader 'app')
> {code}
>  
> However, there is no exception if I modify the code as follows:
> {code:java}
> BinaryObject bo = (BinaryObject) map.get(0);
> Person person = bo.deserialize();
> {code}
>  
>  
> Same issue in Map [ClassCastException on thinClient in Apache Ignite|[https://stackoverflow.com/questions/59299316/classcastexception-on-thinclient-in-apache-ignite]]
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)