0

After adding Google Storage to a Google Endpoints app written in Java, the web instances seem not to be able to start up anymore, when deployed to GAE. However, all works fine when run locally (mvn appengine:run).

Exception from the logs:

Failed startup of context

c.g.a.r.j.AppEngineWebAppContext@442bff20{/,file:///workspace/,UNAVAILABLE}{/workspace}
com.google.apphosting.api.ApiProxy$FeatureNotEnabledException: app_identity_service.GetAccessToken 
    at java.base/java.lang.Thread.getStackTrace(Thread.java:1602)
    at com.google.apphosting.runtime.ApiProxyImpl.doSyncCall(ApiProxyImpl.java:362)
    at com.google.apphosting.runtime.ApiProxyImpl.lambda$makeSyncCall$0(ApiProxyImpl.java:284)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at com.google.apphosting.runtime.ApiProxyImpl.makeSyncCall(ApiProxyImpl.java:283)
    at com.google.apphosting.runtime.ApiProxyImpl.makeSyncCall(ApiProxyImpl.java:81)
    at com.google.apphosting.api.ApiProxy.makeSyncCall(ApiProxy.java:120)
    at com.google.apphosting.api.ApiProxy.makeSyncCall(ApiProxy.java:81)
    at com.google.appengine.api.appidentity.AppIdentityServiceImpl.getAccessTokenUncached(AppIdentityServiceImpl.java:250)
    at com.google.appengine.api.appidentity.AppIdentityServiceImpl.getAccessToken(AppIdentityServiceImpl.java:327)
    at endpoints.repackaged.com.google.api.client.googleapis.extensions.appengine.auth.oauth2.AppIdentityCredential.intercept(AppIdentityCredential.java:98)
    at endpoints.repackaged.com.google.api.client.googleapis.extensions.appengine.auth.oauth2.AppIdentityCredential$AppEngineCredentialWrapper.intercept(AppIdentityCredential.java:243)
    at endpoints.repackaged.com.google.api.client.http.HttpRequest.execute(HttpRequest.java:868)
    at endpoints.repackaged.com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:419)
    at endpoints.repackaged.com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:352)
    at endpoints.repackaged.com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:469)
    at endpoints.repackaged.com.google.api.config.ServiceConfigSupplier.fetchLatestServiceVersion(ServiceConfigSupplier.java:179)
    at endpoints.repackaged.com.google.api.config.ServiceConfigSupplier.fetch(ServiceConfigSupplier.java:146)
    at endpoints.repackaged.com.google.api.config.ServiceConfigSupplier.get(ServiceConfigSupplier.java:131)
    at endpoints.repackaged.com.google.api.config.ServiceConfigSupplier.get(ServiceConfigSupplier.java:50)
    at endpoints.repackaged.com.google.common.base.Suppliers$ExpiringMemoizingSupplier.get(Suppliers.java:241)
    at endpoints.repackaged.com.google.api.config.ServiceConfigFetcher.fetch(ServiceConfigFetcher.java:41)
    at com.google.api.control.ServiceManagementConfigFilter$1.load(ServiceManagementConfigFilter.java:33)
    at com.google.api.control.ConfigFilter.init(ConfigFilter.java:90)
    at org.eclipse.jetty.servlet.FilterHolder.initialize(FilterHolder.java:140)
    at org.eclipse.jetty.servlet.ServletHandler.lambda$initialize$0(ServletHandler.java:750)
    at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
    at java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:734)
    at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:658)
    at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:774)
    at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:379)
    at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1449)
    at com.google.apphosting.runtime.jetty94.AppEngineWebAppContext.startWebapp(AppEngineWebAppContext.java:274)
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1414)
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:916)
    at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:288)
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:524)
    at com.google.apphosting.runtime.jetty94.AppEngineWebAppContext.doStart(AppEngineWebAppContext.java:218)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
    at com.google.apphosting.runtime.jetty94.AppVersionHandlerFactory.doCreateHandler(AppVersionHandlerFactory.java:207)
    at com.google.apphosting.runtime.jetty94.AppVersionHandlerFactory.createHandler(AppVersionHandlerFactory.java:125)
    at com.google.apphosting.runtime.jetty94.AppVersionHandlerMap.getHandler(AppVersionHandlerMap.java:82)
    at com.google.apphosting.runtime.jetty94.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:176)
    at com.google.apphosting.runtime.RequestRunner.dispatchServletRequest(RequestRunner.java:264)
    at com.google.apphosting.runtime.RequestRunner.dispatchRequest(RequestRunner.java:229)
    at com.google.apphosting.runtime.RequestRunner.run(RequestRunner.java:194)
    at com.google.apphosting.runtime.ThreadGroupPool$PoolEntry.run(ThreadGroupPool.java:273)
    at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: com.google.apphosting.api.ApiProxy$FeatureNotEnabledException: app_identity_service.GetAccessToken 
    at com.google.apphosting.utils.runtime.ApiProxyUtils.convertApiError(ApiProxyUtils.java:81)
    at com.google.apphosting.utils.runtime.ApiProxyUtils.getApiError(ApiProxyUtils.java:198)
    at com.google.apphosting.runtime.ApiProxyImpl$AsyncApiFuture.success(ApiProxyImpl.java:684)
    at com.google.apphosting.runtime.ApiProxyImpl$AsyncApiFuture.success(ApiProxyImpl.java:581)
    at com.google.apphosting.runtime.http.HttpApiHostClient.receivedResponse(HttpApiHostClient.java:296)
    at com.google.apphosting.runtime.http.JettyHttpApiHostClient$Listener.onComplete(JettyHttpApiHostClient.java:206)
    at org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:218)
    at org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:210)
    at org.eclipse.jetty.client.HttpReceiver.terminateResponse(HttpReceiver.java:481)
    at org.eclipse.jetty.client.HttpReceiver.terminateResponse(HttpReceiver.java:461)
    at org.eclipse.jetty.client.HttpReceiver.responseSuccess(HttpReceiver.java:424)
    at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.messageComplete(HttpReceiverOverHTTP.java:374)
    at org.eclipse.jetty.http.HttpParser.handleContentMessage(HttpParser.java:597)
    at org.eclipse.jetty.http.HttpParser.parseContent(HttpParser.java:1722)
    at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:1551)
    at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.parse(HttpReceiverOverHTTP.java:208)
    at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.process(HttpReceiverOverHTTP.java:148)
    at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.receive(HttpReceiverOverHTTP.java:80)
    at org.eclipse.jetty.client.http.HttpChannelOverHTTP.receive(HttpChannelOverHTTP.java:131)
    at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.onFillable(HttpConnectionOverHTTP.java:172)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
    at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    ... 1 more

