gpt4 book ai didi

java - JDOFatalUserException : Illegal argument (on GAE J, 但不在开发系统上)

转载 作者:太空宇宙 更新时间:2023-11-04 07:56:39 24 4
gpt4 key购买 nike

我正在 Google App Engine/Java 上开发一个应用程序。在我的开发环境中,应用程序运行良好,数据存储和检索成功。但是,在上传到应用程序引擎时,我不断收到错误“javax.jdo.JDOFatalUserException:非法参数”。从堆栈跟踪来看,这似乎是在我调用 (List query.execute()).size() 时发生的。相关的堆栈跟踪是。

2012-11-22 23:34:08.512
[s~qalmadev1/1.363360558551053190].<stderr>: javax.jdo.JDOFatalUserException: Illegal argument

W 2012-11-22 23:34:08.516
[s~qalmadev1/1.363360558551053190].<stderr>: at org.datanucleus.api.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:488)

W 2012-11-22 23:34:08.516
[s~qalmadev1/1.363360558551053190].<stderr>: at org.datanucleus.api.jdo.JDOAdapter.getApiExceptionForNucleusException(JDOAdapter.java:1107)

W 2012-11-22 23:34:08.516
[s~qalmadev1/1.363360558551053190].<stderr>: at com.google.appengine.datanucleus.query.QueryExceptionWrappers$2.get(QueryExceptionWrappers.java:72)

W 2012-11-22 23:34:08.516
[s~qalmadev1/1.363360558551053190].<stderr>: at com.google.appengine.datanucleus.query.RuntimeExceptionWrappingIterator.hasNext(RuntimeExceptionWrappingIterator.java:103)

W 2012-11-22 23:34:08.516
[s~qalmadev1/1.363360558551053190].<stderr>: at com.google.appengine.datanucleus.query.LazyResult.resolveAll(LazyResult.java:120)

W 2012-11-22 23:34:08.516
[s~qalmadev1/1.363360558551053190].<stderr>: at com.google.appengine.datanucleus.query.LazyResult.size(LazyResult.java:115)

W 2012-11-22 23:34:08.516
[s~qalmadev1/1.363360558551053190].<stderr>: at com.google.appengine.datanucleus.query.StreamingQueryResult.size(StreamingQueryResult.java:151)

W 2012-11-22 23:34:08.516
[s~qalmadev1/1.363360558551053190].<stderr>: at com.xxx.xxx.appengine.server.CreateEventServlet.doPost(CreateEventServlet.java:115)

我的 CreateEventServlet 中的第 115 行是下面代码中的“if()”行

Query query = pm.newQuery("select from com.xxx.xxx.appengine.User "
+ "where key == :userid");
List<User> result = (List<User>) query.execute(userid);
if (result != null && result.size() > 0) { // Line 115
user = result.get(0);
USER_VALID = true;
}

最佳答案

发现问题了。

Query query = pm.newQuery("select from com.xxx. xxx.appengine.User "
+ "where key == :userid");

在查询中,“userid”指的是通过KeyFactory.keyToString()实现的字符串。使用 KeyFactory.stringToKey() 将字符串转换回键解决了该问题。

关于java - JDOFatalUserException : Illegal argument (on GAE J, 但不在开发系统上),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13521010/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com