Couchbase
  • Why NoSQL?
  • Couchbase Server
  • Download
  • Resources
  • Careers
Home | Forums | Membase | Memcached Server 1.0.3

Deserialize Error

1 reply [Last post]
  • Login or register to post comments
Tue, 08/10/2010 - 10:18
douglasmaxwelltaylor
Offline
Joined: 08/10/2010
Groups: None

All,
Hello! I'm a rather new developer, so please bear with me if I'm totally off track. :)

I'm trying to setup the Membase memcached server to store serialized objects that I can then grab and deserialize. I am able to store and retrieve strings from the memcached server without any problems and I have compared these two strings to verify they are, in fact, the same.

However, when I try to deserialize one of these objects, I'm consistently receiving the same error--regardless of which object I try to deserialize. Deserialization works without a hitch if I serialize and deserialize without passing the object through memcached/Membase.

Here is some psudo-code:
-----------------------------------------------------------------------------------------------
Tile one = new Tile();
Tile oneBack;

Assert.IsTrue(client.Store(StoreMode.Set, one.tileId.ToString(), one.Serialize()), "Store procedure for ONE Failed");

string oneFromCache = client.Get(one.tileId.ToString());

Assert.NotNull(oneFromCache);

Assert.AreEqual(one.Serialize(), oneFromCache.ToString());

oneBack = ClassicSerializer.Deserialize(oneFromCache.ToString(), typeof(Tile)) as Tile;
-----------------------------------------------------------------------------------------------

The crash occurs on the last line here. This is the error:
System.InvalidOperationException : There is an error in XML document (1, 2).
----> System.InvalidOperationException : was not expected.

The only thing that seems off about this is the SINGLE ( ' ) quotes before and after the data. When I print this line to console, these appear as DOUBLE quotes ( " ).

Any assistance you can provide would be wonderful,

Cheers,
Doug

Top
Tue, 08/10/2010 - 10:35
Attila Kisko
Offline
Joined: 04/22/2010
Groups: None

I don't see why it should not work; the client does not modify the data you pass to it.

I.

Can you try the assert without the tostring?

// instead of Assert.AreEqual(one.Serialize(), oneFromCache.ToString());
Assert.AreEqual(one.Serialize(), oneFromCache);

II.

create a simple app, which does only the following:

client.Store(StoreMode.Set, one.tileId.ToString(), one.Serialize())

now telnet to the memcached servers's 11211 port

c:\> telnet HOST 11211

type this, then press enter:

[CODE]get PUT_THE_ITEM_ID_HERE[/CODE]

so, if one.tileId == "Tile_Id_1234", you'd type:

get Tile_Id_1234

(make sure you use the DefaultKeyTransformer, so they keys will remain as-is. remove the element from your config temporarly. [URL=http://wiki.github.com/enyim/EnyimMemcached/northscaleclient-configuration]See more here.[/URL])

now, you shluld see the key's data in the telnet window. does it have the aposthropes?

Top
  • Login or register to post comments
  • Login
  • Register

Company

  • About Us
  • Leadership
  • Customers
  • Partners
  • Contact Us

Product

  • Couchbase Server
  • Couchbase SDKs
  • Use Cases
  • Documentation
  • Forums

Open Source

  • Couchbase Project
  • Couchbase vs. CouchDB

Commercial

  • Subscriptions & Support
  • Training & Services

News

  • Blog
  • Newsletter
  • Press Releases
  • Buzz

Follow Us

    
  • Customer Login
  • Terms of Service
  • Privacy Policy
  • Trademark Policy
  • Site Map

© 2013 COUCHBASE All rights reserved.

Sign in to Couchbase Community

close
  • Create new account
  • Request new password
You are logging into the Forums, Wiki and Issue Tracker