You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Ilya Lantukh <il...@gridgain.com> on 2017/02/09 11:03:22 UTC
Re: restore Java Object from BinaryObject
Hi,
In your case you should disable compact footer. See
https://ignite.apache.org/releases/mobile/org/apache/ignite/configuration/BinaryConfiguration.html#isCompactFooter()
.
On Thu, Feb 9, 2017 at 1:28 PM, shawn.du <sh...@neulion.com.cn> wrote:
> Hi,
>
> I implement a cacheStore, this cachestore will persist a binaryObject
> into bytes and store in MySQL blob.
> Exceptions occurred when calling loadCache function:
> binaryObject.deserialize() will throw exceptions like "Cannot find
> metadata for object with compact footer: -1615140068"
> If I just put the binaryObject into the cache without deserialization ,
> it is ok. when i get it and use it, it will throw the exception again.
> How to fix it? Thanks in advance.
>
> public class BlobCacheStore extends CacheStoreAdapter<String, BinaryObject>
>
> {
>
> public void loadCache(IgniteBiInClosure<String, BinaryObject> clo, Object... args)
>
> {
> init();
> String sql = TEMPLATE_LOAD_SQL.replace(FAKE_TABLE_NAME, tableName);
> try (Connection connection = dataSource.getConnection();
> Statement statement = connection.createStatement();
> ResultSet rs = statement.executeQuery(sql))
> {
> while (rs.next())
> {
> String key = rs.getString("aKey");
> Blob blob = rs.getBlob("val");
> BinaryObject binaryObject = ignite.configuration().getMarshaller()
> .unmarshal(blob.getBytes(1, (int) blob.length()), getClass().getClassLoader());
> blob.free();
> ignite.cache(cacheName).put(key, binaryObject.deserialize()); //here will throw exceptions
> }
> }
> catch (Exception e)
> {
> throw new IgniteException(e);
> }
> }
>
> }
>
>
> Thanks
> Shawn
>
>
--
Best regards,
Ilya
Re: restore Java Object from BinaryObject
Posted by vkulichenko <va...@gmail.com>.
Shawn,
What's the actual issue after you disabled compact footer? Exception?
Incorrect behavior?
-Val
--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/restore-Java-Object-from-BinaryObject-tp10525p10556.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.