views:

238

answers:

1

On Google App Engine I get multiple java.lang.reflect.InvocationTargetException everytime I start the development server. I am using Spring MVC 3.0.

My app works fine, but I feel like the exception slows down the startup time of the development server, and I'm not sure if the exception is also happening on the real server and slowing down the startup time when GAE starts a new instance.

The output is:

 [java] The server is running at http://localhost:8080/
 [java] Jan 21, 2010 4:16:52 PM com.google.appengine.repackaged.com.google.common.base.FinalizableReferenceQueue <init>
 [java] INFO: Failed to start reference finalizer thread. Reference cleanup will only occur when new references are created.
 [java] java.lang.reflect.InvocationTargetException
 [java]         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 [java]         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 [java]         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 [java]         at java.lang.reflect.Method.invoke(Method.java:597)
 [java]         at com.google.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java:100)
 [java]         at com.google.appengine.repackaged.com.google.common.base.FinalizableReferenceQueue.<init>(FinalizableReferenceQueue.java:124)
 [java]         at com.google.appengine.repackaged.com.google.common.labs.misc.InterningPools$WeakInterningPool.<clinit>(InterningPools.java:104)
 [java]         at com.google.appengine.repackaged.com.google.common.labs.misc.InterningPools.newWeakInterningPool(InterningPools.java:48)
 [java]         at com.google.appengine.repackaged.com.google.io.protocol.ProtocolSupport.<clinit>(ProtocolSupport.java:55)
 [java]         at com.google.apphosting.api.DatastorePb$Query.<init>(DatastorePb.java:1072)
 [java]         at com.google.apphosting.api.DatastorePb$Query$1.<init>(DatastorePb.java:2355)
 [java]         at com.google.apphosting.api.DatastorePb$Query.<clinit>(DatastorePb.java:2355)
 [java]         at com.google.appengine.api.datastore.QueryTranslator.convertToPb(QueryTranslator.java:28)
 [java]         at com.google.appengine.api.datastore.DatastoreServiceImpl$PreparedQueryImpl.convertToPb(DatastoreServiceImpl.java:382)
 [java]         at com.google.appengine.api.datastore.DatastoreServiceImpl$PreparedQueryImpl.runQuery(DatastoreServiceImpl.java:342)
 [java]         at com.google.appengine.api.datastore.DatastoreServiceImpl$PreparedQueryImpl.access$100(DatastoreServiceImpl.java:272)
 [java]         at com.google.appengine.api.datastore.DatastoreServiceImpl$PreparedQueryImpl$1.iterator(DatastoreServiceImpl.java:306)
 [java]         at org.datanucleus.store.appengine.query.RuntimeExceptionWrappingIterable.iterator(RuntimeExceptionWrappingIterable.java:42)
 [java]         at org.datanucleus.store.appengine.query.StreamingQueryResult.<init>(StreamingQueryResult.java:77)
 [java]         at org.datanucleus.store.appengine.query.DatastoreQuery.newStreamingQueryResultForEntities(DatastoreQuery.java:324)
 [java]         at org.datanucleus.store.appengine.query.DatastoreQuery.fulfillEntityQuery(DatastoreQuery.java:310)
 [java]         at org.datanucleus.store.appengine.query.DatastoreQuery.performExecute(DatastoreQuery.java:242)
 [java]         at org.datanucleus.store.appengine.query.JDOQLQuery.performExecute(JDOQLQuery.java:84)
 [java]         at org.datanucleus.store.query.Query.executeQuery(Query.java:1489)
 [java]         at org.datanucleus.store.query.Query.executeWithArray(Query.java:1371)
 [java]         at org.datanucleus.store.query.Query.execute(Query.java:1344)
 [java]         at org.datanucleus.jdo.JDOQuery.execute(JDOQuery.java:221)
 [java]         at app.controllers.RootController.Index(RootController.java:30)

EDIT: Turns out it happens when my index page runs a simple SELECT datastore query. But it still only happens right after the development server is started. If I refresh the index page or do other queries the exception no longer happens.

Here is the query that causes the exception the first time it is run.

Query q = pm.newQuery(Question.class);
List<Question> cards = (List<Question>) q.execute();
+1  A: 

Actually, I believe that is a CAUGHT and handled exception. If you look here: http://www.google.com/codesearch/p?hl=en#YXcrkXezIpQ/trunk/src/com/google/common/base/FinalizableReferenceQueue.java

you'll see that queue is still created on line 134. I'll do a bit more searching to see if there is any other way to better handle this, but I don't know if that is what is explicitly causing your slowness.

Mike Sherov
this seems to cover this topic as well: http://www.mail-archive.com/[email protected]/msg00983.htmlIt seems that it is correctly a caught and handled exception because GAE is not a threaded system.
Mike Sherov