You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use messagePack.write(myCalss) and stored it to Redis.
Then I opened a terminal and by using Redis command "hget" I got a what I just stored in Redis. This is what I've got:
"\xac\xed\x00\x05ur\x00\x02[B\xac\xf3\x17\xf8\x06\bT\xe0\x02\x00\x00xp\x00\x00\x00A\x98\xaa8621161813\x00\xda\x00,mKHuEReeu7RYSxcdWFRMd+IE7FaskrViwxXdMdCUEKQ=\xc0\xc0\xc0\x00\x00"
Now I want to deserialization this by messagePack.read() to convert this to MyClass. This is my codes:
Object o = "\xac\xed\x00\x05ur\x00\x02[B\xac\xf3\x17\xf8\x06\bT\xe0\x02\x00\x00xp\x00\x00\x00A\x98\xaa8621161813\x00\xda\x00,mKHuEReeu7RYSxcdWFRMd+IE7FaskrViwxXdMdCUEKQ=\xc0\xc0\xc0\x00\x00";
MessagePack messagePack = new MessagePack();
MyClass myClass= messagePack.read((byte[]) o, MyClass.class);
System.out.println(myClass.toString());
Then I got an exception on this line " MyClass myClass= messagePack.read((byte[]) o, MyClass.class);". It said "java.lang.ClassCastException: java.lang.String cannot be cast to [B"
I copied the string "\xac...\x00" from the terminal because I have to write the query in Redis and convert this string to MyClass in codes.
Can anyone help me? Thank you so much!
The text was updated successfully, but these errors were encountered:
@wennicky Are you using msgpack-java 0.6 or earlier? If so, they're already deprecated and we strongly recommend latest 0.8 although it has incompatible APIs with 0.6.
Hi,
I use messagePack.write(myCalss) and stored it to Redis.
Then I opened a terminal and by using Redis command "hget" I got a what I just stored in Redis. This is what I've got:
"\xac\xed\x00\x05ur\x00\x02[B\xac\xf3\x17\xf8\x06\bT\xe0\x02\x00\x00xp\x00\x00\x00A\x98\xaa8621161813\x00\xda\x00,mKHuEReeu7RYSxcdWFRMd+IE7FaskrViwxXdMdCUEKQ=\xc0\xc0\xc0\x00\x00"
Now I want to deserialization this by messagePack.read() to convert this to MyClass. This is my codes:
Object o = "\xac\xed\x00\x05ur\x00\x02[B\xac\xf3\x17\xf8\x06\bT\xe0\x02\x00\x00xp\x00\x00\x00A\x98\xaa8621161813\x00\xda\x00,mKHuEReeu7RYSxcdWFRMd+IE7FaskrViwxXdMdCUEKQ=\xc0\xc0\xc0\x00\x00";
MessagePack messagePack = new MessagePack();
MyClass myClass= messagePack.read((byte[]) o, MyClass.class);
System.out.println(myClass.toString());
Then I got an exception on this line " MyClass myClass= messagePack.read((byte[]) o, MyClass.class);". It said "java.lang.ClassCastException: java.lang.String cannot be cast to [B"
I copied the string "\xac...\x00" from the terminal because I have to write the query in Redis and convert this string to MyClass in codes.
Can anyone help me? Thank you so much!
The text was updated successfully, but these errors were encountered: