We recently started looking into switching to java 8 so that we can use the myriad benefits that it offers including grpc. We tried using grpc for the google cloud natural language API but we were unable to get that to work. Here is the stack trace that we hit when trying to make the analyzeSentiment call.
com.google.api.server.spi.SystemService invokeServiceMethod: exception occurred while calling backend method (SystemService.java:398 <https://console.cloud.google.com/debug/fromlog?appModule=default&appVersion=aniruddha2&file=SystemService.java&line=398&logInsertId=5965ffa200005d6159bb2c7b&logNanos=1499856800011609000&nestedLogIndex=45&project=village-test>) com.google.api.gax.grpc.ApiException: io.grpc.StatusRuntimeException: UNAUTHENTICATED at com.google.api.gax.grpc.ExceptionTransformingCallable$ExceptionTransformingFuture.onFailure( ExceptionTransformingCallable.java:108 <https://console.cloud.google.com/debug/fromlog?appModule=default&appVersion=aniruddha2&file=com%2Fgoogle%2Fapi%2Fgax%2Fgrpc%2FExceptionTransformingCallable.java&line=108&logInsertId=5965ffa200005d6159bb2c7b&logNanos=1499856800011609000&nestedLogIndex=45&project=village-test>) at com.google.api.core.ApiFutures$1.onFailure(ApiFutures.java:53 <https://console.cloud.google.com/debug/fromlog?appModule=default&appVersion=aniruddha2&file=com%2Fgoogle%2Fapi%2Fcore%2FApiFutures.java&line=53&logInsertId=5965ffa200005d6159bb2c7b&logNanos=1499856800011609000&nestedLogIndex=45&project=village-test>) at com.google.common.util.concurrent.Futures$4.run(Futures.java:1123 <https://console.cloud.google.com/debug/fromlog?appModule=default&appVersion=aniruddha2&file=com%2Fgoogle%2Fcommon%2Futil%2Fconcurrent%2FFutures.java&line=1123&logInsertId=5965ffa200005d6159bb2c7b&logNanos=1499856800011609000&nestedLogIndex=45&project=village-test>) at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute( MoreExecutors.java:435 <https://console.cloud.google.com/debug/fromlog?appModule=default&appVersion=aniruddha2&file=com%2Fgoogle%2Fcommon%2Futil%2Fconcurrent%2FMoreExecutors.java&line=435&logInsertId=5965ffa200005d6159bb2c7b&logNanos=1499856800011609000&nestedLogIndex=45&project=village-test>) at com.google.common.util.concurrent.AbstractFuture.executeListener( AbstractFuture.java:900 <https://console.cloud.google.com/debug/fromlog?appModule=default&appVersion=aniruddha2&file=com%2Fgoogle%2Fcommon%2Futil%2Fconcurrent%2FAbstractFuture.java&line=900&logInsertId=5965ffa200005d6159bb2c7b&logNanos=1499856800011609000&nestedLogIndex=45&project=village-test>) at com.google.common.util.concurrent.AbstractFuture.complete( AbstractFuture.java:811 <https://console.cloud.google.com/debug/fromlog?appModule=default&appVersion=aniruddha2&file=com%2Fgoogle%2Fcommon%2Futil%2Fconcurrent%2FAbstractFuture.java&line=811&logInsertId=5965ffa200005d6159bb2c7b&logNanos=1499856800011609000&nestedLogIndex=45&project=village-test>) at com.google.common.util.concurrent.AbstractFuture.setException( AbstractFuture.java:675 <https://console.cloud.google.com/debug/fromlog?appModule=default&appVersion=aniruddha2&file=com%2Fgoogle%2Fcommon%2Futil%2Fconcurrent%2FAbstractFuture.java&line=675&logInsertId=5965ffa200005d6159bb2c7b&logNanos=1499856800011609000&nestedLogIndex=45&project=village-test>) at io.grpc.stub.ClientCalls$GrpcFuture.setException(ClientCalls.java:466 <https://console.cloud.google.com/debug/fromlog?appModule=default&appVersion=aniruddha2&file=io%2Fgrpc%2Fstub%2FClientCalls.java&line=466&logInsertId=5965ffa200005d6159bb2c7b&logNanos=1499856800011609000&nestedLogIndex=45&project=village-test>) at io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:442 <https://console.cloud.google.com/debug/fromlog?appModule=default&appVersion=aniruddha2&file=io%2Fgrpc%2Fstub%2FClientCalls.java&line=442&logInsertId=5965ffa200005d6159bb2c7b&logNanos=1499856800011609000&nestedLogIndex=45&project=village-test>) at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:426 <https://console.cloud.google.com/debug/fromlog?appModule=default&appVersion=aniruddha2&file=io%2Fgrpc%2Finternal%2FClientCallImpl.java&line=426&logInsertId=5965ffa200005d6159bb2c7b&logNanos=1499856800011609000&nestedLogIndex=45&project=village-test>) at io.grpc.internal.ClientCallImpl.access$100(ClientCallImpl.java:76 <https://console.cloud.google.com/debug/fromlog?appModule=default&appVersion=aniruddha2&file=io%2Fgrpc%2Finternal%2FClientCallImpl.java&line=76&logInsertId=5965ffa200005d6159bb2c7b&logNanos=1499856800011609000&nestedLogIndex=45&project=village-test>) at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close( ClientCallImpl.java:512 <https://console.cloud.google.com/debug/fromlog?appModule=default&appVersion=aniruddha2&file=io%2Fgrpc%2Finternal%2FClientCallImpl.java&line=512&logInsertId=5965ffa200005d6159bb2c7b&logNanos=1499856800011609000&nestedLogIndex=45&project=village-test>) at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$700( ClientCallImpl.java:429 <https://console.cloud.google.com/debug/fromlog?appModule=default&appVersion=aniruddha2&file=io%2Fgrpc%2Finternal%2FClientCallImpl.java&line=429&logInsertId=5965ffa200005d6159bb2c7b&logNanos=1499856800011609000&nestedLogIndex=45&project=village-test>) at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext( ClientCallImpl.java:544 <https://console.cloud.google.com/debug/fromlog?appModule=default&appVersion=aniruddha2&file=io%2Fgrpc%2Finternal%2FClientCallImpl.java&line=544&logInsertId=5965ffa200005d6159bb2c7b&logNanos=1499856800011609000&nestedLogIndex=45&project=village-test>) at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:52 <https://console.cloud.google.com/debug/fromlog?appModule=default&appVersion=aniruddha2&file=io%2Fgrpc%2Finternal%2FContextRunnable.java&line=52&logInsertId=5965ffa200005d6159bb2c7b&logNanos=1499856800011609000&nestedLogIndex=45&project=village-test>) at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:117 <https://console.cloud.google.com/debug/fromlog?appModule=default&appVersion=aniruddha2&file=io%2Fgrpc%2Finternal%2FSerializingExecutor.java&line=117&logInsertId=5965ffa200005d6159bb2c7b&logNanos=1499856800011609000&nestedLogIndex=45&project=village-test>) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:295) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: io.grpc.StatusRuntimeException: UNAUTHENTICATED at io.grpc.Status.asRuntimeException(Status.java:543 <https://console.cloud.google.com/debug/fromlog?appModule=default&appVersion=aniruddha2&file=io%2Fgrpc%2FStatus.java&line=543&logInsertId=5965ffa200005d6159bb2c7b&logNanos=1499856800011609000&nestedLogIndex=45&project=village-test>) ... 15 more Caused by: java.io.IOException: Could not get the access token. at com.google.auth.oauth2.AppEngineCredentials.refreshAccessToken( AppEngineCredentials.java:136 <https://console.cloud.google.com/debug/fromlog?appModule=default&appVersion=aniruddha2&file=com%2Fgoogle%2Fauth%2Foauth2%2FAppEngineCredentials.java&line=136&logInsertId=5965ffa200005d6159bb2c7b&logNanos=1499856800011609000&nestedLogIndex=45&project=village-test>) at com.google.auth.oauth2.OAuth2Credentials.refresh( OAuth2Credentials.java:149 <https://console.cloud.google.com/debug/fromlog?appModule=default&appVersion=aniruddha2&file=com%2Fgoogle%2Fauth%2Foauth2%2FOAuth2Credentials.java&line=149&logInsertId=5965ffa200005d6159bb2c7b&logNanos=1499856800011609000&nestedLogIndex=45&project=village-test>) at com.google.auth.oauth2.OAuth2Credentials.getRequestMetadata( OAuth2Credentials.java:135 <https://console.cloud.google.com/debug/fromlog?appModule=default&appVersion=aniruddha2&file=com%2Fgoogle%2Fauth%2Foauth2%2FOAuth2Credentials.java&line=135&logInsertId=5965ffa200005d6159bb2c7b&logNanos=1499856800011609000&nestedLogIndex=45&project=village-test>) at io.grpc.auth.GoogleAuthLibraryCallCredentials$1.run( GoogleAuthLibraryCallCredentials.java:110 <https://console.cloud.google.com/debug/fromlog?appModule=default&appVersion=aniruddha2&file=io%2Fgrpc%2Fauth%2FGoogleAuthLibraryCallCredentials.java&line=110&logInsertId=5965ffa200005d6159bb2c7b&logNanos=1499856800011609000&nestedLogIndex=45&project=village-test>) ... 7 more Caused by: java.lang.reflect.InvocationTargetException 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 com.google.auth.oauth2.AppEngineCredentials.refreshAccessToken( AppEngineCredentials.java:131 <https://console.cloud.google.com/debug/fromlog?appModule=default&appVersion=aniruddha2&file=com%2Fgoogle%2Fauth%2Foauth2%2FAppEngineCredentials.java&line=131&logInsertId=5965ffa200005d6159bb2c7b&logNanos=1499856800011609000&nestedLogIndex=45&project=village-test>) ... 10 more Caused by: com.google.apphosting.api.ApiProxy$CallNotFoundException: Can't make API call memcache.Get in a thread that is neither the original request thread nor a thread created by ThreadManager at com.google.apphosting.api.ApiProxy$CallNotFoundException.foreignThread(ApiProxy.java:844) at com.google.apphosting.api.ApiProxy$1.get(ApiProxy.java:183) at com.google.apphosting.api.ApiProxy$1.get(ApiProxy.java:180) at com.google.appengine.api.utils.FutureWrapper.get(FutureWrapper.java:93) at com.google.appengine.api.memcache.MemcacheServiceImpl.quietGet(MemcacheServiceImpl.java:28) at com.google.appengine.api.memcache.MemcacheServiceImpl.get(MemcacheServiceImpl.java:51) at com.google.appengine.api.appidentity.AppIdentityServiceImpl.getAccessToken(AppIdentityServiceImpl.java:300) ... 15 more The stack trace looks similar to the one posted in this link: https://github.com/GoogleCloudPlatform/google-cloud-java/issues/1918#issuecomment-299004772. It's unclear from the discussion there whether this issue was ever fixed. In either case, what can we do to get around this? Thanks, Anand -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/google-appengine. To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/e973c26a-5b8d-4fd0-ae9f-aed98230c743%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
