在Google App Engine上,我在启动开发服务器后第一次查询数据存储区时收到InvocationTargetException

时间:2010-01-21 16:31:24

标签: google-app-engine

在Google App Engine上,每次启动开发服务器时,我都会收到多个java.lang.reflect.InvocationTargetException。我正在使用Spring MVC 3.0。

我的应用程序工作正常,但我觉得异常减慢了开发服务器的启动时间,我不确定实际服务器上是否也发生异常,并且当GAE启动时减慢启动时间新实例。

输出结果为:

 [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)

编辑:当我的索引页运行简单的SELECT数据存储区查询时,就会发生这种情况。但它仍然只在开发服务器启动后才发生。如果我刷新索引页面或执行其他查询,则不再发生异常。

以下是第一次运行时导致异常的查询。

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

1 个答案:

答案 0 :(得分:1)

实际上,我认为这是一个CAUGHT并处理了异常。如果你看这里:http://www.google.com/codesearch/p?hl=en#YXcrkXezIpQ/trunk/src/com/google/common/base/FinalizableReferenceQueue.java

你会看到仍然在第134行创建了queue。我会再做一些搜索,看看是否还有其他办法可以更好地处理这个问题,但我不知道是不是什么是明确导致你的缓慢。