I use the thin java client.
I Create a ArrayList and put the Person object into it.
----------------------------------------------------------------------
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);
}
----------------------------------------------------------------------
And when I take it out of the list
----------------------------------------------------------------------
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);
}
----------------------------------------------------------------------
I get the following exceptions:
----------------------------------------------------------------------
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')
----------------------------------------------------------------------
However, there is no exception if I modify the code as follows:
----------------------------------------------------------------------
BinaryObject bo = (BinaryObject) map.get(0);
Person person = bo.deserialize();
----------------------------------------------------------------------
Same issue in Map [ClassCastException on thinClient in Apache
Ignite|https://stackoverflow.com/questions/59299316/classcastexception-on-thinclient-in-apache-ignite]
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/