1
을 지원하지 않습니다 내 코드가 보이는

는 같은 난에 대해 아무 생각이없는 예외가 발생구글 앱 엔진은 비전 API를 Runtime.addShutdownHook 오류

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.<init>(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) 
    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:453) 
    at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:460) 
    at com.google.tracing.CurrentContext.runInContext(CurrentContext.java:293) 
    at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:319) 
    at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:311) 
    at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:457) 
    at java.lang.Thread.run(Thread.java:745) 

답변

1

Google의 응답을 기반으로 Google 비전 엔진과 grpc 간의 알려진 호환성 문제

0

구글 앱 엔진은 자바 7 Runtime.addShutdownHook을 지원하지 않습니다,하지만 지원 자바 8 : I AppEngine에 아무 문제가 없었다 기존 라이브러리와

, 나는 그 동안이를 사용하는 것이 좋습니다 것입니다. github에서 확인하십시오.

Google App Engine Standard Environment 용 Java 8로 마이그레이션하는 방법은 무엇입니까? 당신의에서 appengine-web.xml에
1. 당신의 pom.xml에

<appengine-web-app xmlns="http://appengine.google.com/ns/1.0"> 
    ... 
    <runtime>java8</runtime> 
</appengine-web-app> 

2. 수행

<project> 
    ... 
    <properties> 
     ... 
     <maven.compiler.source>1.8</maven.compiler.source> 
     <maven.compiler.target>1.8</maven.compiler.target> 
    </properties> 
</project> 

을 추가합니다. 이제는 효과가 있습니다.