You need to edit (or to create) a "datastore-indexes.xml" file in the
WEB-INF directory.
This file stores the index definition for your application.
Personal advice : do not rely on the automatic index definition that you
can see in the "datastore-indexes-auto.xml" (dir
WEB-INF/appengine-generated/)
In the "datastore-indexes.xml" file, add the definition for your index on
your 3 properties exactly as specified in your error message :
<datastore-index kind="Bid" ancestor="false" source="manual">
<property name="courseCode" direction="asc"/>
<property name="sectionCode" direction="asc"/>
<property name="amount" direction="desc"/>
</datastore-index>
Then deploy again.
On 31/10/10 16:21, "mark chen" <[email protected]> wrote:
>Hi,
>
>I am using JDO on GAE, and have been encountering this error. I
>googled the error, and most of the solutions were related to setting
>some properties in datastore-indexes.xml. However, I do not have this
>config file in my app as GAE has enables the Automatic index
>configuration. The piece of code which is giving me the error has been
>indicated, with the corresponding error message pasted below. Would
>appreciate any help. Thanks
>
>BidDAO.java
>//return a list of bids for a particular section
> public static List read(String courseCode, String sectionCode) {
> PersistenceManager pm = PMF.get().getPersistenceManager();
> String query = "select from " + Bid.class.getName()
> + " where courseCode == courseCodeParam && sectionCode
>== sectionCodeParam"
> + " parameters String courseCodeParam, String
>sectionCodeParam order by amount desc";
> List<Bid> bids = (List<Bid>)
>pm.newQuery(query).execute(courseCode, sectionCode);
>
> ERROR---> List<Bid> detachedBids = (List<Bid>)
>pm.detachCopyAll(bids);
>
> pm.close();
> if (detachedBids.size() == 0) {
> return null;
> }
> return detachedBids;
> }
>
>Uncaught exception from servlet
>com.google.appengine.api.datastore.DatastoreNeedIndexException: no
>matching index found.. <datastore-index kind="Bid"
>ancestor="false" source="manual">
> <property name="courseCode" direction="asc"/>
> <property name="sectionCode" direction="asc"/>
> <property name="amount" direction="desc"/>
> </datastore-index>
>
>
> at com.google.appengine.runtime.Request.process-
>f520ab98e5ed5cc2(Request.java)
> at
>com.google.appengine.api.datastore.DatastoreApiHelper.translateError(Datas
>toreApiHelper.java:
>42)
> at com.google.appengine.api.datastore.DatastoreApiHelper
>$1.convertException(DatastoreApiHelper.java:98)
> at
>com.google.appengine.api.utils.FutureWrapper.get(FutureWrapper.java:
>44)
> at
>com.google.appengine.api.utils.FutureWrapper.get(FutureWrapper.java:
>42)
> at
>com.google.appengine.api.datastore.FutureHelper.getInternal(FutureHelper.j
>ava:
>71)
> at
>com.google.appengine.api.datastore.FutureHelper.quietGet(FutureHelper.java
>:
>32)
> at
>com.google.appengine.api.datastore.QueryResultsSourceImpl.loadMoreEntities
>(QueryResultsSourceImpl.java:
>69)
> at
>com.google.appengine.api.datastore.QueryResultsSourceImpl.loadMoreEntities
>(QueryResultsSourceImpl.java:
>56)
> at
>com.google.appengine.api.datastore.QueryResultIteratorImpl.ensureLoaded(Qu
>eryResultIteratorImpl.java:
>156)
> at
>com.google.appengine.api.datastore.QueryResultIteratorImpl.hasNext(QueryRe
>sultIteratorImpl.java:
>65)
> at
>org.datanucleus.store.appengine.query.RuntimeExceptionWrappingIterator.has
>Next(RuntimeExceptionWrappingIterator.java:
>44)
> at
>org.datanucleus.store.appengine.query.LazyResult.listIterator(LazyResult.j
>ava:
>102)
> at
>org.datanucleus.store.appengine.query.StreamingQueryResult.iterator(Stream
>ingQueryResult.java:
>114)
> at
>org.datanucleus.jdo.JDOPersistenceManager.detachCopyAll(JDOPersistenceMana
>ger.java:
>1174)
>--->> at com.bios.DAO.BidDAO.read(BidDAO.java:46)
> at
>com.bios.controller.AddBidServlet.validateBidStatus(AddBidServlet.java:
>687)
> at org.apache.jsp.mainMenu_jsp._jspService(mainMenu_jsp.java:119)
> 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 org.mortbay.jetty.servlet.ServletHandler
>$CachedChain.doFilter(ServletHandler.java:1157)
> at org.mortbay.jetty.servlet.ServletHandler
>$CachedChain.doFilter(ServletHandler.java:1157)
> 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
>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 org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
> at
>com.google.net.rpc.impl.BlockingApplicationHandler.handleRequest(BlockingA
>pplicationHandler.java:
>24)
> at com.google.net.rpc.impl.RpcUtil.runRpcInApplication(RpcUtil.java:
>418)
> at com.google.net.rpc.impl.Server$RpcTask.runInContext(Server.java:
>572)
> at com.google.tracing.TraceContext$TraceContextRunnable
>$1.run(TraceContext.java:448)
> at com.google.tracing.TraceContext.runInContext(TraceContext.java:
>688)
> at com.google.tracing.TraceContext
>$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.ja
>va:
>326)
> at com.google.tracing.TraceContext
>$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:
>318)
> at com.google.tracing.TraceContext
>$TraceContextRunnable.run(TraceContext.java:446)
> at
>java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:
>1110)
> at java.util.concurrent.ThreadPoolExecutor
>$Worker.run(ThreadPoolExecutor.java:603)
> at java.lang.Thread.run(Thread.java:636)
>
>--
>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.
>
--
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.