I'm doing the "Getting Started" tutorial for the Google Web Toolkit
with App Engine, called "StockWatcher". This tutorial right here:
http://code.google.com/webtoolkit/doc/latest/tutorial/appengine.html



I finished writing the whole code, and deployed to GAE. But got an
error and found this DatastoreNeedIndexException on the log:



javax.servlet.ServletContext log: Exception while dispatching incoming
RPC call com.google.gwt.user.server.rpc.UnexpectedException: Service
method 'public abstract java.lang.String[]
com.google.gwt.sample.stockwatcher.client.StockService.getStocks()
throws com.google.gwt.sample.stockwatcher.client.NotLoggedInException'
threw an unexpected exception:
com.google.appengine.api.datastore.DatastoreNeedIndexException: no
matching index found.. <datastore-index kind="Stock" ancestor="false"
source="manual"> <property name="user" direction="asc"/> <property
name="createDate" direction="asc"/> </datastore-index>
The culprit is this method:



public String[] getStocks() throws NotLoggedInException {
checkLoggedIn();
PersistenceManager pm = getPersistenceManager();
List<String> symbols = new ArrayList<String>();
try {
Query q = pm.newQuery(Stock.class, "user == u");
q.declareParameters("com.google.appengine.api.users.User u");
q.setOrdering("createDate");
List<Stock> stocks = (List<Stock>) q.execute(getUser());
for (Stock stock : stocks) {
symbols.add(stock.getSymbol());
}
} finally {
pm.close();
}
return (String[]) symbols.toArray(new String[0]);
}

I don't understand what's wrong. Why is the index not matching and how
could I fix it? Is the tutorial wrong or did I screw up somewhere?


If it helps, here's the deployed app:
http://vib-test-01.appspot.com/

and here's the full source code if anyone cares:
https://github.com/vibrunazo/StockWatcher



Thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" 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?hl=en.

Reply via email to