GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Vision API broken: Google App Engine does not support Runtime.addShutdownHook · Issue #1800 · googleapis/google-cloud-java

Vision API broken: Google App Engine does not support Runtime.addShutdownHook #1800

New issue
Copy link
New issue
Copy link
Closed
Closed
Vision API broken: Google App Engine does not support Runtime.addShutdownHook#1800
Copy link
Assignees
garrettjonesgoogle
Labels
api: visionIssues related to the Cloud Vision API.running on app engine

Description

@ramramanathan1
ramramanathan1
opened on Mar 23, 2017
Issue body actions

@apimethod(name = "analyzeImage")
public Message analyzeImage(@nAmed("imgURL") String imgURL) {
try {
GoogleCredential credential = GoogleCredential.getApplicationDefault();

         ImageAnnotatorClient vision = ImageAnnotatorClient.create();

     // Performs label detection on the image file
        BatchAnnotateImagesResponse response = vision.batchAnnotateImages(requests);
        List<AnnotateImageResponse> responses = response.getResponsesList();

        for (AnnotateImageResponse res : responses) {
          if (res.hasError()) {
            System.out.printf("Error: %s\n", res.getError().getMessage());
            return new Message("Something broke");
          }

          for (EntityAnnotation annotation : res.getLabelAnnotationsList()) {
            Map<FieldDescriptor, Object> m = annotation.getAllFields();
            Set<FieldDescriptor> s = m.keySet();
            for(FieldDescriptor key : s){
                System.out.printf("%s : %s\n", key, m.get(key).toString());
            }
          }
        }
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return new Message("Hello:" + imgURL);
  } 

However, the line

ImageAnnotatorClient vision = ImageAnnotatorClient.create();

ends up throwing:
java.lang.SecurityException: Google App Engine does not support Runtime.addShutdownHook
at com.google.appengine.runtime.Request.process-75407a6647252b61(Request.java)
at java.lang.Runtime.addShutdownHook(Runtime.java:45)
at com.google.common.util.concurrent.MoreExecutors$Application.addShutdownHook(MoreExecutors.java:232)
at com.google.common.util.concurrent.MoreExecutors$Application.addDelayedShutdownHook(MoreExecutors.java:204)
at com.google.common.util.concurrent.MoreExecutors$Application.getExitingScheduledExecutorService(MoreExecutors.java:196)
at com.google.common.util.concurrent.MoreExecutors$Application.getExitingScheduledExecutorService(MoreExecutors.java:228)
at com.google.common.util.concurrent.MoreExecutors.getExitingScheduledExecutorService(MoreExecutors.java:176)
at com.google.api.gax.grpc.InstantiatingExecutorProvider.getExecutor(InstantiatingExecutorProvider.java:51)
at com.google.api.gax.grpc.ChannelAndExecutor.create(ChannelAndExecutor.java:62)
at com.google.api.gax.grpc.ClientSettings.getChannelAndExecutor(ClientSettings.java:81)
at com.google.cloud.vision.spi.v1.ImageAnnotatorClient.(ImageAnnotatorClient.java:120)
at com.google.cloud.vision.spi.v1.ImageAnnotatorClient.create(ImageAnnotatorClient.java:111)
at com.google.cloud.vision.spi.v1.ImageAnnotatorClient.create(ImageAnnotatorClient.java:102)
at photography.viks.ig.api.InstaSmartSvc.analyzeImage(InstaSmartSvc.java:93)
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:42)
at com.google.api.server.spi.SystemService.invokeServiceMethod(SystemService.java:351)
at com.google.api.server.spi.handlers.EndpointsMethodHandler$RestHandler.handle(EndpointsMethodHandler.java:114)
at com.google.api.server.spi.handlers.EndpointsMethodHandler$RestHandler.handle(EndpointsMethodHandler.java:102)
at com.google.api.server.spi.dispatcher.PathDispatcher.dispatch(PathDispatcher.java:49)
at com.google.api.server.spi.EndpointsServlet.service(EndpointsServlet.java:71)
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.api.control.ControlFilter.doFilter(ControlFilter.java:220)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.api.control.ConfigFilter.doFilter(ConfigFilter.java:120)
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)

