I've got a question regarding tapestry 5.4. I try to integrate it with tynamo tapestry security and Google App Engine and after some development I started to get these exception when "something" in application is not working. I have written "something" because problem concerns ExceptionPage (as you can see on stacktrace attached below).
Has anybody faced such a problem?
Of course I can post some configuration files, but since I have no idea what can cause this exception of error page, I not posing any at the moment.
HTTP ERROR 500
Problem accessing /. Reason:
org.apache.tapestry5.internal.services.RenderQueueException: Render queue error in SetupRender[core/ExceptionReport:loop_0]: Failure reading parameter 'source' of component core/ExceptionReport:loop_0: access denied ("java.lang.RuntimePermission" "modifyThreadGroup") [at classpath:org/apache/tapestry5/corelib/pages/ExceptionReport.tml, line 110]
Caused by:
org.apache.shiro.subject.ExecutionException: org.apache.tapestry5.internal.services.RenderQueueException: Render queue error in SetupRender[core/ExceptionReport:loop_0]: Failure reading parameter 'source' of component core/ExceptionReport:loop_0: access denied ("java.lang.RuntimePermission" "modifyThreadGroup") [at classpath:org/apache/tapestry5/corelib/pages/ExceptionReport.tml, line 110]
at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:385)
at org.tynamo.security.services.impl.SecurityConfiguration.service(SecurityConfiguration.java:54)
at $HttpServletRequestFilter_12a67d391b5c.service(Unknown Source)
at $HttpServletRequestHandler_12a67d391b5f.service(Unknown Source)
at org.apache.tapestry5.internal.gzip.GZipFilter.service(GZipFilter.java:59)
at $HttpServletRequestHandler_12a67d391b5f.service(Unknown Source)
at org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62)
at $HttpServletRequestFilter_12a67d391b59.service(Unknown Source)
at $HttpServletRequestHandler_12a67d391b5f.service(Unknown Source)
at org.apache.tapestry5.modules.TapestryModule$1.service(TapestryModule.java:804)
at $HttpServletRequestHandler_12a67d391b5f.service(Unknown Source)
at $HttpServletRequestHandler_12a67d391b58.service(Unknown Source)
at org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:166)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.api.socket.dev.DevSocketFilter.doFilter(DevSocketFilter.java:74)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.tools.development.ResponseRewriterFilter.doFilter(ResponseRewriterFilter.java:127)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:34)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:63)
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 com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:125)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectRequest(DevAppServerModulesFilter.java:366)
at com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectModuleRequest(DevAppServerModulesFilter.java:349)
at com.google.appengine.tools.development.DevAppServerModulesFilter.doFilter(DevAppServerModulesFilter.java:116)
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.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:503)
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.HttpParser.parseNext(HttpParser.java:547)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
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)
The problem is not the exceptionpage but the way Google App Engine (GAE) implements its security policy to restrict spawning new threads. The line:
access denied ("java.lang.RuntimePermission" "modifyThreadGroup")
in your stack trace originates from Java Security Manager for a violation of the policy. While Tynamo's tapestry-security does not invoke new threads, apparently it's not allowed to invoke Callable.call() in GAE. See how the SecurityConfiguration invokes the filter chain after binding the currently executing subject.
Callable is just an interface so it's unnecessary for GAE to prohibit an invocation to it but I suspect it was easier for them to do that than try to block executions of various Executor services that may or may not spawn threads.
However, SecurityConfiguration does not need to use Callable at all. SecurityConfiguration was implemented following Shiro's original AbstractShiroFilter, but one could also manually bind the subject to the currently executing thread, like so:
ThreadContext.bind(securityManager);
WebSubject subject = new WebSubject.Builder(securityManager, originalRequest, response).buildWebSubject();
ThreadContext.bind(subject);
try {
// return subject.execute(new Callable<Boolean>() {
// public Boolean call() throws Exception {
if (chain == null) return handler.service(request, response);
else {
boolean handled = chain.getHandler().service(request, response);
return handled || handler.service(request, response);
}
// }
// });
}
finally {
ThreadContext.remove(subject);
ThreadContext.remove();
}
You could override SecurityConfiguration yourself with a version that operates in the same manner as above. If you want to help, try it and let me know if everything else works. You may run into other issues since GAE can be a fairly restrictive environment for full-fledged Java applications.
Related
I am currently following https://developers.google.com/drive/v3/web/quickstart/java tutorial to get the list of files from the doogle drive. In am getting the following exception
Caused by:
java.io.EOFException
at java.io.ObjectInputStream$PeekInputStream.readFully(Unknown Source)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(Unknown Source)
at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
at java.io.ObjectInputStream.<init>(Unknown Source)
at com.google.api.client.util.IOUtils.deserialize(IOUtils.java:171)
at com.google.api.client.util.store.FileDataStoreFactory$FileDataStore.<init>(FileDataStoreFactory.java:102)
at com.google.api.client.util.store.FileDataStoreFactory.createDataStore(FileDataStoreFactory.java:73)
at com.google.api.client.util.store.AbstractDataStoreFactory.getDataStore(AbstractDataStoreFactory.java:55)
at com.google.api.client.auth.oauth2.StoredCredential.getDefaultDataStore(StoredCredential.java:171)
at com.google.api.client.auth.oauth2.AuthorizationCodeFlow$Builder.setDataStoreFactory(AuthorizationCodeFlow.java:736)
at com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow$Builder.setDataStoreFactory(GoogleAuthorizationCodeFlow.java:209)
at com.demo.gapps.server.FetchNewFilesCron.authorize(FetchNewFilesCron.java:233)
at com.demo.gapps.server.FetchNewFilesCron.getDriveService(FetchNewFilesCron.java:244)
at com.demo.gapps.server.FetchNewFilesCron.doGet(FetchNewFilesCron.java:97)
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.google.appengine.api.socket.dev.DevSocketFilter.doFilter(DevSocketFilter.java:74)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.tools.development.ResponseRewriterFilter.doFilter(ResponseRewriterFilter.java:128)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:34)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:63)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:50)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:125)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectRequest(DevAppServerModulesFilter.java:366)
at com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectModuleRequest(DevAppServerModulesFilter.java:349)
at com.google.appengine.tools.development.DevAppServerModulesFilter.doFilter(DevAppServerModulesFilter.java:116)
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.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:511)
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.HttpParser.parseNext(HttpParser.java:547)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
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)
The code from the tutorial that I am using to authorize that generated teh potential exception is as follows:
* #return an authorized Credential object.
* #throws IOException
*/
public static Credential authorize() throws IOException {
System.out.println("file path is "+DATA_STORE_DIR.getPath());
// Load client secrets.
InputStream in =
FetchNewFilesCron.class.getResourceAsStream("/client_secrets.json");
GoogleClientSecrets clientSecrets =
GoogleClientSecrets.load(JSON_FACTORY, new InputStreamReader(in));
// Build flow and trigger user authorization request.
GoogleAuthorizationCodeFlow flow =
new GoogleAuthorizationCodeFlow.Builder(
HTTP_TRANSPORT, JSON_FACTORY, clientSecrets, SCOPES)
.setDataStoreFactory(DATA_STORE_FACTORY)
.setAccessType("offline")
.build();
Credential credential = new AuthorizationCodeInstalledApp(
flow, new LocalServerReceiver()).authorize("user");
System.out.println(
"Credentials saved to " + DATA_STORE_DIR.getAbsolutePath());
return credential;
}
The error is probably at .setDataStoreFactory(DATA_STORE_FACTORY)
Can anybody please guide me with this error.
Thanks,
The exception indicates the the end of file (EOF), or the end of stream has been reached unexpectedly. Also, this exception is mainly used by DataInputStreams, in order to signal the end of stream. However, notice that other input operations may return a special value upon the end of a stream, instead of throwing an EOFException.
The EOFException class extends the IOException class, which is the general class of exceptions produced by failed or interrupted I/O operations. Moreover, it implements the Serializable interface. Also, it is defined as a checked exception and thus, it must be declared in a method or a constructor’s throws clause.
DataInputStreams provide methods that can read primitive Java data types from an underlying input stream in a machine-independent way. An application writes data, by using the methods provided by the OutputStream class or the DataOutputStream class.
For more information, check this related SO ticket which discuss about EOFException and DataInputStream: java.io.EOFException when try to read from a socket
I know that this is an old post, but I had almost the exact same stacktrace and the only answer wasn't very helpful. So, I'm posting in hopes that it will help those that come after me.
The issue appears to be related to file/directory permissions. As soon as I changed the filepath being used by the FileDataStoreFactory to a directory that my application had read/write permissions to, OAuth2 worked correctly. So, make sure that you are using a non-restricted filepath and that all of the directories have the correct ownership and permissions.
I have upgraded my GAE server application with the latest GAE SDK 1.9.17 and it stopped work.
I am facing a problem while performing 'entityManager.find(Profile.class, 'some long value representing profile id')'.
Here is a stack trace:
java.lang.ClassCastException: com.google.appengine.api.datastore.Key cannot be cast to java.lang.Integer
at org.datanucleus.store.appengine.DatastoreFieldManager.fetchIntField(DatastoreFieldManager.java:435)
at org.datanucleus.state.AbstractStateManager.replacingIntField(AbstractStateManager.java:1132)
at xxx.Profile.jdoReplaceField(Profile.java)
at xxx.Profile.jdoReplaceFields(Profile.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:519)
at org.datanucleus.state.JDOStateManagerImpl.validate(JDOStateManagerImpl.java:4263)
at org.datanucleus.ObjectManagerImpl.findObject(ObjectManagerImpl.java:2444)
at org.datanucleus.jpa.EntityManagerImpl.find(EntityManagerImpl.java:234)
at org.datanucleus.store.appengine.jpa.DatastoreEntityManager.find(DatastoreEntityManager.java:56)
at xxx.GameAdd$1.run(GameAdd.java:34)
at xxx.GameAdd$1.run(GameAdd.java:29)
at xxx.Action.execute(Action.java:112)
at xxx.GameAdd.doPost(GameAdd.java:28)
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)
The entity I find is look like:
#Entity
public class Profile
{
public Key getKey() {return key;}
// Other public methods
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
private Key key;
// Other data fields
}
The problem started right after I've upgraded the GAE SDK.
Code wasn't changed. I always did searches using 'long' values that represent profile id.
I tried to use KeyFactory.createKey() method to generate a key for find method but it didn't help either.
Example:
Key key = KeyFactory.createKey(Profile.class.getSimpleName(), 12345);
Profile p = entitymanager.find(Profile.class, key);
I would appreciate any advises since my server application is unavailable and can't serve end users.
Thanks in advance!
There is a chance of a problem in your build environment, especially if you have just upgraded to the new version and everything did work before. Try to use another tool to build the application, e.g. ant. You can find directions here. It is fairly easy and quick to make it work and it should give you an indication whether the problem is indeed in the new IntelliJ GAE support.
Key key = KeyFactory.createKey(Profile.class.getSimpleName(), 12345);
12345 is considered an Int...
Try this:
long longVal = 12345;
Key key = KeyFactory.createKey(Profile.class.getSimpleName(), longVal);
===---===
Let me know if that helps you.
I have an appengine module which runs as a background instance (b4, basic scaling) and which iterates over a huge amount of data and processes it.
It runs correctly through when a smaller amount of data is processed, but when data becomes bigger i start to get multiple Exceptions. At the beginning an InvocationTargetException causes a MemcacheServiceException, which gets then caught by the LogAndContinueErrorHandler (see this thread: Backend "Process moved to a different machine" and fails withh error 500).
After around 14 seconds and another 10 similar Errors, the "Process moved to a different machine.". I suggest the reason is that appengine recognizes the errors and assumes that something is wrong with the instance and shuts it down after a while.
As suggested in the other thread, i could ensure, that the move to a different machine keeps the process going, but since it really has an Error because something is too big / to long i better should work on the error.
Here is the error at the beginning of the error cascade, at the end the error stops on com.googlecode.objectify.cache.MemcacheServiceRetryProxy invoke: Error performing memcache operation, retrying: public abstract void
15:49:18.779
com.google.appengine.api.memcache.LogAndContinueErrorHandler handleServiceError: Service error in memcache
com.google.appengine.api.memcache.MemcacheServiceException: Memcache getAll: exception getting multiple keys
at com.google.appengine.api.memcache.MemcacheServiceApiHelper$RpcResponseHandler.handleApiProxyException(MemcacheServiceApiHelper.java:68)
at com.google.appengine.api.memcache.MemcacheServiceApiHelper$1.absorbParentException(MemcacheServiceApiHelper.java:109)
at com.google.appengine.api.utils.FutureWrapper.handleParentException(FutureWrapper.java:51)
at com.google.appengine.api.utils.FutureWrapper.get(FutureWrapper.java:90)
at com.google.appengine.api.memcache.MemcacheServiceImpl.quietGet(MemcacheServiceImpl.java:26)
at com.google.appengine.api.memcache.MemcacheServiceImpl.getAll(MemcacheServiceImpl.java:64)
at com.googlecode.objectify.cache.KeyMemcacheService.getAll(KeyMemcacheService.java:75)
at com.googlecode.objectify.cache.EntityMemcache.cacheGetAll(EntityMemcache.java:346)
at com.googlecode.objectify.cache.EntityMemcache.putAll(EntityMemcache.java:285)
at com.googlecode.objectify.cache.CachingAsyncDatastoreService$3.success(CachingAsyncDatastoreService.java:280)
at com.googlecode.objectify.cache.CachingAsyncDatastoreService$3.success(CachingAsyncDatastoreService.java:269)
at com.googlecode.objectify.cache.TriggerSuccessFuture.trigger(TriggerSuccessFuture.java:38)
at com.googlecode.objectify.cache.TriggerFuture.isDone(TriggerFuture.java:89)
at com.googlecode.objectify.cache.TriggerFuture.get(TriggerFuture.java:104)
at com.googlecode.objectify.impl.ResultAdapter.now(ResultAdapter.java:34)
at com.googlecode.objectify.impl.Round$2.now(Round.java:135)
at com.googlecode.objectify.impl.Round$2.now(Round.java:132)
at com.googlecode.objectify.impl.LoadEngine$1.nowUncached(LoadEngine.java:172)
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)
at ch.eaternity.server.DAO.loadEntityNow(DAO.java:383)
at ch.eaternity.server.services.ProductServiceImpl.getProduct(ProductServiceImpl.java:21)
at ch.eaternity.server.CompositeRoot.restoreJavaObject(CompositeRoot.java:237)
at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
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.googlecode.objectify.impl.ConcreteEntityMetadata.invokeLifecycleCallbacks(ConcreteEntityMetadata.java:167)
at com.googlecode.objectify.impl.ConcreteEntityMetadata.access$000(ConcreteEntityMetadata.java:24)
at com.googlecode.objectify.impl.ConcreteEntityMetadata$1.run(ConcreteEntityMetadata.java:127)
at com.googlecode.objectify.impl.translate.LoadContext.done(LoadContext.java:70)
at com.googlecode.objectify.impl.LoadEngine$1.postExecuteHook(LoadEngine.java:191)
at com.googlecode.objectify.util.ResultCache.now(ResultCache.java:33)
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:794)
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:553)
at com.google.common.collect.Iterators$PeekingImpl.peek(Iterators.java:1162)
at com.googlecode.objectify.impl.ChunkingIterator.hasNext(ChunkingIterator.java:52)
at com.google.common.collect.Iterators.addAll(Iterators.java:356)
at com.google.common.collect.Lists.newArrayList(Lists.java:147)
at com.google.common.collect.Lists.newArrayList(Lists.java:129)
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:32)
at com.sun.proxy.$Proxy23.toArray(Unknown Source)
at java.util.ArrayList.addAll(ArrayList.java:530)
at ch.eaternity.server.DAO.loadCompositeRootsByDateAndKitchenId(DAO.java:1058)
at ch.eaternity.server.services.ReportServiceImpl.loadCompositeRoots(ReportServiceImpl.java:75)
at ch.eaternity.server.services.ReportServiceImpl.loadSupplies(ReportServiceImpl.java:24)
at ch.eaternity.server.reports.GeneralKitchenDataAnalyzer.generateAndSaveConcreteGeneralKitchenData(GeneralKitchenDataAnalyzer.java:45)
at ch.eaternity.server.servlets.ReportGeneratingServlet.kickOffReportDataGeneration(ReportGeneratingServlet.java:75)
at ch.eaternity.server.servlets.ReportGeneratingServlet.doPost(ReportGeneratingServlet.java:46)
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 ch.eaternity.server.NamespaceFilter.doFilter(NamespaceFilter.java:36)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
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: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)
<continued in next message>
E
15:49:18.779
<continued from previous message>
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:480)
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)
I
15:49:20.272
com.google.appengine.api.memcache.MemcacheServiceApiHelper$RpcResponseHandler handleApiProxyException: Memcache putAll: Unknown exception setting 0 keys:
W
15:49:20.276
com.googlecode.objectify.cache.MemcacheServiceRetryProxy invoke: Error performing memcache operation, retrying: public abstract void com.google.appengine.api.memcache.MemcacheService.putAll(java.util.Map)
java.lang.reflect.InvocationTargetException
at com.google.appengine.runtime.Request.process-fdcbff8350bb99f7(Request.java)
at sun.reflect.GeneratedMethodAccessor11.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:45)
at com.googlecode.objectify.cache.MemcacheServiceRetryProxy.invoke(MemcacheServiceRetryProxy.java:68)
at com.sun.proxy.$Proxy10.putAll(Unknown Source)
at com.googlecode.objectify.cache.KeyMemcacheService.putAll(KeyMemcacheService.java:80)
at com.googlecode.objectify.cache.EntityMemcache.empty(EntityMemcache.java:312)
at com.googlecode.objectify.cache.EntityMemcache.putAll(EntityMemcache.java:296)
at com.googlecode.objectify.cache.CachingAsyncDatastoreService$3.success(CachingAsyncDatastoreService.java:280)
at com.googlecode.objectify.cache.CachingAsyncDatastoreService$3.success(CachingAsyncDatastoreService.java:269)
at com.googlecode.objectify.cache.TriggerSuccessFuture.trigger(TriggerSuccessFuture.java:38)
at com.googlecode.objectify.cache.TriggerFuture.isDone(TriggerFuture.java:89)
at com.googlecode.objectify.cache.TriggerFuture.get(TriggerFuture.java:104)
at com.googlecode.objectify.impl.ResultAdapter.now(ResultAdapter.java:34)
at com.googlecode.objectify.impl.Round$2.now(Round.java:135)
at com.googlecode.objectify.impl.Round$2.now(Round.java:132)
at com.googlecode.objectify.impl.LoadEngine$1.nowUncached(LoadEngine.java:172)
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)
at ch.eaternity.server.DAO.loadEntityNow(DAO.java:383)
at ch.eaternity.server.services.ProductServiceImpl.getProduct(ProductServiceImpl.java:21)
at ch.eaternity.server.CompositeRoot.restoreJavaObject(CompositeRoot.java:237)
at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:45)
at com.googlecode.objectify.impl.ConcreteEntityMetadata.invokeLifecycleCallbacks(ConcreteEntityMetadata.java:167)
at com.googlecode.objectify.impl.ConcreteEntityMetadata.access$000(ConcreteEntityMetadata.java:24)
at com.googlecode.objectify.impl.ConcreteEntityMetadata$1.run(ConcreteEntityMetadata.java:127)
at com.googlecode.objectify.impl.translate.LoadContext.done(LoadContext.java:70)
at com.googlecode.objectify.impl.LoadEngine$1.postExecuteHook(LoadEngine.java:191)
at com.googlecode.objectify.util.ResultCache.now(ResultCache.java:33)
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:794)
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:553)
at com.google.common.collect.Iterators$PeekingImpl.peek(Iterators.java:1162)
at com.googlecode.objectify.impl.ChunkingIterator.hasNext(ChunkingIterator.java:52)
at com.google.common.collect.Iterators.addAll(Iterators.java:356)
at com.google.common.collect.Lists.newArrayList(Lists.java:147)
at com.google.common.collect.Lists.newArrayList(Lists.java:129)
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:32)
at com.sun.proxy.$Proxy23.toArray(Unknown Source)
at java.util.ArrayList.addAll(ArrayList.java:530)
at ch.eaternity.server.DAO.loadCompositeRootsByDateAndKitchenId(DAO.java:1058)
at ch.eaternity.server.services.ReportServiceImpl.loadCompositeRoots(ReportServiceImpl.java:75)
at ch.eaternity.server.services.ReportServiceImpl.loadSupplies(ReportServiceImpl.java:24)
at ch.eaternity.server.reports.GeneralKitchenDataAnalyzer.generateAndSaveConcreteGeneralKitchenData(GeneralKitchenDataAnalyzer.java:45)
at ch.eaternity.server.servlets.ReportGeneratingServlet.kickOffReportDataGeneration(ReportGeneratingServlet.java:75)
at ch.eaternity.server.servlets.ReportGeneratingServlet.doPost(ReportGeneratingServlet.java:46)
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 ch.eaternity.server.NamespaceFilter.doFilter(NamespaceFilter.java:36)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
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 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)
at java.lang.Thread.run(Thread.java:724)
Caused by: com.google.appengine.api.memcache.MemcacheServiceException: Memcache putAll: Unknown exception setting 0 keys
at com.google.appengine.api.memcache.MemcacheServiceApiHelper$RpcResponseHandler.handleApiProxyException(MemcacheServiceApiHelper.java:68)
at com.google.appengine.api.memcache.AsyncMemcacheServiceImpl$RpcResponseHandlerForPut.handleApiProxyException(AsyncMemcacheServiceImpl.java:348)
at com.google.appengine.api.memcache.MemcacheServiceApiHelper$1.absorbParentException(MemcacheServiceApiHelper.java:109)
<continued in next message>
W
15:49:20.276
<continued from previous message>
at com.google.appengine.api.utils.FutureWrapper.handleParentException(FutureWrapper.java:51)
at com.google.appengine.api.utils.FutureWrapper.get(FutureWrapper.java:90)
at com.google.appengine.api.utils.FutureWrapper.get(FutureWrapper.java:88)
at com.google.appengine.api.memcache.MemcacheServiceImpl.quietGet(MemcacheServiceImpl.java:26)
at com.google.appengine.api.memcache.MemcacheServiceImpl.putAll(MemcacheServiceImpl.java:115)
... 91 more
Im not sure weather its related to appengine or objectify, see this thread for comparison:
https://groups.google.com/forum/#!msg/objectify-appengine/GzFmrQNMaI0/1ALIKbEY9agJ
Objectify: 4.0RC2
Appengine: 1.9.9
Update 1
After upgrading to Objectify 4.1.3., no exceptions occur anymore, but at the exactly same point in the iteration the Process moved to a different machine. warning occurs. Why is it moved then to a different machine?
Update 2
In the meantime, i reached couple of times the Memory limit and finally rised the backen instance to B4 which solved the problem for the moment.
java.lang.RuntimeException: java.lang.OutOfMemoryError: Java heap space
Now the error moved a little bit, now i only get this exception around 100 times, until the process gets moved to a different machine.
com.google.appengine.api.memcache.MemcacheServiceException: Memcache getAll: exception getting multiple keys
Update 3
Sometimes the batch process also runs through successfully! I dont understand... I'll try to figure out when its not successfull.
Anyone knowing where the problem could origin from? How to solve it?
Thank you very much!
I don't have a direct answer to your question, but I can shed some light on Objectify's (and GAE's) behavior WRT memcache.
Objectify uses memcache as a read-through cache, so "memcache unavailable" is for all practical purposes the same as "empty result" - Objectify goes and gets the data out of the datastore. GAE's memcache API has a LogAndContinueErrorHandler for exactly this purpose - memecache errors are logged but otherwise ignored.
Unfortunately Google's LogAndContinueErrorHandler had a bug in that some types of memcache errors were neither logged nor ignored. Objectify got some new behavior (the aptly-named MemcacheServiceRetryProxy) which retries memcache API calls a few times and then gives up, returning an empty result. This what you are seeing with 4.0RC2.
Some time later Google fixed the handler not by changing the behavior of LogAndContinueErrorHandler (it was considered likely that some users were relying on exact behavior) but by deprecating that class and adding a ConsistentLogAndContinueErrorHandler which behaves... more consistently. A later version of Objectify switched to use this facility, and now you're seeing that behavior with 4.1.3 - less noisy.
So that's part of the story. Another part of the story is that at some point Objectify was just a little too smugly clever about optimizing calls to memcache, and sometimes would optimize a memcache call down to a zero-length list of keys. The memcache API doesn't like that, which is what might be responsible for Memcache putAll: Unknown exception setting 0 keys. More recent versions of Objectify skip the memcache call if there are no operations.
As for Process moved to a different machine., I have no idea. It might be related, it might not.
Regarding the process moving up on different instance, you can't control it anyhow.A machine may go down anytime and app engine will shift your process to another machine.You task should better be idempotent.
I'm trying to access google admin-directory API to create, delete or remove users as administrator.
I'm trying to develop an application that allows to update or delete a user.
I tried to take two paths.
In the first way, I used the code shown: Google Admin Directory API is returning 400 bad request
But adapting the code is like follows:
HttpTransport httpTransport = new NetHttpTransport();
JacksonFactory jsonFactory = new JacksonFactory();
GoogleCredential credential;
SCOPES.add("https://www.googleapis.com/auth/admin.directory.user");
GoogleCredential credential;
try {
credential = new GoogleCredential.Builder()
.setTransport(httpTransport)
.setJsonFactory(jsonFactory)
.setServiceAccountId(
"XXXXXXXXXX#developer.gserviceaccount.com")
.setServiceAccountUser("XXX#subdomain.domain.com")//(The administrator account)
.setServiceAccountScopes(SCOPES)
.setServiceAccountPrivateKeyFromP12File(
new File("WEB-INF/KeY.p12")).build();
credential.setAccessToken(oauthToken);
resp.getWriter().println(credential.getServiceAccountId());
Directory directory = new Directory.Builder(httpTransport, jsonFactory, credential).setApplicationName("User Sync Service")
.setHttpRequestInitializer(credential).setApplicationName("Example APP").build();
resp.getWriter().println();
Directory.Users.List list = directory.users().list();
list.setDomain("subdomain.domain.com");
Users users = list.execute();
In this case, the problem is when the Directory object (Directory directory = new Directory.Builder(...) ) instanciate's or executes, and this is the error:
Uncaught exception from servlet
com.google.api.client.auth.oauth2.TokenResponseException: 400 OK
{
"error" : "invalid_grant"
}
at com.google.api.client.auth.oauth2.TokenResponseException.from(TokenResponseException.java:105)
at com.google.api.client.auth.oauth2.TokenRequest.executeUnparsed(TokenRequest.java:332)
at com.google.api.client.auth.oauth2.TokenRequest.execute(TokenRequest.java:352)
at com.google.api.client.googleapis.auth.oauth2.GoogleCredential.executeRefreshToken(GoogleCredential.java:269)
at com.google.api.client.auth.oauth2.Credential.refreshToken(Credential.java:454)
at com.google.api.client.auth.oauth2.Credential.intercept(Credential.java:215)
at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:854)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:410)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:343)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460)
at com.ejemploprueba.Inbox.doGet(Inbox.java:85)
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.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: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:435)
at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:442)
at com.google.tracing.CurrentContext.runInContext(CurrentContext.java:186)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:306)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:298)
at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:439)
at com.google.apphosting.runtime.ThreadGroupPool$PoolEntry.run(ThreadGroupPool.java:251)
at java.lang.Thread.run(Thread.java:722)
The second way is to create a servlet that call to the api with SCOPE = "https://www.googleapis.com/auth/admin.directory.user", to
get the acces_token and the user in a second servlet.
In this way I find the problem to create a GoogleCredential and connect to with the services server with the acces_token and the user, and then instantiate the object "Directory" to show in step 1.
Where:
acces_token: ya29.AHES6ZREQdCcm7FqZGg3Do0jYxN-XXXXXXXXXXX-YYYYYYYYYYYYYy
and
User: user#subdomain.domain.com
I enabled the "Admin SDK" option into the Google Api Console / Services
How can I fix the error that occurs in the first case?
What is the solution to the second way?
What it's the better solution, the first way or the second?
Thank you very much in advance and greetings.
For case 1 when you call:
credential.setAccessToken(oauthToken);
You are replacing the access token obtained from the Google Authorization Server with the content of oauthToken, which looks like is not a valid access token for that service account.
Not sure if this will help you, but I've done something similar in C#.
Had some serious authorization-issues at first, but finally made it.
Check this stackoverflow
Trying to Create users in Google Apps domain in Windows Forms code
In dropdownBox I have list of pages. When I chose one I want to go to that page.
How should I implement it ? I am supposed to add this code but I don't know what should I do onUpdate. I didn't find any method to change the page
new AjaxFormComponentUpdatingBehavior() {
private static final long serialVersionUID = 1L;
#Override
protected void onUpdate(AjaxRequestTarget target) {
}
}
UPDATE:
Exception when I try first response:
29 Jun 2012 10:07:01,772 ERROR [1215661#qtp-28488784-5] org.apache.wicket.DefaultExceptionMapper : Unexpected error occurred
org.apache.wicket.WicketRuntimeException: Method onRequest of interface org.apache.wicket.behavior.IBehaviorListener targeted at cz.isvs.reg.rob.monitor.web.BasePage$1 {event='onchange'} on component [DropDownChoice [Component id = vyjimkyPage]] threw an exception
at org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:270)
at org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:241)
at org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:255)
at org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:234)
at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:784)
at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:255)
at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:212)
at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:283)
at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:188)
at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:244)
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:440)
at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
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:943)
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.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
Caused by: java.lang.reflect.InvocationTargetException
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:616)
at org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:260)
... 27 more
Caused by: java.lang.IllegalStateException: Attempt to set model object on null model of component: vyjimkyPage
at org.apache.wicket.Component.setDefaultModelObject(Component.java:3054)
at org.apache.wicket.markup.html.form.FormComponent.setModelObject(FormComponent.java:1498)
at org.apache.wicket.markup.html.form.FormComponent.updateModel(FormComponent.java:1059)
at org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior.onEvent(AjaxFormComponentUpdatingBehavior.java:154)
at org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:184)
at org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:369)
... 32 more
You can do something like this
protected void onUpdate(AjaxRequestTarget target){
target.prependJavaScript("window.location.href='"+urlFor(new YourPage())+'");
}
It will change the browser's url and thus redirect.
AbstractSingleSelectChoice components (the parent of DropDownChoice) cannot use the AjaxFormComponentUpdatingBehavior. The class javadoc refers you to the AjaxFormChoiceComponentUpdatingBehavior:
NOTE: This behavior does not work on Choices or Groups use the AjaxFormChoiceComponentUpdatingBehavior for that.
It's also true that you should be using a model if you use a AjaxFormChoiceComponentUpdatingBehavior as it will perform field conversion, validation, and push to the model... Keep in mind that id you don't care about the value, you can simply provide an empty model that you never read later.
Finally, in Wicket, you can do a redirect that will update the browser's url by throwing a RedirectException (a runtime exception that expects a Page class and optional PageParameters) or a RedirectToUrlException which expects a string url:
throw new RedirectToUrlException("http://www.supercoolwebsite.com/supercoolexternalpage");
vs
throw new RedirectException(SuperCoolWicketPage.class);