当我试图在appengine sdk中运行jdoexamples时,我遇到了一个错误。有一个变通方法(-Dapengine.user.timezone.impl=UTC),当我在eclipse上设置它时,它就可以工作。但当我用蚂蚁建造它的时候,我怎么能做同样的事情呢?以下是ant构建的错误输出:
runserver:
[java] java.lang.RuntimeException: Unable to restore the previous TimeZone
[java] at com.google.appengine.tools.development.DevAppServerImpl.restoreLocalTimeZone(DevAppServerImpl.java:228)
[java] at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:164)
[java] at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:164)
[java] at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:48)
[java] at com.google.appengine.tools.development.DevAppServerMain.<init>(DevAppServerMain.java:113)
[java] at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:89)
[java] Caused by: java.lang.NoSuchFieldException: defaultZoneTL
[java] at java.lang.Class.getDeclaredField(Class.java:1882)
[java] at com.google.appengine.tools.development.DevAppServerImpl.restoreLocalTimeZone(DevAppServerImpl.java:222)
[java] ... 5 more
构建成功总时间:4秒
另一个选项是使用java任务的sysproperty属性从build.xml文件中设置系统属性:
<java classname="test.Main" >
<sysproperty key="appengine.user.timezone.impl" value="UTC"/>
</java>