GAE中的Google Pub / Sub

时间:2017-06-14 08:45:24

标签: java google-app-engine google-cloud-pubsub client-library

在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)

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

我错过了什么?

1 个答案:

答案 0 :(得分:0)

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

这应记录在Google文档中,而不是Github中的说明