You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by "kevin.zheng" <zh...@huawei.com> on 2016/04/13 11:11:48 UTC

problem of using object as key in cache configurations

Dear all,I have a table which has no primary index (need to use two columns
as composite index).at the beginning, I use only one column as key to load
all the data into the cache. However, lots of records were ignored ( because
they have the same key).Then I create an java object to store two column
data as a key in cache configuration object. now I can load all the data
into the cache. However, when I test the query function. I got exceptions
info as follows?Exception in thread "main" class
org.apache.ignite.binary.BinaryObjectException: Failed resolve class for ID:
524756802	at
org.apache.ignite.internal.binary.BinaryContext.descriptorForTypeId(BinaryContext.java:499)
at
org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize(BinaryReaderExImpl.java:1443)
at
org.apache.ignite.internal.binary.BinaryObjectImpl.deserializeValue(BinaryObjectImpl.java:537)
at
org.apache.ignite.internal.binary.BinaryObjectImpl.value(BinaryObjectImpl.java:117)
at
org.apache.ignite.internal.processors.cache.CacheObjectContext.unwrapBinary(CacheObjectContext.java:280)
at
org.apache.ignite.internal.processors.cache.CacheObjectContext.unwrapBinaries(CacheObjectContext.java:228)
at
org.apache.ignite.internal.processors.cache.CacheObjectContext.unwrapBinariesIfNeeded(CacheObjectContext.java:165)
at
org.apache.ignite.internal.processors.cache.CacheObjectContext.unwrapBinariesIfNeeded(CacheObjectContext.java:154)
at
org.apache.ignite.internal.processors.cache.GridCacheContext.unwrapBinariesIfNeeded(GridCacheContext.java:1737)
at
org.apache.ignite.internal.processors.query.GridQueryCacheObjectsIterator.next(GridQueryCacheObjectsIterator.java:64)
at
org.apache.ignite.internal.processors.query.GridQueryCacheObjectsIterator.next(GridQueryCacheObjectsIterator.java:29)
at
org.apache.ignite.internal.processors.cache.QueryCursorImpl.getAll(QueryCursorImpl.java:73)
at
org.apache.ignite.examples.datagrid.store.auto.CacheAutoStoreExample_new.simpleQuery(CacheAutoStoreExample_new.java:544)
at
org.apache.ignite.examples.datagrid.store.auto.CacheAutoStoreExample_new.composedIndexDemo(CacheAutoStoreExample_new.java:246)
at
org.apache.ignite.examples.datagrid.store.auto.CacheAutoStoreExample_new.main(CacheAutoStoreExample_new.java:213)Caused
by: class org.apache.ignite.IgniteCheckedException: Failed to read class
name from file [id=524756802,
file=D:\ignite-master\work\marshaller\524756802.classname]	at
org.apache.ignite.internal.MarshallerContextImpl.className(MarshallerContextImpl.java:159)
at
org.apache.ignite.internal.MarshallerContextAdapter.getClass(MarshallerContextAdapter.java:174)
at
org.apache.ignite.internal.binary.BinaryContext.descriptorForTypeId(BinaryContext.java:483)
... 14 moreCaused by: java.io.FileNotFoundException:
D:\ignite-master\work\marshaller\524756802.classnameany idea what was
wrong?best regards,Kevin



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/problem-of-using-object-as-key-in-cache-configurations-tp4116.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

re: problem of using object as key in cache configurations

Posted by Zhengqingzheng <zh...@huawei.com>.
You are right Val, I did not read all the examples. Hopefully problem solved.

Cheers,
Kevin

-----邮件原件-----
发件人: vkulichenko [mailto:valentin.kulichenko@gmail.com] 
发送时间: 2016年4月14日 14:34
收件人: user@ignite.apache.org
主题: Re: problem of using object as key in cache configurations

We already have such examples. For example, CacheClientBinaryPutGetExample.
But I agree with Andrey that this message is very confusing. I will fix it shortly.

-Val



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/problem-of-using-object-as-key-in-cache-configurations-tp4116p4153.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: problem of using object as key in cache configurations

Posted by vkulichenko <va...@gmail.com>.
We already have such examples. For example, CacheClientBinaryPutGetExample.
But I agree with Andrey that this message is very confusing. I will fix it
shortly.

-Val



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/problem-of-using-object-as-key-in-cache-configurations-tp4116p4153.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: problem of using object as key in cache configurations

Posted by "kevin.zheng" <zh...@huawei.com>.
I think ignite should add example codes or document to tell the beginners. I
did search the forum but no results. but the error log message did give me
hint on where the problem might be occurred (in my case, the object
serialization part).



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/problem-of-using-object-as-key-in-cache-configurations-tp4116p4151.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: problem of using object as key in cache configurations

Posted by Andrey Kornev <an...@hotmail.com>.
Hello,A few teams at our company have independently run into this issue and ended up each wasting time figuring out how to fix it. And this is not the first time I see people asking this very same question here. I wonder if it is possible to improve diagnostics in Ignite code and log a more helpful message?ThanksAndrey
    _____________________________
From: kevin.zheng <zh...@huawei.com>
Sent: Wednesday, April 13, 2016 6:15 PM
Subject: Re: problem of using object as key in cache configurations
To:  <us...@ignite.apache.org>


Finally, I found the solution: I need to use  "cache.withKeepBinary()" to
call the query method when the cache Key is an object type.




--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/problem-of-using-object-as-key-in-cache-configurations-tp4116p4146.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.



  

Re: problem of using object as key in cache configurations

Posted by "kevin.zheng" <zh...@huawei.com>.
Finally, I found the solution: I need to use  "cache.withKeepBinary()" to
call the query method when the cache Key is an object type.




--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/problem-of-using-object-as-key-in-cache-configurations-tp4116p4146.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.