Activity

Next
  1. garrettjonesgoogle
    added
    running on app engine
    api: visionIssues related to the Cloud Vision API.
    on Mar 23, 2017
  2. garrettjonesgoogle commented on May 30, 2017

    @garrettjonesgoogle
    garrettjonesgoogle
    on May 30, 2017
    Contributor
    More actions

    Development since this issue was filed: Java 8 on App Engine Standard will support gRPC, so Vision should work in that environment. Unfortunately, it won't work on Java 7 and there are no plans to support that. The work to get open issues fixed for Java 8 on App Engine Standard is being tracked in #1918 . I am going to close out the present issue - follow along in #1918 for progress.

  3. garrettjonesgoogle
    closed this as completedon May 30, 2017
  4. JustinBeckwith
    assigned
    garrettjonesgoogle
    on Feb 1, 2021
  5. meltsufin
    added 2 commits that reference this issue on Dec 22, 2025

    chore: Java 8 unit test to build code in Java 17 and run tests on Jav…

    a53fb16

    chore(main): release 3.22.3 (#1800)

    788fe1c
  6. chingor13
    added a commit that references this issue on Jan 6, 2026

    chore: Java 8 unit test to build code in Java 17 and run tests on Jav…

    0f5cace
  7. chingor13
    added a commit that references this issue on Jan 22, 2026

    chore: Java 8 unit test to build code in Java 17 and run tests on Jav…

    a0e9b30
  8. chingor13
    added 3 commits that reference this issue on Feb 20, 2026

    chore: Java 8 unit test to build code in Java 17 and run tests on Jav…

    fce8126

    chore: Java 8 unit test to build code in Java 17 and run tests on Jav…

    a684040

    chore: follow up of #1798 (#1800)

    2856b87
  9. suztomo
    added 3 commits that reference this issue on Mar 9, 2026

    chore: Java 8 unit test to build code in Java 17 and run tests on Jav…

    8c6b9e5

    chore: Java 8 unit test to build code in Java 17 and run tests on Jav…

    75866a6

    chore(main): release 3.22.3 (googleapis#1800)

    7cfe63f
  10. 2 remaining items

  11. suztomo
    added 3 commits that reference this issue on Mar 23, 2026

    chore: Java 8 unit test to build code in Java 17 and run tests on Jav…

    7f238a4

    deps: update dependency com.google.cloud:sdk-platform-java-config to …

    36b3606

    chore(main): release 2.24.0 (googleapis#1794)

    4338f0d
  12. suztomo
    added a commit that references this issue on Mar 30, 2026

    chore: Java 8 unit test to build code in Java 17 and run tests on Jav…

    9b9afd9
  13. lqiu96
    added a commit that references this issue on Apr 1, 2026

    chore: Java 8 unit test to build code in Java 17 and run tests on Jav…

    a8a57d5
  14. meltsufin
    added 7 commits that reference this issue on Apr 29, 2026

    chore: Java 8 unit test to build code in Java 17 and run tests on Jav…

    cb87aa9

    deps: update dependency com.google.cloud:google-cloud-storage to v2.2…

    8c43cc2

    chore(main): release 1.133.0 (#2206)

    a3b6539

    chore: Java 8 unit test to build code in Java 17 and run tests on Jav…

    e58918b

    deps: update dependency com.google.cloud:google-cloud-storage to v2.2…

    e98e29e

    chore(main): release 1.133.0 (#2206)

    1180af9

    deps: update dependency com.google.api.grpc:proto-google-cloud-trace-…

    eff1eef
  15. benjaminp
    added 3 commits that reference this issue on Jul 13, 2026

    deps: update dependency org.graalvm.buildtools:native-maven-plugin to…

    bd8b49d

    chore: Java 8 unit test to build code in Java 17 and run tests on Jav…

    95d4905

    chore(main): release 2.24.0 (googleapis#1794)

    da36c00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @garrettjonesgoogle
    garrettjonesgoogle

Labels

api: visionIssues related to the Cloud Vision API.running on app engine

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.