Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-12623

ClassCastException on Thin client when get cache value with List and Map

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Duplicate
    • 2.7.5, 2.7.6
    • None
    • cache, clients
    • None
    • Ubuntu

      Java 11

      Ignite 2.7.6

    • Deplicate with IGNITE-12468.
    • Docs Required, Release Notes Required

    Description

      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]

       

       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              PereTang HAOFENG DENG
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: