[ 
https://issues.apache.org/jira/browse/IGNITE-12468?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17029867#comment-17029867
 ] 

Aleksey Plekhanov commented on IGNITE-12468:
--------------------------------------------

[~Pavlukhin], I've also noticed this. And found one more bug: thin client 
generates wrong {{typeId}} for system types. This is caused by 
{{ClientMarshallerContext}} implementation, which always returns {{false}} for 
{{isSystemType}} method. These leads to typeId duplication for the same class 
and assertions when trying to get object by thick client. Reproducer:
{code:java}
thinClient.cache(DEFAULT_CACHE_NAME).put(1, CacheAtomicityMode.ATOMIC);
thickClient.cache(DEFAULT_CACHE_NAME).get(1);
{code}
If we put to cache value of the same type from thick client before get there is 
no assertion anymore, but typeId is still duplicated. And there is another 
issue, different marshallers can be used to marshal the same class for thin and 
thick clients, wrong class descriptor is returned for class name and there is 
assertion again. Reproducer:
{code:java}
thickClient.cache(DEFAULT_CACHE_NAME).put(3, Collections.emptyList());
thinClient.cache(DEFAULT_CACHE_NAME).put(2, Collections.emptyList());
thickClient.cache(DEFAULT_CACHE_NAME).get(2);
{code}
I will file a ticket shortly. 

> ClassCastException on thinClient in Apache Ignite
> -------------------------------------------------
>
>                 Key: IGNITE-12468
>                 URL: https://issues.apache.org/jira/browse/IGNITE-12468
>             Project: Ignite
>          Issue Type: Bug
>          Components: binary, clients, thin client
>    Affects Versions: 2.6
>            Reporter: LEE PYUNG BEOM
>            Assignee: Aleksey Plekhanov
>            Priority: Major
>
>  
> {code:java}
>     ClientConfiguration cfg = new 
> ClientConfiguration().setAddresses("127.0.0.1:10800");
>     try (IgniteClient igniteClient = Ignition.startClient(cfg)) {
>         System.out.println(">>> Thin client put-get example started.");
>         final String CACHE_NAME = "put-get-example";
>         ClientCache<Integer, Object> cache = 
> igniteClient.getOrCreateCache(CACHE_NAME);
>         Person p = new Person();
>         //put
>         HashMap<Integer, Person> hm = new HashMap<Integer, Person>();
>         hm.put(1, p);
>         cache.put(1, hm);
>         //get
>         HashMap<Integer, Person> map = (HashMap<Integer, Person>)cache.get(1);
>         Person p2 = map.get(1);
>         System.out.format(">>> Loaded [%s] from the cache.\n",p2);
>     }
>     catch (ClientException e) {
>         System.err.println(e.getMessage());
>         e.printStackTrace();
>     }
>     catch (Exception e) {
>         System.err.format("Unexpected failure: %s\n", e);
>         e.printStackTrace();
>     }
> {code}
>  
> I use the thin client of apache-ignite.
> I Create a hashmap and put the Person 
> class(org.apache.ignite.examples.model.Person) object into it.
> And when I take it out of the hashmap, I get the following exceptions:
>  
> {code:java}
> > java.lang.ClassCastException:
> > org.apache.enite.internal.binary.BinaryObjectImpl cannot be cast to
> > org.apache.engite.examples.model.Person.
> {code}
> An exception is given in the code below.
>  
> {code:java}
> Person p2 = map.get(1);
> {code}
>  
> However, there is no exception if I modify the code as follows:
>  
> {code:java}
> BinaryObject bo = (BinaryObject) map.get(1);
> Person p2 = bo.deserialize();
> {code}
> I don't think that's necessary. Is there another solution?
>  



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

Reply via email to