问题
Today i introduced some new fields into my data model and pushed it online and i started seeing this exception. Does anyone have an idea when this happens?
org.datanucleus.ObjectManagerImpl preCommit: java.lang.NullPointerException
E 2013-04-18 12:45:09.321
X.servlet.util.GAELogger logError: javax.jdo.JDOException: Unexpected error during precommit
at org.datanucleus.api.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:566)
at org.datanucleus.api.jdo.JDOTransaction.commit(JDOTransaction.java:163)
at X.db.dao.migrator.UserDataMigrator.migrate(UserDataMigrator.java:57)
at X.db.dao.user.UserDataDAO.getUserDataByKey(UserDataDAO.java:84)
at X.db.dao.user.UserDataDAO.getUserByEmailId(UserDataDAO.java:114)
at X.servlet.authenticate.Signin.doPost(Signin.java:65)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
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 X.filter.GuestFilter.doFilter(GuestFilter.java:39)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at X.filter.DatastoreCapabilityFilter.doFilter(DatastoreCapabilityFilter.java:44)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at X.filter.FileFilter.doFilter(FileFilter.java:55)
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: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:722)
NestedThrowablesStackTrace:
java.lang.NullPointerException
at com.google.appengine.datanucleus.scostore.FKListStore.getIndexPropertyName(FKListStore.java:965)
at com.google.appengine.datanucleus.scostore.FKListStore.getFilterPredicates(FKListStore.java:940)
at com.google.appengine.datanucleus.scostore.FKListStore.listIterator(FKListStore.java:383)
at com.google.appengine.datanucleus.scostore.FKListStore.listIterator(FKListStore.java:349)
at com.google.appengine.datanucleus.scostore.FKListStore.iterator(FKListStore.java:342)
at org.datanucleus.store.types.sco.backed.List.loadFromStore(List.java:304)
at org.datanucleus.store.types.sco.backed.List.load(List.java:277)
at org.datanucleus.state.JDOStateManager.loadUnloadedFields(JDOStateManager.java:1299)
at org.datanucleus.state.JDOStateManager.runReachability(JDOStateManager.java:2266)
at org.datanucleus.store.fieldmanager.ReachabilityFieldManager.processPersistable(ReachabilityFieldManager.java:69)
at org.datanucleus.store.fieldmanager.ReachabilityFieldManager.storeObjectField(ReachabilityFieldManager.java:120)
at org.datanucleus.state.AbstractStateManager.providedObjectField(AbstractStateManager.java:1447)
at X.db.model.user.UserDTO.jdoProvideField(UserDTO.java)
at X.db.model.user.UserDTO.jdoProvideFields(UserDTO.java)
at org.datanucleus.state.AbstractStateManager.provideFields(AbstractStateManager.java:1515)
at org.datanucleus.state.JDOStateManager.runReachability(JDOStateManager.java:2281)
at org.datanucleus.ObjectManagerImpl.performReachabilityAtCommit(ObjectManagerImpl.java:4324)
at org.datanucleus.ObjectManagerImpl.preCommit(ObjectManagerImpl.java:4149)
at org.datanucleus.ObjectManagerImpl.transactionPreCommit(ObjectManagerImpl.java:428)
at org.datanucleus.TransactionImpl.internalPreCommit(TransactionImpl.java:398)
at org.datanucleus.TransactionImpl.commit(TransactionImpl.java:287)
at org.datanucleus.api.jdo.JDOTransaction.commit(JDOTransaction.java:96)
at X.db.dao.migrator.UserDataMigrator.migrate(UserDataMigrator.java:57)
at X.db.dao.user.UserDataDAO.getUserDataByKey(UserDataDAO.java:84)
at X.db.dao.user.UserDataDAO.getUserByEmailId(UserDataDAO.java:114)
at X.servlet.authenticate.Signin.doPost(Signin.java:65)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
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 X.filter.GuestFilter.doFilter(GuestFilter.java:39)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at X.filter.DatastoreCapabilityFilter.doFilter(DatastoreCapabilityFilter.java:44)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at X.filter.FileFilter.doFilter(FileFilter.java:55)
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: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:722)
E 2013-04-18 12:45:10.453
X.servlet.util.GAELogger logError: java.lang.NullPointerException
at com.google.appengine.datanucleus.scostore.FKListStore.getIndexPropertyName(FKListStore.java:965)
at com.google.appengine.datanucleus.scostore.FKListStore.getFilterPredicates(FKListStore.java:940)
at com.google.appengine.datanucleus.scostore.FKListStore.listIterator(FKListStore.java:383)
at com.google.appengine.datanucleus.scostore.FKListStore.listIterator(FKListStore.java:349)
at com.google.appengine.datanucleus.scostore.FKListStore.iterator(FKListStore.java:342)
at org.datanucleus.store.types.sco.backed.List.loadFromStore(List.java:304)
at org.datanucleus.store.types.sco.backed.List.writeReplace(List.java:1181)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at java.io.ObjectStreamClass.invokeWriteReplace(ObjectStreamClass.java:1049)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1148)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1545)
at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:455)
at X.db.model.user.PersonProfileDTO.writeObject(PersonProfileDTO.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:962)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1497)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1433)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1191)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:363)
at java.util.ArrayList.writeObject(ArrayList.java:710)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:962)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1497)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1433)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1191)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1545)
at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:455)
at X.db.model.user.UserDTO.writeObject(UserDTO.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:962)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1497)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1433)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1191)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:363)
at com.google.appengine.api.memcache.MemcacheSerialization.serialize(MemcacheSerialization.java:248)
at com.google.appengine.api.memcache.AsyncMemcacheServiceImpl.serializeValue(AsyncMemcacheServiceImpl.java:276)
at com.google.appengine.api.memcache.AsyncMemcacheServiceImpl.doPut(AsyncMemcacheServiceImpl.java:413)
at com.google.appengine.api.memcache.AsyncMemcacheServiceImpl.put(AsyncMemcacheServiceImpl.java:465)
at com.google.appengine.api.memcache.MemcacheServiceImpl.put(MemcacheServiceImpl.java:69)
at com.google.appengine.api.memcache.jsr107cache.GCache.put(Unknown Source)
at X.db.cache.CacheService.putUser(CacheService.java:92)
at X.db.dao.user.UserDataDAO.getUserDataByKey(UserDataDAO.java:90)
at X.db.dao.user.UserDataDAO.getUserByEmailId(UserDataDAO.java:114)
at X.servlet.authenticate.Signin.doPost(Signin.java:65)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
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 X.filter.GuestFilter.doFilter(GuestFilter.java:39)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at X.filter.DatastoreCapabilityFilter.doFilter(DatastoreCapabilityFilter.java:44)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at X.filter.FileFilter.doFilter(FileFilter.java:55)
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: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:722)
To give an overview of what i did: I had a class A
in which i had
@Persistent
@Element(dependent = "true")
@Order(extensions = @Extension(vendorName = "datanucleus", key = "list-ordering", value = "index ASC"))
private List<B> profiles;
Now in B i added:
@Persistent
@Element(dependent = "true")
private List<C> customSections;
C internally has:
@Persistent
@Element(dependent = "true")
@Order(extensions = @Extension(vendorName = "datanucleus", key = "list-ordering", value = "index ASC"))
private List<D> entries;
And D has:
@Persistent
private Integer index;
B also had:
@Persistent
@Element(dependent = "true")
@Order(extensions = @Extension(vendorName = "datanucleus", key = "list-ordering", value = "index ASC"))
private List<E> configurations;
To E i added:
@Persistent
@Element(dependent = "true")
@Order(extensions = @Extension(vendorName = "datanucleus", key = "list-ordering", value = "index ASC"))
private List<F> sections;
F internally has:
@Persistent
private Integer index;
and I had a List field which im now setting to null.
回答1:
Ok so i found the problem to be that there was no index on customSections. So it should have been:
@Persistent
@Element(dependent = "true")
@Order(extensions = @Extension(vendorName = "datanucleus", key = "list-ordering", value = "index ASC"))
private List<C> customSections;
Hope this helps someone :)
Code on line 968 seems to be related.
回答2:
We came across the same issue while upgrading versions of our Google App Engine Java project. The old data would not load properly because of no indexes. Once the indexes were created everything starting working.
来源:https://stackoverflow.com/questions/16096928/javax-jdo-jdoexception-unexpected-error-during-precommit