I have a User class which inherits from a Page class. In a transaction I wish to load a User entity by ID (obtained from a different entity), but I get a LoadException caused by an UnsupportedOperationException. I'm using objectify 4.0-rc2.
User user = MyObjectifyService.ofy().load().type(User.class).id(info.user).now();
The exception is:
com.googlecode.objectify.LoadException: Error loading Page(5629499534213120): null
at com.googlecode.objectify.impl.Transmog.load(Transmog.java:76)
at com.googlecode.objectify.impl.ConcreteEntityMetadata.load(ConcreteEntityMetadata.java:121)
at com.googlecode.objectify.impl.PolymorphicEntityMetadata.load(PolymorphicEntityMetadata.java:164)
at com.googlecode.objectify.impl.LoadEngine.load(LoadEngine.java:220)
at com.googlecode.objectify.impl.LoadEngine$1.nowUncached(LoadEngine.java:178)
at com.googlecode.objectify.impl.LoadEngine$1.nowUncached(LoadEngine.java:164)
at com.googlecode.objectify.util.ResultCache.now(ResultCache.java:30)
at com.googlecode.objectify.impl.Round$1.nowUncached(Round.java:73)
at com.googlecode.objectify.util.ResultCache.now(ResultCache.java:30)
at com.googlecode.objectify.LoadResult.now(LoadResult.java:25)
...
com.google.appengine.tools.development.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:98)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:487)
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.content(HttpConnection.java:938)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:755)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
Caused by: java.lang.UnsupportedOperationException
at java.util.AbstractList.remove(Unknown Source)
at java.util.AbstractList$Itr.remove(Unknown Source)
at java.util.AbstractList.removeRange(Unknown Source)
at java.util.AbstractList.clear(Unknown Source)
at com.googlecode.objectify.impl.translate.CollectionTranslatorFactory$1.loadListIntoExistingCollection(CollectionTranslatorFactory.java:66)
at com.googlecode.objectify.impl.TranslatableProperty.executeLoad(TranslatableProperty.java:62)
at com.googlecode.objectify.impl.translate.ClassTranslator.loadMap(ClassTranslator.java:115)
at com.googlecode.objectify.impl.translate.MapNodeTranslator.loadAbstract(MapNodeTranslator.java:25)
at com.googlecode.objectify.impl.translate.AbstractTranslator.load(AbstractTranslator.java:25)
at com.googlecode.objectify.impl.Transmog.load(Transmog.java:82)
at com.googlecode.objectify.impl.Transmog.load(Transmog.java:71)
... 68 more
You are loading data into a collection field. Objectify uses an existing collection if the field is already initialized with one (thus you can have collections with special sort Comparators, etc). It looks like you have initialized your collection field with some sort of unmodifiable list.
Initialize the list with a normal ArrayList or whatever you want.
Maybe it's related but I don't think, there's an Immutable collection here too, but the error happens when GAE is turned off and statred the first time (more details here: https://code.google.com/p/objectify-appengine/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Type%20Status%20Priority%20Milestone%20Owner%20Summary&groupby=&sort=&id=165)
java.lang.NullPointerException
at com.googlecode.objectify.impl.Round$1.nowUncached(Round.java:73)
at com.googlecode.objectify.util.ResultCache.now(ResultCache.java:30)
at com.googlecode.objectify.util.ResultNowFunction.apply(ResultNowFunction.java:20)
at com.googlecode.objectify.util.ResultNowFunction.apply(ResultNowFunction.java:9)
at com.google.common.collect.Iterators$8.transform(Iterators.java:860)
at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:48)
at com.googlecode.objectify.impl.Chunk.next(Chunk.java:27)
at com.googlecode.objectify.impl.Chunk.next(Chunk.java:10)
at com.google.common.collect.Iterators$5.next(Iterators.java:607)
at com.google.common.collect.Iterators$PeekingImpl.peek(Iterators.java:1239)
at com.googlecode.objectify.impl.ChunkingIterator.hasNext(ChunkingIterator.java:52)
at com.google.common.collect.Lists.newArrayList(Lists.java:144)
at com.google.common.collect.Lists.newArrayList(Lists.java:125)
at com.googlecode.objectify.util.MakeListResult.translate(MakeListResult.java:21)
at com.googlecode.objectify.util.MakeListResult.translate(MakeListResult.java:11)
at com.googlecode.objectify.util.ResultTranslator.nowUncached(ResultTranslator.java:21)
at com.googlecode.objectify.util.ResultCache.now(ResultCache.java:30)
at com.googlecode.objectify.util.ResultProxy.invoke(ResultProxy.java:34)
at com.sun.proxy.$Proxy21.iterator(Unknown Source)
at java.util.Collections$UnmodifiableCollection$1.<init>(Collections.java:1064)
at java.util.Collections$UnmodifiableCollection.iterator(Collections.java:1063)
at flexjson.transformer.IterableTransformer.transform(IterableTransformer.java:26)
Related
fetch a list of objects . Use multi threading to fetch children objects and do some processing. collect all results and send to UI. threads produce inconsistent results. Some of the threads throw an error while some work fine.
sample code :
entities : Parent, Child
Parent {
Ref<Child> childKey ;
public Child getChild(){
return childKey.get();
}
}
List<Parent> parents ; //get from db
ExecutorService executorService = Executors.newFixedThreadPool(20, ThreadManager.currentRequestThreadFactory());
List<Future<ParentTO>> futures = new ArrayList<>();
for (Parent parent : parents) {
Future<ParentTO> future = executorService.submit(() -> {
return ObjectifyService.run(new Work<ParentTO>() {
public ParentTO run() {
parent.getChild(); ParentTO to = new ParentTO();
return to;
}
});
});
}
Error only shows on appengine and for some threads. It works fine on local server. If i reload page i see different results every time. Without threads it works fine.
java.util.concurrent.ExecutionException: com.googlecode.objectify.LoadException: Error loading Parent("FND1clkiTUa_lWsJow-Dxwdmadma")/Child(1): null
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:206)
at com.netkiller.erp.service.ParentService.ParentsToApprovalTOs(ParentService.java:1720)
at com.netkiller.erp.service.ParentService.getSharedParentsUI(ParentService.java:2000)
at com.netkiller.common.controller.ParentController.fetchSharedParents(ParentController.java:1266)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:214)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:749)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:690)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:945)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:876)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:848)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1772)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759)
at com.netkiller.common.filter.OpenIdFilter.doFilter(OpenIdFilter.java:859)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759)
at com.netkiller.common.filter.ServiceFilter.doFilter(ServiceFilter.java:100)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759)
at com.netkiller.common.filter.SecureProtocolFilter.doFilter(SecureProtocolFilter.java:35)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759)
at com.googlecode.objectify.ObjectifyFilter.doFilter(ObjectifyFilter.java:48)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759)
at com.google.apphosting.utils.servlet.JdbcMySqlConnectionCleanupFilter.doFilter(JdbcMySqlConnectionCleanupFilter.java:60)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:582)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
at com.google.apphosting.runtime.jetty9.ParseBlobUploadHandler.handle(ParseBlobUploadHandler.java:119)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1182)
at com.google.apphosting.runtime.jetty9.AppEngineWebAppContext.doHandle(AppEngineWebAppContext.java:183)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at com.google.apphosting.runtime.jetty9.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:293)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
at org.eclipse.jetty.server.Server.handle(Server.java:539)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:333)
at com.google.apphosting.runtime.jetty9.RpcConnection.handle(RpcConnection.java:213)
at com.google.apphosting.runtime.jetty9.RpcConnector.serviceRequest(RpcConnector.java:81)
at com.google.apphosting.runtime.jetty9.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:123)
at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.dispatchServletRequest(JavaRuntime.java:692)
at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.dispatchRequest(JavaRuntime.java:655)
at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.run(JavaRuntime.java:625)
at com.google.apphosting.runtime.JavaRuntime$NullSandboxRequestRunnable.run(JavaRuntime.java:817)
at com.google.apphosting.runtime.ThreadGroupPool$PoolEntry.run(ThreadGroupPool.java:269)
at java.lang.Thread.run(Thread.java:748)
Caused by: com.googlecode.objectify.LoadException: Error loading Parent("FND1clkiTUa_lWsJow-Dxwdmadma")/Child(1): null
at com.googlecode.objectify.impl.EntityMetadata.load(EntityMetadata.java:78)
at com.googlecode.objectify.impl.LoadEngine.load(LoadEngine.java:185)
at com.googlecode.objectify.impl.LoadEngine$1.nowUncached(LoadEngine.java:141)
at com.googlecode.objectify.impl.LoadEngine$1.nowUncached(LoadEngine.java:127)
at com.googlecode.objectify.util.ResultCache.now(ResultCache.java:30)
at com.googlecode.objectify.impl.Round$1.nowUncached(Round.java:71)
at com.googlecode.objectify.util.ResultCache.now(ResultCache.java:30)
at com.googlecode.objectify.impl.LoaderImpl.now(LoaderImpl.java:251)
at com.googlecode.objectify.impl.ref.LiveRef.get(LiveRef.java:47)
at com.netkiller.erp.domain.Parent.getChild(Parent.java:187)
at com.netkiller.common.dto.ApprovalTO.<init>(ApprovalTO.java:503)
at com.netkiller.erp.service.ParentService$2.run(ParentService.java:1708)
at com.netkiller.erp.service.ParentService$2.run(ParentService.java:1)
at com.googlecode.objectify.ObjectifyService.run(ObjectifyService.java:81)
at com.netkiller.erp.service.ParentService.lambda$8(ParentService.java:1706)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at com.google.apphosting.runtime.ApiProxyImpl$CurrentRequestThreadFactory.lambda$newThread$0(ApiProxyImpl.java:1213)
at java.security.AccessController.doPrivileged(Native Method)
at com.google.apphosting.runtime.ApiProxyImpl$CurrentRequestThreadFactory.lambda$newThread$1(ApiProxyImpl.java:1209)
at java.lang.Thread.run(Thread.java:748)
at com.google.apphosting.runtime.ApiProxyImpl$CurrentRequestThread.run(ApiProxyImpl.java:1185)
Caused by: java.util.NoSuchElementException
at java.util.ArrayDeque.removeLast(ArrayDeque.java:295)
at com.googlecode.objectify.impl.translate.LoadContext.exitContainerContext(LoadContext.java:141)
at com.googlecode.objectify.impl.translate.ClassPopulator.load(ClassPopulator.java:119)
at com.googlecode.objectify.impl.translate.ClassTranslator.loadSafe(ClassTranslator.java:122)
at com.googlecode.objectify.impl.translate.ClassTranslator.loadSafe(ClassTranslator.java:21)
at com.googlecode.objectify.impl.translate.NullSafeTranslator.load(NullSafeTranslator.java:17)
at com.googlecode.objectify.impl.EntityMetadata.load(EntityMetadata.java:74)
... 22 more
Thanks for any insight on the issue.
It's hard to tell exactly what's going on from the provided code, but it's easy to accidentally contaminate data when operating across multiple threads.
To reduce the chance that you're accidentally pulling data from the wrong thread's session, use ofy().load() to load everything instead of following refs. You can pass a Ref to ofy().load().ref(theRef).
If you always call ofy() then you will always get an instance correct for your thread of execution. Try that out and if you still have an issue, we can continue this discussion with whatever error message you see.
I have an application that connects to multiple databases within a single Google Cloud SQL instance. Based on a drop down selection, the GAE application will select records from one of 5 databases.
The problem is that when I select the first 4 databases (in no particular order in the drop down list), the GAE app connects successfully to the database and is able to retrieve records. But when I choose the fifth database from the drop down list, an error is thrown. The error and stack trace is as below. It is not an error with a specific database, as the error does not depend on the order of which database was selected. The last or fifth database chosen, immaterial of which, always fails with the same error message.
Any advise will be very much appreciated.
InspectAPI.java:
public Element[] getComponentsList(#Named("province")String provinceName, User user) throws Exception {
if (user == null) {
throw new UnauthorizedException("API calls must be authenticated.");
}
if (!AuthorizationService.hasAnyOrRoles(user.getEmail(), AuthorizationService.ROLE_ALL_ROLES)
|| !AuthorizationService.hasProvincieAccess(user.getEmail(), provinceName)) {
throw new UnauthorizedException("You are not authorized to invoke this API method.");
}
EntityManager em = null;
Element[] e = null;
try {
em = EMF.getFStore().createEntityManager();
em.getTransaction().begin();
e = (ElementRubrieken[]) em.createQuery("SELECT i FROM Element i").getResultList()
.toArray(new Element[0]);
} catch (NoResultException nre) {
// no result
if (e == null) {
return e;
}
} catch (Exception ex) {
log.log(Level.SEVERE, "Unable to get inspections.", ex);
throw new InternalServerErrorException("Unable to get inspections.");
} finally {
if (em != null) {
em.getTransaction().commit();
em.close();
}
}
return e;
}
EMF.java
public static EntityManagerFactory getFicheStore() {
if (emfFicheInstance == null) {
Map<String, String> properties = new HashMap<String, String>();
if (SystemProperty.environment.value() == SystemProperty.Environment.Value.Production) {
properties.put("javax.persistence.jdbc.driver", "com.mysql.jdbc.GoogleDriver");
properties.put("javax.persistence.jdbc.url", System.getProperty("cloudsql.prod.f.url"));
properties.put("javax.persistence.jdbc.user", System.getProperty("cloudsql.prod.f.user"));
properties.put("javax.persistence.jdbc.password", System.getProperty("cloudsql.prod.f.password"));
properties.put("javax.persistence.jdbc.db", System.getProperty("cloudsql.prod.f.db"));
} else {
properties.put("javax.persistence.jdbc.driver", "com.mysql.jdbc.Driver");
properties.put("javax.persistence.jdbc.url", System.getProperty("cloudsql.dev.f.url"));
properties.put("javax.persistence.jdbc.user", System.getProperty("cloudsql.dev.f.user"));
properties.put("javax.persistence.jdbc.password", System.getProperty("cloudsql.dev.f.password"));
properties.put("javax.persistence.jdbc.db", System.getProperty("cloudsql.dev.f.db"));
}
emfFicheInstance = Persistence.createEntityManagerFactory(
System.getProperty("com.myproject.services.emfFactory.persistenceUnitName"),
properties);
}
return emfFicheInstance;
}
Error and stack trace:
E 00:42:39.184 com.myproject.api.InspectAPI getComponentsList: Unable to get inspections.
javax.persistence.PersistenceException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at org.datanucleus.api.jpa.NucleusJPAHelper.getJPAExceptionForNucleusException(NucleusJPAHelper.java:270)
at org.datanucleus.api.jpa.JPAQuery.getResultList(JPAQuery.java:202)
at com.myproject.api.InspectAPI.getComponentsList(InspectAPI.java:223)
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:606)
at com.google.apphosting.runtime.security.shared.intercept.java.lang.reflect.Method_$1.run(Method_.java:179)
at java.security.AccessController.doPrivileged(Native Method)
at com.google.apphosting.runtime.security.shared.intercept.java.lang.reflect.Method_.privilegedInvoke(Method_.java:176)
at com.google.apphosting.runtime.security.shared.intercept.java.lang.reflect.Method_.invoke_(Method_.java:137)
at com.google.apphosting.runtime.security.shared.intercept.java.lang.reflect.Method_.invoke(Method_.java:45)
at com.google.api.server.spi.SystemService.invokeServiceMethod(SystemService.java:359)
at com.google.api.server.spi.SystemServiceServlet.execute(SystemServiceServlet.java:160)
at com.google.api.server.spi.SystemServiceServlet.doPost(SystemServiceServlet.java:118)
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 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:60)
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:254)
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:484)
at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:438)
at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:445)
at com.google.tracing.CurrentContext.runInContext(CurrentContext.java:220)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:309)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:301)
at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:442)
at com.google.apphosting.runtime.ThreadGroupPool$PoolEntry.run(ThreadGroupPool.java:251)
at java.lang.Thread.run(Thread.java:724)
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:46)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1117)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:350)
at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2416)
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2450)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2235)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:818)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:46)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:46)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:404)
at com.mysql.jdbc.GoogleNonRegisteringDriver$JdbcWrapper.getInstance(GoogleNonRegisteringDriver.java:276)
at com.mysql.jdbc.GoogleNonRegisteringDriver.connect(GoogleNonRegisteringDriver.java:246)
at java.sql.DriverManager.getConnection(DriverManager.java:571)
at java.sql.DriverManager.getConnection(DriverManager.java:187)
at org.datanucleus.store.rdbms.datasource.dbcp.DriverManagerConnectionFactory.createConnection(DriverManagerConnectionFactory.java:78)
at org.datanucleus.store.rdbms.datasource.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582)
at org.datanucleus.store.rdbms.datasource.dbcp.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1158)
at org.datanucleus.store.rdbms.datasource.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:108)
at org.datanucleus.store.rdbms.ConnectionProviderPriorityList.getConnection(ConnectionProviderPriorityList.java:57)
at org.datanucleus.store.rdbms.ConnectionFactoryImpl$ManagedConnectionImpl.getConnection(ConnectionFactoryImpl.java:354)
at org.datanucleus.store.rdbms.ConnectionFactoryImpl$ManagedConnectionImpl.getXAResource(ConnectionFactoryImpl.java:314)
at org.datanucleus.store.connection.ConnectionManagerImpl.enlistResource(ConnectionManagerImpl.java:354)
at org.datanucleus.store.connection.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:226)
at org.datanucleus.store.connection.AbstractConnectionFactory.getConnection(AbstractConnectionFactory.java:60)
at org.datanucleus.store.AbstractStoreManager.getConnection(AbstractStoreManager.java:432)
at org.datanucleus.store.AbstractStoreManager.getConnection(AbstractStoreManager.java:401)
at org.datanucleus.store.rdbms.query.JPQLQuery.performExecute(JPQLQuery.java:512)
at org.datanucleus.store.query.Query.executeQuery(Query.java:1789)
at org.datanucleus.store.query.Query.executeWithMap(Query.java:1693)
at org.datanucleus.api.jpa.JPAQuery.getResultList(JPAQuery.java:185)
<continued in next message>
E 00:42:39.184 <continued from previous message>
at com.myproject.api.InspectAPI.getComponentsList(InspectAPI.java:223)
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:45)
at com.google.api.server.spi.SystemService.invokeServiceMethod(SystemService.java:359)
at com.google.api.server.spi.SystemServiceServlet.execute(SystemServiceServlet.java:160)
at com.google.api.server.spi.SystemServiceServlet.doPost(SystemServiceServlet.java:118)
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 org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
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 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 org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:438)
at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:445)
at com.google.tracing.CurrentContext.runInContext(CurrentContext.java:220)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:309)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:301)
at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:442)
... 1 more
Caused by: java.net.SocketException: Unable to open connection to the instance: myproject-tst:mysql
at com.mysql.jdbc.GoogleCloudSqlSocket.<init>(GoogleCloudSqlSocket.java:48)
at com.mysql.jdbc.GoogleCloudSqlSocketFactory.connect(GoogleCloudSqlSocketFactory.java:81)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:300)
... 64 more
Caused by: java.io.FileNotFoundException: /cloudsql/myproject-tst:mysql (No such file or directory)
at java.io.RandomAccessFile.open(Native Method)
at java.io.RandomAccessFile.<init>(RandomAccessFile.java:247)
at java.io.RandomAccessFile.<init>(RandomAccessFile.java:132)
at com.mysql.jdbc.GoogleCloudSqlSocket$RandomAccessFileHelper.getFile(GoogleCloudSqlSocket.java:249)
at com.mysql.jdbc.GoogleCloudSqlSocket.<init>(GoogleCloudSqlSocket.java:46)
... 66 more
I see two posibble reason for this error:
You are hitting the limit of 12 concurrent connections described here [1]. For some reason you might be not closing connections properly.
I'm not an expert on JPA but i think You need to stablish a single persistence unit per database yo want to connect to [2].
[1] https://cloud.google.com/appengine/docs/java/cloud-sql/#Java_Managing_connections
[2] http://www.mastertheboss.com/jboss-frameworks/hibernate-jpa/jpa-configuration/how-to-use-multiple-database-in-persistencexml
It was a old project on GAE one year ago. It works pretty well at that time. Recently I tried to work on this project again, but it doesn't work well now. I figured out what the problem is, but I don't know how to solve it.
Add new user is ok. but when I trying to add image of a user, the image file itself stored in blobstore succesfully but the record entity Imagecould not be persist.
It seems that gae couldn't set the value of the image field in User table and come up with a strange error which says String too long. It probably related to LAZY loading stuff.
I would be appercaite if you could help me out.
Here is my entities and the code where the error happen.
OnetoMany relationship in User entity:
#Entity
public class User {
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
private Key key;
#GeneratedValue(strategy = GenerationType.SEQUENCE)
Integer userid;
String username;
String password;
String email;
#OneToMany()
Collection<Image> images;
// getter and setter....
}
Image Entity:
#Entity
public class Image {
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
private Key key;
#GeneratedValue(strategy = GenerationType.SEQUENCE)
Integer imageid;
private String name;
// full path of blobstore
private String path;
private Date uploadtime;
}
Where the error occur:
//ImageService.java/uploadImage
user = userDao.findUser(userid);
Collection<Image> images = user.getImages();
images.add(image); // Exception occurs here
user.setImages(images);
userDao.update(user);
Stack Trace:
com.sun.jersey.spi.container.ContainerResponse mapMappableContainerException: The RuntimeException could not be mapped to a response, re-throwing to the HTTP container
java.lang.IllegalArgumentException: path: String properties must be 500 characters or less. Instead, use com.google.appengine.api.datastore.Text, which can store strings of any length.
at com.google.appengine.api.datastore.DataTypeUtils.checkSupportedSingleValue(DataTypeUtils.java:242)
at com.google.appengine.api.datastore.DataTypeUtils.checkSupportedValue(DataTypeUtils.java:207)
at com.google.appengine.api.datastore.DataTypeUtils.checkSupportedValue(DataTypeUtils.java:173)
at com.google.appengine.api.datastore.DataTypeUtils.checkSupportedValue(DataTypeUtils.java:148)
at com.google.appengine.api.datastore.PropertyContainer.setProperty(PropertyContainer.java:101)
at com.google.appengine.datanucleus.EntityUtils.setEntityProperty(EntityUtils.java:169)
at com.google.appengine.datanucleus.StoreFieldManager.storeFieldInEntity(StoreFieldManager.java:245)
at com.google.appengine.datanucleus.StoreFieldManager.storeStringField(StoreFieldManager.java:168)
at org.datanucleus.state.AbstractStateManager.providedStringField(AbstractStateManager.java:1438)
at com.nhm.persistence.entity.Image.jdoProvideField(Image.java)
at com.nhm.persistence.entity.Image.jdoProvideFields(Image.java)
at org.datanucleus.state.AbstractStateManager.provideFields(AbstractStateManager.java:1520)
at com.google.appengine.datanucleus.DatastorePersistenceHandler.insertObjectsInternal(DatastorePersistenceHandler.java:232)
at com.google.appengine.datanucleus.DatastorePersistenceHandler.insertObject(DatastorePersistenceHandler.java:214)
at org.datanucleus.state.JDOStateManager.internalMakePersistent(JDOStateManager.java:2371)
at org.datanucleus.state.JDOStateManager.makePersistent(JDOStateManager.java:2347)
at org.datanucleus.ObjectManagerImpl.persistObjectInternal(ObjectManagerImpl.java:1798)
at org.datanucleus.ObjectManagerImpl.persistObjectInternal(ObjectManagerImpl.java:1892)
at org.datanucleus.store.types.sco.SCOUtils.validateObjectForWriting(SCOUtils.java:1501)
at com.google.appengine.datanucleus.scostore.AbstractFKStore.validateElementForWriting(AbstractFKStore.java:383)
at com.google.appengine.datanucleus.scostore.FKListStore.validateElementForWriting(FKListStore.java:1029)
at com.google.appengine.datanucleus.scostore.FKListStore.internalAdd(FKListStore.java:193)
at com.google.appengine.datanucleus.scostore.FKListStore.addAll(FKListStore.java:114)
at org.datanucleus.store.types.sco.backed.ArrayList.addAll(ArrayList.java:727)
at org.datanucleus.store.types.sco.backed.ArrayList.initialise(ArrayList.java:161)
at org.datanucleus.store.types.sco.SCOUtils.createSCOWrapper(SCOUtils.java:249)
at org.datanucleus.store.types.sco.SCOUtils.newSCOInstance(SCOUtils.java:140)
at org.datanucleus.state.JDOStateManager.wrapSCOField(JDOStateManager.java:2225)
at org.datanucleus.state.AbstractStateManager.setObjectField(AbstractStateManager.java:2051)
at com.nhm.persistence.entity.User.jdoSetimages(User.java)
at com.nhm.persistence.entity.User.setImages(User.java:131)
at com.nhm.web.service.ImageService.uploadImage(ImageService.java:96)
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:43)
at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1511)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1442)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1391)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1381)
at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716)
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 org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
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 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 org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
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 java.lang.Thread.run(Thread.java:679)
Thank you!
If you want to store Strings longer than 500 Unicode characters you need to use Text instead. See Datastore Properties & Value Types.
I try to upload document using json api in the solandra platform.
In order to do that, the command that I used to upload my document is like that
curl http://localhost:8983/solandra/wikassandra/update/json
-H 'Contednt-type:application/json' -d '
{
"add": {"doc":
{"url" : "TestDoc1",
"title" : "test1",
"text" : "sdkfjw",
"category" : "dskfj"} }
}'
and I got this error
INFO 02:57:56,170 JNDI not configured for solr (NoInitialContextEx)
INFO 02:57:56,171 solr home defaulted to 'solr/' (could not find system property or JNDI)
INFO 02:57:56,171 Solr home set to 'solr/'
INFO 02:57:56,174 row was marked empty: [Row(key=DecoratedKey(155949571512290652274890255161558562273, 313535393439353731353132323930363532323734383930323535313631353538353632323733efbfbf7265736f7572636573), cf=null)]
INFO 02:57:56,192 Adding specified lib dirs to ClassLoader
INFO 02:57:56,223 Using Lucene MatchVersion: LUCENE_24
WARN 02:57:56,254 Deprecated syntax found. <highlighting/> should move to <searchComponent/>
INFO 02:57:56,258 Loaded SolrConfig: solrconfig.xml
INFO 02:57:56,258 Reading Solr Schema
ERROR 02:57:56,260 Exception during parsing file: schema:org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:391)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1391)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1014)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:625)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:488)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:819)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:748)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:239)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:288)
at org.apache.solr.core.Config.<init>(Config.java:159)
at org.apache.solr.schema.IndexSchema.readSchema(IndexSchema.java:420)
at org.apache.solr.schema.IndexSchema.<init>(IndexSchema.java:125)
at org.apache.solr.core.SolandraCoreContainer.readSchema(SolandraCoreContainer.java:165)
at org.apache.solr.core.SolandraCoreContainer.getCore(SolandraCoreContainer.java:100)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:194)
at solandra.SolandraDispatchFilter.doFilter(SolandraDispatchFilter.java:137)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
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.content(HttpConnection.java:945)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
ERROR 02:57:56,261 org.apache.solr.common.SolrException: Schema Parsing Failed: Content is not allowed in prolog.
at org.apache.solr.schema.IndexSchema.readSchema(IndexSchema.java:678)
at org.apache.solr.schema.IndexSchema.<init>(IndexSchema.java:125)
at org.apache.solr.core.SolandraCoreContainer.readSchema(SolandraCoreContainer.java:165)
at org.apache.solr.core.SolandraCoreContainer.getCore(SolandraCoreContainer.java:100)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:194)
at solandra.SolandraDispatchFilter.doFilter(SolandraDispatchFilter.java:137)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
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.content(HttpConnection.java:945)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:391)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1391)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1014)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:625)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:488)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:819)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:748)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:239)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:288)
at org.apache.solr.core.Config.<init>(Config.java:159)
at org.apache.solr.schema.IndexSchema.readSchema(IndexSchema.java:420)
... 18 more
Where should I check first to fix this problem?
Your schema.xml must not be valid. You can see it by GETing http://localhost:8983/solandra/schema/wikassandra
My app has been purring along for a month with only the occasional deadline exceeded exception. This morning, in a space of five minutes, I had 150 deadline exceeded exceptions. Now it's back to normal. I understand that this can just happen, and isn't necessarily going to be resolved by anything that I do in my code, but every single exception has appstats in the stack trace (at least the 20 I looked at most carefully). On one hand, this implicates appstats - on the other hand, I guess appstats is probably in every single stack trace that ever runs. I'm trying to determine if appstats was the problem.
I'm not an expert with filters - can anyone tell me if a stack trace like the one below implies that the code was waiting in appstats for a long time? It seems like it does mean that, but I thought maybe filters are chained together in such a way that confuses the stack trace. Also, even if it was waiting in appstats - it seems like the problem might be datastore unavailability (no problems evident on the global appengine status page).
I put asterisks at the beginning of the obvious appstats calls for quick scanning.
javax.servlet.ServletContext log: Exception while dispatching incoming RPC call
com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract com.activegrade.shared.dto.ResultDTO com.activegrade.client.serviceinterfaces.CourseOperationService.getCourseList(com.activegrade.shared.dto.AuthInfo)' threw an unexpected exception: com.google.apphosting.api.DeadlineExceededException: This request (1ff876185c635baf) started at 2010/11/30 14:35:47.278 UTC and was still executing at 2010/11/30 14:36:16.261 UTC.
at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:378)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:581)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:207)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:243)
at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
**at com.google.appengine.tools.appstats.AppstatsFilter.doFilter(AppstatsFilter.java:140)**
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.apphosting.utils.servlet.ParseBlobUploadFilter.doFilter(ParseBlobUploadFilter.java:97)
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.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:238)
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:135)
at com.google.apphosting.runtime.JavaRuntime.handleRequest(JavaRuntime.java:261)
at com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockingRequest(RuntimePb.java:8486)
at com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockingRequest(RuntimePb.java:8484)
at com.google.net.rpc.impl.BlockingApplicationHandler.handleRequest(BlockingApplicationHandler.java:24)
at com.google.net.rpc.impl.RpcUtil.runRpcInApplication(RpcUtil.java:418)
at com.google.net.rpc.impl.Server$RpcTask.runInContext(Server.java:572)
at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:448)
at com.google.tracing.TraceContext.runInContext(TraceContext.java:688)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:326)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:318)
at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:446)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:636)
Caused by: com.google.apphosting.api.DeadlineExceededException: This request (1ff876185c635baf) started at 2010/11/30 14:35:47.278 UTC and was still executing at 2010/11/30 14:36:16.261 UTC.
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:502)
**at com.google.appengine.tools.appstats.RecordingFuture.get(RecordingFuture.java:99)
**at com.google.appengine.tools.appstats.RecordingFuture$ExtendedFuture.get(RecordingFuture.java:44)
at com.google.appengine.api.utils.FutureWrapper.get(FutureWrapper.java:42)
at com.google.appengine.api.utils.FutureWrapper.get(FutureWrapper.java:42)
at com.google.appengine.api.datastore.FutureHelper.getInternal(FutureHelper.java:71)
at com.google.appengine.api.datastore.FutureHelper.quietGet(FutureHelper.java:32)
at com.google.appengine.api.datastore.QueryResultsSourceImpl.loadMoreEntities(QueryResultsSourceImpl.java:69)
at com.google.appengine.api.datastore.QueryResultsSourceImpl.loadMoreEntities(QueryResultsSourceImpl.java:56)
at com.google.appengine.api.datastore.QueryResultIteratorImpl.ensureLoaded(QueryResultIteratorImpl.java:156)
at com.google.appengine.api.datastore.QueryResultIteratorImpl.hasNext(QueryResultIteratorImpl.java:65)
at org.datanucleus.store.appengine.DatastoreElementContainerStoreSpecialization.getChildren(DatastoreElementContainerStoreSpecialization.java:105)
at org.datanucleus.store.appengine.DatastoreFKListStore.listIterator(DatastoreFKListStore.java:48)
at org.datanucleus.store.mapped.scostore.AbstractListStore.listIterator(AbstractListStore.java:84)
at org.datanucleus.store.mapped.scostore.AbstractListStore.iterator(AbstractListStore.java:74)
at org.datanucleus.sco.backed.List.loadFromStore(List.java:241)
at org.datanucleus.sco.backed.List.initialise(List.java:190)
at org.datanucleus.sco.SCOUtils.newSCOInstance(SCOUtils.java:183)
at org.datanucleus.store.mapped.mapping.AbstractContainerMapping.replaceFieldWithWrapper(AbstractContainerMapping.java:426)
at org.datanucleus.store.mapped.mapping.AbstractContainerMapping.postFetch(AbstractContainerMapping.java:444)
at org.datanucleus.store.appengine.DatastorePersistenceHandler.runPostFetchMappingCallbacks(DatastorePersistenceHandler.java:510)
at org.datanucleus.store.appengine.DatastorePersistenceHandler.fetchObject(DatastorePersistenceHandler.java:489)
at org.datanucleus.store.appengine.query.DatastoreQuery.entityToPojo(DatastoreQuery.java:565)
at org.datanucleus.store.appengine.DatastoreRelationFieldManager.lookupOneToOneChild(DatastoreRelationFieldManager.java:320)
at org.datanucleus.store.appengine.DatastoreRelationFieldManager.fetchRelationField(DatastoreRelationFieldManager.java:274)
at org.datanucleus.store.appengine.DatastoreFieldManager.fetchObjectField(DatastoreFieldManager.java:289)
at org.datanucleus.state.AbstractStateManager.replacingObjectField(AbstractStateManager.java:1197)
at com.activegrade.server.dao.Course.jdoReplaceField(Course.java)
at com.activegrade.server.dao.Course.jdoReplaceFields(Course.java)
at org.datanucleus.state.JDOStateManagerImpl.replaceFields(JDOStateManagerImpl.java:2772)
at org.datanucleus.state.JDOStateManagerImpl.replaceFields(JDOStateManagerImpl.java:2791)
at org.datanucleus.store.appengine.DatastorePersistenceHandler.fetchObject(DatastorePersistenceHandler.java:480)
at org.datanucleus.store.appengine.query.DatastoreQuery.entityToPojo(DatastoreQuery.java:565)
at org.datanucleus.store.appengine.query.DatastoreQuery.entityToPojo(DatastoreQuery.java:520)
at org.datanucleus.store.appengine.query.DatastoreQuery.access$300(DatastoreQuery.java:110)
at org.datanucleus.store.appengine.query.DatastoreQuery$6.apply(DatastoreQuery.java:638)
at org.datanucleus.store.appengine.query.DatastoreQuery$6.apply(DatastoreQuery.java:630)
at org.datanucleus.store.appengine.query.LazyResult.resolveNext(LazyResul
Appstats inserts instrumentation into the App Engine stack, in order to time all the RPC calls your app makes. Since DeadlineExceeded errors are thrown by the RPC, Appstats will always be in the stack. The call in question wasn't made by appstats - it was simply recording it.