On 04/03/2013 11:20 PM, Jörg Schaible wrote:
Hi,
Xybek wrote:
On 04/03/2013 04:28 PM, Jörg Schaible wrote:
Hi,
Xybrek wrote:
Hello,
I'm getting this error when trying to "deserialize":
Cannot construct MyClass as it does not have a no-args constructor.
Looking at the docs, it means that Xtream is not running in enhanced
mode?
However, in the same JVM and using the same class the Google Gson
library can serialize and deserialize objects without problem:
MyClass c;
c = (MyClass) new Gson().fromJson(json, MyClass.class);
So why Xstream can't do to XML what Gson can do for JSON? Is this easy
to patch in the Xstream code or is this a limitation that is not easy to
get around with?
XStream will normally run always in enhanced mode. Which version of
XStream you're using, which Java version and vendor? Is it a special
environment (e.g. app server or applet)? How did you initialize XStream?
Hi Jorg,
I just did a simple:
XStream xstream = new XStream();
I thought you tried to process JSON? Did you actually read XStream's JSON
tutorial?
I'm using JDK 1.7 64-bit (from Oracle), just running a JUnit test.
Which version of XStream?
What makes me think is that why Gson can deserialize a no-args
constructor in the same JVM and same JUnit test
Can't say, because in XStream's ~1500 unit tests it does this more than
once.
Can you post the complete exception including stack trace?
- Jörg
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
Hi Jorg,
Yes, I did process JSON string but this is for the Gson library I use. I
was just asking why Google Gson library can serialize and deserialize
object instances in the same JVM and JUnit test where XStream fails to
do so, throwing exception that the class have no-args constructor.
BTW, I am running in the Google Appengine environment (v 1,7.5)
Also I have a question whether XStream can deal with Object graphs?
-Xybrek
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email