Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id E5561200C16 for ; Thu, 9 Feb 2017 12:03:30 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id DF61B160B50; Thu, 9 Feb 2017 11:03:30 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 0D1C5160B4C for ; Thu, 9 Feb 2017 12:03:29 +0100 (CET) Received: (qmail 71308 invoked by uid 500); 9 Feb 2017 11:03:29 -0000 Mailing-List: contact user-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@ignite.apache.org Delivered-To: mailing list user@ignite.apache.org Received: (qmail 71297 invoked by uid 99); 9 Feb 2017 11:03:29 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Feb 2017 11:03:29 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 5E4EE180684 for ; Thu, 9 Feb 2017 11:03:28 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.48 X-Spam-Level: ** X-Spam-Status: No, score=2.48 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gridgain-com.20150623.gappssmtp.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id JU08ElI2zNsq for ; Thu, 9 Feb 2017 11:03:24 +0000 (UTC) Received: from mail-ua0-f174.google.com (mail-ua0-f174.google.com [209.85.217.174]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 0872F5FC61 for ; Thu, 9 Feb 2017 11:03:24 +0000 (UTC) Received: by mail-ua0-f174.google.com with SMTP id 96so50455uaq.3 for ; Thu, 09 Feb 2017 03:03:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gridgain-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=g+HzE7e0X09vVI9vBIyAUUCAmFTBiVh/Tbvjne9FdZc=; b=oCsQfdov9GzJKq7WIQAgAFXTumJMJjQpdU0QnXuTeRvKJ8VcHFa3xXk88GSqeo2//U R1CqzXkvry0IJtOPUyGTyeKSGXIGvOvAMkOJdKLlRhZHrGrvDh40h/EZICl/pYazfq4C 9d8Tk1e6ULvADMWloxkVMgSz0dRF+lUr+AsKntlxUkAmfTt294d0P5pe+njAKlcOHJOl hwYAOMRY78BBbILkGDYAMAtmW1sWZBn3fhjCmTZEVFD+/w+rJ06czPlsXis60e5R/3ko QGiAGSL7nLSuOvPN1DVMtUkjDbg6OEGBsODnjlE3kKK6NDrraJrFctHXQkX778av/QT8 QE5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=g+HzE7e0X09vVI9vBIyAUUCAmFTBiVh/Tbvjne9FdZc=; b=GgK6HrYd18FvHUOWWriPMEWgvyLpzvhFgBIDl7wqFkb+bCxIyZki5pInj6N0h1Owts VmtxJxL4tKWGUqYDhvuYmENBSOTAbZlMZyHWS3l75U1G8ZGp72uQuX6cUECZvLOHMNTx vE35+Sb6gDLkusTw6yKrMgQd4aCZRV37PlgIPCI/oi4yzawV6PLKN5L0zirF4dIcN8Vt cs3eJ+WtzG9kmXas/KdTPF0wjxsPCjbBnxL2oDcUtlEFIwloetjxPafRt7U7ZXFPuDSq OLjpZFfE4KaT2U7goJXvI9CnypYwvLKbLSFKM7LbIchWVCiO0UL+0FxhPU+SxZ4HzjxM LqAw== X-Gm-Message-State: AMke39lHO0GUtb6nw2kGrr2X/pEI4pnQttVTbvYvVGOpbNiSJ5azKYkfK7swt98yByH+l17eFAp3EI8oEEOviLsu X-Received: by 10.159.36.165 with SMTP id 34mr1323054uar.48.1486638202685; Thu, 09 Feb 2017 03:03:22 -0800 (PST) MIME-Version: 1.0 Received: by 10.103.108.71 with HTTP; Thu, 9 Feb 2017 03:03:22 -0800 (PST) In-Reply-To: <5E64915B-EB0F-48B7-A937-4CDCD30936F3@neulion.com.cn> References: <5E64915B-EB0F-48B7-A937-4CDCD30936F3@neulion.com.cn> From: Ilya Lantukh Date: Thu, 9 Feb 2017 14:03:22 +0300 Message-ID: Subject: Re: restore Java Object from BinaryObject To: user@ignite.apache.org Content-Type: multipart/alternative; boundary=001a113cf800fb27e9054816ed70 archived-at: Thu, 09 Feb 2017 11:03:31 -0000 --001a113cf800fb27e9054816ed70 Content-Type: text/plain; charset=UTF-8 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 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 > > { > > public void loadCache(IgniteBiInClosure 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 --001a113cf800fb27e9054816ed70 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

On Thu, Feb 9, 2017 at 1:28 PM, shawn.du = <shawn.du@neulion.com.cn> wrote:
=20
Hi,

I implement a cacheStore, this cachestore will persist a binaryObject into bytes= and store in MySQL blob.=C2=A0
Exceptions occurred when c= alling loadCache function:
binaryObject.deserialize() will throw = exceptions like "Cannot find metadata for object with compact footer: = -1615140068"
If =C2=A0I just= put the binaryObject=C2=A0into the = cache=C2=A0without deserialization ,= it is ok. =C2=A0when i get it and use it, it will throw the exception agai= n.
How to fix it? Thanks in advance.

<= div>
public cl=
ass BlobCacheStore extends Cach=
eStoreAdapter<String, BinaryObject&=
gt;
{
   public void loadCache(IgniteBiInClosure<String, BinaryObject> clo, Object... args)
 =
 {
init();
String sql =3D TEMPLATE_LOAD_SQL.replace(FAKE_TABLE_NAME= , tableName);
try (Connec= tion connection =3D dataSource.getConn= ection();
Statement statement =3D connection.createStatement();
= ResultSet rs =3D statement.executeQuery(sql))
{
= while (rs.next())
{
= String key =3D rs.getString("a= Key");
Blob blob =3D rs.getBlob("val");
BinaryObject binaryObje= ct =3D ignite.configuration().get= Marshaller()
.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 IgniteExcep= tion(e);
}
}
}
=20
=20

Thanks
Shawn




--
Best regar= ds,
Ilya
--001a113cf800fb27e9054816ed70--