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

Reply via email to