What is the reason for the following exception and how can it be fixed?

com.google.apphosting.api.ApiProxy$FeatureNotEnabledException: app_identity_service.GetAccessToken 

The app is built with maven has the following dependencies in pom.xml:

  <!-- See https://cloud.google.com/java/docs/bom -->
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>com.google.cloud</groupId>
        <artifactId>libraries-bom</artifactId>
        <version>25.4.0</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <dependency>
      <groupId>com.google.endpoints</groupId>
      <artifactId>endpoints-management-control-appengine-all</artifactId>
      <version>1.0.14</version>
    </dependency>

    <dependency>
      <groupId>com.google.appengine</groupId>
      <artifactId>appengine-api-1.0-sdk</artifactId>
      <version>2.0.5</version>
    </dependency>

    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <version>3.1.0</version>
      <type>jar</type>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>javax.inject</groupId>
      <artifactId>javax.inject</artifactId>
      <version>1</version>
    </dependency>

    <dependency>
      <groupId>com.luhuiguo</groupId>
      <artifactId>aspose-pdf</artifactId>
      <version>23.1</version>
    </dependency>

    <dependency>
      <groupId>com.google.cloud</groupId>
      <artifactId>google-cloud-storage</artifactId>
      <!-- <version>1.118.1</version> -->
    </dependency>

    <dependency>
      <groupId>com.google.endpoints</groupId>
      <artifactId>endpoints-framework</artifactId>
      <version>${endpoints.framework.version}</version>
    </dependency>

  </dependencies>
Mutual Exception
  • 1,240
  • 12
  • 27
  • If your application is trying to call an API which is not enabled for the Java 11 runtime,which means the app appears to still be on the Java 8 runtime which is not supported anymore it will receive a `com.google.apphosting.api.ApiProxy$FeatureNotEnabledException error`. – Sathi Aiswarya Feb 27 '23 at 14:09
  • Thanks @SathiAiswarya - I think you are definitely on to something, since I was forced to go from java8 to java11 first, then to java17. So now the app is running under java17, which I can verify in the app engine's console under versions. However I don't really understand where the conflict is and how I can resolve it. Can you try to elaborate a bit more what you suspect about the issue? – Mutual Exception Mar 01 '23 at 07:14
  • seems App Engine API not enabled, enable the API in deploy.yaml and check – Sathi Aiswarya Mar 01 '23 at 15:11
  • Could you try setting the dependency version for google-cloud-storage to 2.19.0? – vpgcloud Mar 07 '23 at 15:46
  • How are you instantiating your google.cloud.storage.Client() instance? Ensure that it maintains state by instantiating it whenever necessary or make it as a singleton so that it can create a state and be reusable whenever necessary, – Ernani Joppert Mar 21 '23 at 05:48

0 Answers0