Reputation: 874
I'm developing an application on Google App Engine/Java. On my development environment, the application works fine, with data stored and retrieved successfully. However, on upload to app engine, i keep getting the error "javax.jdo.JDOFatalUserException: Illegal argument". From the stack trace, this appears to occur when i call (List query.execute()).size(). The relevant stack trace is.
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)
Line 115 in my CreateEventServlet is the "if()" line in the code below
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;
}
Upvotes: 1
Views: 407
Reputation: 874
Found the problem.
Query query = pm.newQuery("select from com.xxx. xxx.appengine.User "
+ "where key == :userid");
In the query, "userid" referred to a String realized through KeyFactory.keyToString(). Converting the String back to a key using KeyFactory.stringToKey() solved the issue.
Upvotes: 1