[英]XStream and Google App Engine
嗨,我看到了Google App Engine的XStream
实现,但是我仍然得到了一个
“无法构造[class],因为它没有no-args构造函数”
@Test
public void testNoNoArgs() {
Car car = new Car(1, "Blue");
XStream xstream = new XStreamGae();
String s = xstream.toXML(car);
Car c = (Car) xstream.fromXML(s);
}
完整的堆栈跟踪在这里: http : //pastebin.com/TGF6N17W
我的应用程序中与XStream相关的依赖关系是:
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.2</version>
</dependency>
<dependency>
<groupId>xpp3</groupId>
<artifactId>xpp3_min</artifactId>
<version>1.1.4c</version>
</dependency>
<!-- XStreamGae Dependencies -->
<dependency>
<groupId>net.sf.kxml</groupId>
<artifactId>kxml2-min</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>xmlpull</groupId>
<artifactId>xmlpull</artifactId>
<version>1.1.3.1</version>
</dependency>
XStreamGae
类可以在这里找到:
http://www.wappworks.com/2011/11/11/using-xstream-with-google-app-engine/
是否有变通办法才能使此变通办法起作用?
显然,您的Car
类应具有无参数构造函数:
public Car(){}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.