0

我正在为我的 GWT(Java) 应用程序使用 Objectify。

我收到错误消息(下面给出了堆栈跟踪)。

你能建议这个异常的原因是什么吗?

我正在使用 Objectify(V 4 - objectify-4.0b1.jar).

java.lang.NullPointerException
at com.googlecode.objectify.impl.CacheControlImpl.getExpirySeconds(CacheControlImpl.java:25)
at com.googlecode.objectify.cache.EntityMemcache.getAll(EntityMemcache.java:207)
at com.googlecode.objectify.cache.CachingAsyncDatastoreService.get(CachingAsyncDatastoreService.java:253)
at com.googlecode.objectify.impl.engine.LoadEngine$Round.fetchPending(LoadEngine.java:172)
at com.googlecode.objectify.impl.engine.LoadEngine$Round.execute(LoadEngine.java:118)
at com.googlecode.objectify.impl.engine.LoadEngine.execute(LoadEngine.java:258)
at com.googlecode.objectify.impl.translate.LoadContext.done(LoadContext.java:53)
at com.googlecode.objectify.impl.engine.LoadEngine$Round$2.postExecuteHook(LoadEngine.java:147)
at com.googlecode.objectify.util.ResultCache.now(ResultCache.java:33)
at com.googlecode.objectify.impl.engine.LoadEngine$Round$1.nowUncached(LoadEngine.java:75)
at com.googlecode.objectify.util.ResultCache.now(ResultCache.java:30)
at com.googlecode.objectify.impl.ref.StdRef.get(StdRef.java:57)
at com.googlecode.objectify.impl.cmd.QueryImpl$3.translate(QueryImpl.java:382)
at com.googlecode.objectify.impl.cmd.QueryImpl$3.translate(QueryImpl.java:379)
at com.googlecode.objectify.util.TranslatingQueryResultIterable$1.translate(TranslatingQueryResultIterable.java:31)
at com.googlecode.objectify.util.TranslatingIterator.next(TranslatingIterator.java:35)
at com.l3.rnlgpc.server.DAO.CaseDAO.getCases(CaseDAO.java:189)
at com.l3.rnlgpc.server.manager.CaseManager.getCases(CaseManager.java:52)
at com.l3.rnlgpc.server.manager.ExportManager.export(ExportManager.java:49)
at com.l3.rnlgpc.server.servlet.export.ExportCaseToCSV.doGet(ExportCaseToCSV.java:49)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
at com.googlecode.objectify.cache.AsyncCacheFilter.doFilter(AsyncCacheFilter.java:59)
at com.googlecode.objectify.ObjectifyFilter.doFilter(ObjectifyFilter.java:49)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.apphosting.utils.servlet.ParseBlobUploadFilter.doFilter(ParseBlobUploadFilter.java:125)
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.JdbcMySqlConnectionCleanupFilter.doFilter(JdbcMySqlConnectionCleanupFilter.java:57)
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:266)
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:146)
at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.run(JavaRuntime.java:439)
at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:483)
at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:490)
at com.google.tracing.TraceContext.runInContext(TraceContext.java:777)
at com.google.tracing.TraceContext$DoInTraceContext.runInContext(TraceContext.java:754)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:345)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:337)
at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:487)
at com.google.apphosting.runtime.ThreadGroupPool$PoolEntry.run(ThreadGroupPool.java:251)
at java.lang.Thread.run(Thread.java:722)
4

1 回答 1

1

这是基于此链接的 objectfy 上的错误。

这是一个错误 - 很快就会修复。对于那个很抱歉。杰夫

要解决这个问题,您需要注册模型,详见此处

使用 Objectify 4,我编写了这行代码:

MyModel model = ofy.load().type(MyModel.class).id(42).get();

只是忘记注册 MyModel 了

ObjectifyService.register(MyModel.class); Objectify 3 曾经抛出一个异常,如“Class MyModel 尚未注册”或类似的东西,但 Objectify 4 抛出 NullPointerException。

于 2013-06-28T11:56:46.747 回答