Firstly, I call this to persiste a Coordinator object.
Coordinator coordinator, boolean active) {
Course course = new Course(id, courseName, coordinator, active);
PersistenceManager pm = PMF.get().getPersistenceManager();
try {
pm.makePersistent(course);
} finally {
pm.close();
}
Then I call this query for the object I persisted recently:
PersistenceManager pm = PMF.get().getPersistenceManager();
String query = "select from " + Coordinator.class.getName() + "
where googleAccount == '" + accName +"'";
List<Coordinator> coordinators = (List<Coordinator>)
pm.newQuery(query).execute();
if (coordinators.size()>0){
return coordinators.get(0);
} else {
return null;
}
For information, "Coordinator" object contains a field
"@Persistent(mappedBy="coordinator")
private List<Course> courses;"
Both Coordinator and Course are persistent objects defined by me.
Error occurs when I make that query. I check the indexing in admin
console. there's a Coordinator object there but this object does not
have the field "courses".
On Aug 1, 9:52 pm, Alfred Fuller <[email protected]>
wrote:
> What query are you running that produces this exception?
>
> On Sun, Aug 1, 2010 at 8:06 AM, Erencie <[email protected]> wrote:
> > I think someone has posted this before but the post is not written in
> > English so I don't understand.
>
> > I tested thoroughly in my local machine and there is no problem in
> > persisting one of my user objects. After I upload it to Google App
> > Engine, and do the same thing, the following errors occurs:
>
> > Uncaught exception from servlet
> > com.google.appengine.api.datastore.DatastoreNeedIndexException: no
> > matching index found.. <datastore-index kind="Course"
> > ancestor="true" source="manual">
> > <property name="courses_INTEGER_IDX" direction="asc"/>
> > </datastore-index>
>
> > at
> > com.google.appengine.runtime.Request.process-496d0292b582fcd8(Request.java)
> > at
>
> > com.google.appengine.api.datastore.DatastoreApiHelper.translateError(DatastoreApiHelper.java:
> > 40)
> > at
>
> > com.google.appengine.api.datastore.DatastoreApiHelper.makeSyncCall(DatastoreApiHelper.java:
> > 67)
> > at
>
> > com.google.appengine.api.datastore.PreparedQueryImpl.runQuery(PreparedQueryImpl.java:
> > 127)
> > at
>
> > com.google.appengine.api.datastore.PreparedQueryImpl.asIterator(PreparedQueryImpl.java:
> > 87)
> > at com.google.appengine.api.datastore.BasePreparedQuery
> > $1.iterator(BasePreparedQuery.java:26)
> > at
>
> > org.datanucleus.store.appengine.DatastoreElementContainerStoreSpecialization.getChildren(DatastoreElementContainerStoreSpecialization.java:
> > 105)
> > at
>
> > org.datanucleus.store.appengine.DatastoreFKListStore.listIterator(DatastoreFKListStore.java:
> > 48)
> > at
>
> > org.datanucleus.store.mapped.scostore.AbstractListStore.listIterator(AbstractListStore.java:
> > 84)
> > at
>
> > org.datanucleus.store.mapped.scostore.AbstractListStore.iterator(AbstractListStore.java:
> > 74)
> > at org.datanucleus.sco.backed.List.loadFromStore(List.java:241)
> > at org.datanucleus.sco.backed.List.iterator(List.java:507)
> > at
> > org.apache.jsp.coordinator.classes_jsp._jspService(classes_jsp.java:
> > 59)
> > at
> > org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
> > at
> > org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
> > 511)
> > at org.mortbay.jetty.servlet.ServletHandler
> > $CachedChain.doFilter(ServletHandler.java:1166)
> > at
>
> > com.google.apphosting.utils.servlet.ParseBlobUploadFilter.doFilter(ParseBlobUploadFilter.java:
> > 97)
> > at org.mortbay.jetty.servlet.ServletHandler
> > $CachedChain.doFilter(ServletHandler.java:1157)
> > at
>
> > com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter(SaveSessionFilter.java:
> > 35)
> > at org.mortbay.jetty.servlet.ServletHandler
> > $CachedChain.doFilter(ServletHandler.java:1157)
> > at
>
> > com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:
> > 43)
> > at org.mortbay.jetty.servlet.ServletHandler
> > $CachedChain.doFilter(ServletHandler.java:1157)
> > at
> > org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:
> > 388)
> > at
> > org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:
> > 216)
> > at
> > org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:
> > 182)
> > at
> > org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:
> > 765)
> > at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
> > 418)
> > at
>
> > com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:
> > 238)
> > at
> > org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
> > 152)
> > at org.mortbay.jetty.Server.handle(Server.java:326)
> > at
> > org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:
> > 542)
> > at org.mortbay.jetty.HttpConnection
> > $RequestHandler.headerComplete(HttpConnection.java:923)
> > at
>
> > com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable(RpcRequestParser.java:
> > 76)
> > at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
> > at
>
> > com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:
> > 135)
> > at
> > com.google.apphosting.runtime.JavaRuntime.handleRequest(JavaRuntime.java:
> > 250)
> > at com.google.apphosting.base.RuntimePb$EvaluationRuntime
> > $6.handleBlockingRequest(RuntimePb.java:7115)
> > at com.google.apphosting.base.RuntimePb$EvaluationRuntime
> > $6.handleBlockingRequest(RuntimePb.java:7113)
> > at
>
> > com.google.net.rpc.impl.BlockingApplicationHandler.handleRequest(BlockingApplicationHandler.java:
> > 24)
> > at com.google.net.rpc.impl.RpcUtil.runRpcInApplication(RpcUtil.java:
> > 398)
> > at com.google.net.rpc.impl.Server$2.run(Server.java:852)
> > at
> > com.google.tracing.LocalTraceSpanRunnable.run(LocalTraceSpanRunnable.java:
> > 56)
> > at
>
> > com.google.tracing.LocalTraceSpanBuilder.internalContinueSpan(LocalTraceSpanBuilder.java:
> > 576)
> > at com.google.net.rpc.impl.Server.startRpc(Server.java:807)
> > at com.google.net.rpc.impl.Server.processRequest(Server.java:369)
> > at
>
> > com.google.net.rpc.impl.ServerConnection.messageReceived(ServerConnection.java:
> > 442)
> > at
> > com.google.net.rpc.impl.RpcConnection.parseMessages(RpcConnection.java:
> > 319)
> > at
> > com.google.net.rpc.impl.RpcConnection.dataReceived(RpcConnection.java:
> > 290)
> > at com.google.net.async.Connection.handleReadEvent(Connection.java:
> > 474)
> > at
>
> > com.google.net.async.EventDispatcher.processNetworkEvents(EventDispatcher.java:
> > 831)
> > at
> > com.google.net.async.EventDispatcher.internalLoop(EventDispatcher.java:
> > 207)
> > at com.google.net.async.EventDispatcher.loop(EventDispatcher.java:
> > 103)
> > at
> > com.google.net.rpc.RpcService.runUntilServerShutdown(RpcService.java:
> > 251)
> > at com.google.apphosting.runtime.JavaRuntime
> > $RpcRunnable.run(JavaRuntime.java:417)
> > at java.lang.Thread.run(Unknown Source)
>
> > Unexpected exception from servlet:
> > com.google.appengine.api.datastore.DatastoreNeedIndexException: no
> > matching index found.. <datastore-index kind="Course"
> > ancestor="true" source="manual">
> > <property name="courses_INTEGER_IDX" direction="asc"/>
> > </datastore-index>
>
> > I have "datastore-indexes-auto.xml" in the application in my local
> > place. I'm not sure if the local datastore and this file has been
> > uploaded as well( I think not). Is there anyway I can configure the
> > indexing back to automatic on the appspot? I checked the admin console
> > and there's no way for me to do this.
>
> > Please help me on this. Thanks~
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google App Engine for Java" group.
> > To post to this group, send email to
> > [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<google-appengine-java%[email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-appengine-java?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en.