Google Pub/Sub 在 GAE 中

Google Pub/Sub in GAE

在 GAE 应用程序中使用 pub/sub java 客户端库不起作用,我得到一个异常

Caused by: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "shutdownHooks")
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:372)
at java.security.AccessController.checkPermission(AccessController.java:559)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
at com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkPermission(DevAppServerFactory.java:442)
at java.lang.Runtime.addShutdownHook(Runtime.java:209)
at com.google.common.util.concurrent.MoreExecutors$Application.addShutdownHook(MoreExecutors.java:223)
at com.google.common.util.concurrent.MoreExecutors$Application.addDelayedShutdownHook(MoreExecutors.java:195)
at com.google.common.util.concurrent.MoreExecutors$Application.getExitingScheduledExecutorService(MoreExecutors.java:187)
at com.google.common.util.concurrent.MoreExecutors$Application.getExitingScheduledExecutorService(MoreExecutors.java:219)
at com.google.common.util.concurrent.MoreExecutors.getExitingScheduledExecutorService(MoreExecutors.java:169)
at com.google.api.gax.grpc.InstantiatingExecutorProvider.getExecutor(InstantiatingExecutorProvider.java:53)
at com.google.cloud.pubsub.spi.v1.Publisher.<init>(Publisher.java:128)
at com.google.cloud.pubsub.spi.v1.Publisher.<init>(Publisher.java:76)
at com.google.cloud.pubsub.spi.v1.Publisher$Builder.build(Publisher.java:642)

基本上它试图添加一个不允许的关闭钩子。

我错过了什么?

该库尚不支持GAE标准环境,仅灵活,参见https://github.com/GoogleCloudPlatform/google-cloud-java/tree/master/google-cloud-pubsub

这应该记录在 Google 文档中,而不是 Github

中的说明