本文介绍了使用JPA的Google App Engine的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我正在使用Google App Engine使用JPA(java持久性API)创建应用程序。但是,当我试图获取存储的记录时,我得到空指针异常。 请帮帮我。 java.lang.NullPointerException com.google.appengine.datanucleus.query.QueryEntityPKFetchFieldManager.fetchIntField(QueryEntityPKFetchFieldManager.java:70) at org。 adanucleus.identity.IdentityUtils.getApplicationIdentityForResultSetRow(IdentityUtils.java:93) com.google.appengine.datanucleus.EntityUtils.entityToPojo(EntityUtils.java:1009) at com.google.appengine.datanucleus.query.DatastoreQuery $ 2.apply(DatastoreQuery.java:228) com.google.appengine.datanucleus.query.DatastoreQuery $ 2.apply(DatastoreQuery.java:225 )com /google.appengine中的。com.google.appengine.datanucleus.query.LazyResult上的 com.google.appengine.datanucleus.query.LazyResult.resolveNext(LazyResult.java:96) .resolveAll(LazyResult.java:121) com.google.appengine.datanucleus.query.LazyResult .size(LazyResult.java:115) com.google.appengine.datanucleus.query.StreamingQueryResult.size(StreamingQueryResult.java:151) at org.apache .jsp.AdminEvent_jsp._jspService(AdminEvent_jsp.java:68) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) at javax .servlet.http.HttpServlet.service(HttpServlet.java:717) org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) 在org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1166) com.google.apphosting.utils.servlet.ParseBlobUploadFilter.doFilter(ParseBlobUploadFilter.java:125) at org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157) com.google.apphosting.runtime.jetty.SaveSessionFilter。 doFilter(SaveSessionFilter.java:35) at org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157) com.google.apphosting.utils.servlet.JdbcMySqlConnectionCleanupFilter.doFilter(JdbcMySqlConnectionCleanupFilter.java:57) at org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157 ) com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43) at org.mortbay.jetty.servlet.ServletHandler $ CachedChain .doFilter(ServletHandler.java:1157) org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388) at org.mortbay.jetty .security.SecurityHandler.handle(SecurityHandler.java:216) org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) at org .mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418) at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:266) org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java: 326) org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) at org.mortbay.jetty.HttpConnection $ RequestHandler.headerComplete(HttpConnection。 java:923) com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable(RpcRequestParser.java:76) org.mortbay.jetty.HttpConnection。处理(HttpConnection.java:404) com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:146) com.google上的。 apphosting.runtime.JavaRuntime $ RequestRunnable.run(JavaRuntime.java:438) com.google.tracing.TraceContext $ TraceContextRunnable.runInContext(TraceContext.java:480) com.google.tracing.TraceContext $ TraceContextRunnable $ 1.run(TraceContext.java:487) com.google.tracing.TraceC ontext.runInContext(TraceContext.java:774) com.google.tracing.TraceContext $ DoInTraceContext.runInContext(TraceContext.java:751) com.google。 tracing.TraceContext $ AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:342) com.google.tracing.TraceContext $ AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:334) at com.google.tracing.TraceContext $ TraceContextRunnable.run(TraceContext.java:484) com.google.apphosting.runtime.ThreadGroupPool $ PoolEntry.run(ThreadGroupPool.java:251) 在java.lang.Thread.run(Thread.java:679)I am creating an application using JPA(java persistence API) using Google App Engine. But when i am trying to fetch record which are stored i am getting null pointer exception.Please help me out.java.lang.NullPointerExceptionat com.google.appengine.datanucleus.query.QueryEntityPKFetchFieldManager.fetchIntField(QueryEntityPKFetchFieldManager.java:70)at org.datanucleus.identity.IdentityUtils.getApplicationIdentityForResultSetRow(IdentityUtils.java:93)at com.google.appengine.datanucleus.EntityUtils.entityToPojo(EntityUtils.java:1009)at com.google.appengine.datanucleus.query.DatastoreQuery$2.apply(DatastoreQuery.java:228)at com.google.appengine.datanucleus.query.DatastoreQuery$2.apply(DatastoreQuery.java:225)at com.google.appengine.datanucleus.query.LazyResult.resolveNext(LazyResult.java:96)at com.google.appengine.datanucleus.query.LazyResult.resolveAll(LazyResult.java:121)at com.google.appengine.datanucleus.query.LazyResult.size(LazyResult.java:115)at com.google.appengine.datanucleus.query.StreamingQueryResult.size(StreamingQueryResult.java:151)at org.apache.jsp.AdminEvent_jsp._jspService(AdminEvent_jsp.java:68)at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)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.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:438)at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:480)at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:487)at com.google.tracing.TraceContext.runInContext(TraceContext.java:774)at com.google.tracing.TraceContext$DoInTraceContext.runInContext(TraceContext.java:751)at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:342)at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:334)at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:484)at com.google.apphosting.runtime.ThreadGroupPool$PoolEntry.run(ThreadGroupPool.java:251)at java.lang.Thread.run(Thread.java:679)推荐答案 2.apply(DatastoreQuery.java:228) com.google.appengine.datanucleus.query.DatastoreQuery2.apply(DatastoreQuery.java:228)at com.google.appengine.datanucleus.query.DatastoreQuery 2.apply(DatastoreQuery.java:225) com.google .appengine.datanucleus.query.LazyResult.resolveNext(LazyResult.java:96) com.google.appengine.datanucleus上的 .query.LazyResult.resolveAll(LazyResult.java:121) com.google.appengine.datanucleus.query.LazyResult.size(LazyResult.java:115) 在com.google.appengine.datanucleus.query.StreamingQueryResult.size(StreamingQueryResult.java:151) at org.apache.jsp.AdminEvent_jsp._jspService(AdminEvent_jsp.java:68) at org.apache.jasper.runtime.HttpJspBase.service(httpJspBase.java:97) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)br /> at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) at org.mortbay.jetty.servlet.ServletHandler2.apply(DatastoreQuery.java:225)at com.google.appengine.datanucleus.query.LazyResult.resolveNext(LazyResult.java:96)at com.google.appengine.datanucleus.query.LazyResult.resolveAll(LazyResult.java:121)at com.google.appengine.datanucleus.query.LazyResult.size(LazyResult.java:115)at com.google.appengine.datanucleus.query.StreamingQueryResult.size(StreamingQueryResult.java:151)at org.apache.jsp.AdminEvent_jsp._jspService(AdminEvent_jsp.java:68)at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)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) com.google.apphosting.utils.servlet.ParseBlobUploadFilter.doFilter(ParseBlobUploadFilter.java:125) org.mortbay.jetty.servlet.ServletHandlerCachedChain.doFilter(ServletHandler.java:1166)at com.google.apphosting.utils.servlet.ParseBlobUploadFilter.doFilter(ParseBlobUploadFilter.java:125)at org.mortbay.jetty.servlet.ServletHandler 这篇关于使用JPA的Google App Engine的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-04 18:56