部署在GKE中的PubSub连接问题

时间:2019-06-18 18:30:53

标签: java binding google-cloud-platform spring-cloud-stream

我们正在使用Spring Cloud Stream,Spring启动应用程序从微服务连接到PubSub。该应用程序在本地工作,可连接到云中的特定项目和pubsub。但是,当我在GKE中部署应用程序时,出现了拒绝权限错误。

无法创建生产者绑定;在30秒内重试org.springframework.cloud.stream.binder.BinderException:在org.springframework.cloud的org.springframework.cloud.stream.binder.AbstractMessageChannelBinder.doBindProducer(AbstractMessageChannelBinder.java:210)上构建出站端点时引发异常。在org.springframework.cloud.stream.binder.AbstractBinder.bindProducer(AbstractBinder.java:151)处的stream.binder.AbstractMessageChannelBinder.doBindProducer(AbstractMessageChannelBinder.java:97)在org.springframework.cloud.stream.binding.BindingService.doBindProducer( org.org.springframework.cloud.stream.binding.BindingService.bindProducer(BindingService.java:243)org.org.springframework.cloud.stream.binding.BindableProxyFactory.createAndBindOutputs(BindableProxyFactory.java:287) org.springframew上的.springframework.cloud.stream.binding.OutputBindingLifecycle.doStartWithBindable(OutputBindingLifecycle.java:58)在java.util.LinkedHashMap $ LinkedValues.forEach(LinkedHashMap.java:608) org.springframework.context.support.DefaultLifecycleProcessor上的ork.cloud.stream.binding.AbstractBindingLifecycle.start(AbstractBindingLifecycle.java:48)在org.springframework.cloud.stream.binding.OutputBindingLifecycle.start(OutputBindingLifecycle.java:34)在org.springframework.context.support。在org.springframework.context.support.DefaultLifecycleProcessor.access $ 200(DefaultLifecycleProcessor.java:53)处的doStart(DefaultLifecycleProcessor.java:182)在org.springframework.context.support.DefaultLifecycleProcessor $ LifecycleGroup.start(DefaultLifecycleProcessor.java:360)处org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:158)在org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:122)在org.springframework.context.support.AbstractApplicationContext.finishRefresh( org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicatio)上的AbstractApplicationContext.java:893) norg.java:163),位于org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:552),位于org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) org.springframework.boot.SpringApplication.run(SpringApplication.java:316)上的org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)位于org.springframework.boot.SpringApplication.run(SpringApplication.java:316)处的.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)上的org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)com.sensormatic.tvc.InventoryServiceApplication.main(InventoryServiceApplication.java:14)上的org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)处在org.springframework.boot.loader.Launcher.launch(Launcher)处的org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)处的java.lang.reflect.Method.invoke(Method.java:498) .java:87),位于org.springframework.boot.loader.Launcher.launch(Launcher.java:50),位于org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51),原因:com.google。 api.gax.rpc.PermissionDeniedException:io.grpc.StatusRuntimeException:PERMISSION_DENIED:用户无权执行此操作。在com.google.api.gax.grpc.GrpcApiExceptionFactory.create(GrpcApiExceptionFactory.java:72)在com.google.api.gax.grpc.GrpcApiExceptionFactory.create(GrpcApiExceptionFactory.java:72)在com.google.api.gax com.google.api.gax.grpc.GrpcExceptionCallable $ ExceptionTransformingFuture.onFailure(GrpcExceptionCallable.java:97)的com.google.api.core.ApiFutures $ 1.onFailure(.gr.GrpcApiExceptionFactory.java:60) com.google.common.util.concurrent.Futures $ 4.run(Futures.java:1123)的com.google.common.util.concurrent.MoreExecutors $ DirectExecutor.execute(MoreExecutors.java:435)的ApiFutures.java:68) ),位于com.google.common.com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:811)的com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:900)。 io.grpc.stub.ClientCalls $ GrpcFuture.setException(ClientCalls.java:507)的util.concurrent.AbstractFuture.setException(AbstractFuture.java:675)在io.grpc.stub.ClientCalls $ Unar io.grpc.PartyForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39)的yStreamToFuture.onClose(ClientCalls.java:482)io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23)的io.grpc.ForwardingClientCallListenerListener $ SimpleFor (ForwardingClientCallListener.java:40)位于io.grpc.internal.CensusStatsModule $ StatsClientInterceptor $ 1 $ 1.onClose(CensusStatsModule.java:678)位于io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39)在io.grpc。在io.grpc.ForwardingClientCallListener $ SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40)处的onClose(ForwardingClientCallListener.java:23)在io.grpc.internal.CensusTracingModule $ TracingClientInterceptor $ 1 $ 1.onClose(CensusTracingModule.java:3: .internal.ClientCallImpl.closeObserver(ClientCallImpl.java:459)at io.grpc.internal.ClientCallImpl.access $ 300(ClientCallIm pl.java:63)位于io.grpc.internal.ClientCallImpl $ ClientStreamListenerImpl.close(ClientCallImpl.java:546)位于io.grpc.internal.ClientCallImpl $ ClientStreamListenerImpl.access $ 600(ClientCallImpl.java:467)位于io.grpc。 internal.ClientCallImpl $ ClientStreamListenerImpl $ 1StreamClosed.runInContext(ClientCallImpl.java:584)在io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)在io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)在java.util.concurrent.Executors $ RunnableAdapter.call(Executors.java:511)在java.util.concurrent.FutureTask.run(FutureTask.java:266)在java.util.concurrent.ScheduledThreadPoolExecutor $ ScheduledFutureTask.access $ 201( java.util.concurrent.ScheduledThreadPoolExecutor $ ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)上的ScheduledThreadPoolExecutor.java:180)java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:Ex149149)上的ScheduledThreadPoolExecutor。 $ Worker.run(ThreadPoolExecutor.java:624)在java.lang.T hread.run(Thread.java:748)禁止:com.google.api.gax.rpc.AsyncTaskException:异步任务在com.google.api.gax.rpc.ApiExceptions.callAndTranslateApiException(ApiExceptions.java:57)处失败com.google.cloud.pubsub.v1上的.google.api.gax.rpc.UnaryCallable.call(UnaryCallable.java:112),com.google.cloud.pubsub.v1上的TopicAdminClient.getTopic(TopicAdminClient.java:517) org.springframework.cloud.gcp.pubsub.PubSubAdmin.getTopic(PubSubAdmin.java:117)上的.TopicAdminClient.getTopic(TopicAdminClient.java:472)在org.springframework.cloud.gcp.stream.binder.pubsub.provisioning.PubSubChannelProvisioner org.springframework.cloud.gcp.stream.binder.pubsub.provisioning.PubSubChannelProvisioner.provisionProducerDestination(PubSubChannelProvisioner.java:63)上的.makeSureTopicExists(PubSubChannelProvisioner.java:118)在org.springframework.cloud.gcp.stream.binder.pubsub上org.springframework.clo中的.provisioning.PubSubChannelProvisioner.provisionProducerDestination(PubSubChannelProvisioner.java:45) org.springframework.cloud.stream.binder.AbstractMessageChannelBinder.doBindProducer(AbstractMessageChannelBinder.java:97)上的ud.stream.binder.AbstractMessageChannelBinder.doBindProducer(AbstractMessageChannelBinder.java:193)在org.springframework.cloud.stream.binder.AbstractBinder。 org.springframework.cloud.stream.binding.BindingService.bindProducer(BindingService.java:243)上的bindProducer(AbstractBinder.java:151)在org.springframework.cloud.stream.binding.BindingService.doBindProducer(BindingService.java:268)在org.springframework.cloud.stream.binding.BindableProxyFactory.java:287处在org.springframework.cloud.stream.binding.OutputBindingLifecycle.doStartWithBindable(OutputBindingLifecycle.java:58)在java.util.LinkedHashMap $ LinkedValues .forEach(LinkedHashMap.java:608)在org.springframework.cloud.stream.binding.AbstractBindingLifecycle.start(AbstractBindingLifecycle.java:48)在org.springframework.cloud.stream.binding.OutputBindingLifecycle在org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:182)处的org.springframework.context.support.DefaultLifecycleProcessor.access $ 200(在组织org处的.start(OutputBindingLifecycle.java:34) .org.springframework.context.support.DefaultLifecycleProcessor $ LifecycleGroup.start(DefaultLifecycleProcessor.java:360)位于org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:158)位于org.springframework.context.support.DefaultLifecycleProcessor.onRefresh (DefaultLifecycleProcessor.java:122)在org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:893)在org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:163)在org.springframework.boo上的org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:552) t.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142)在org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)在org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java: 397)位于org.springframework.boot.SpringApplication.run(SpringApplication.java:316)位于org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)位于org.springframework.boot.SpringApplication.run(SpringApplication.java) :1248),位于com.sensormatic.tvc.InventoryServiceApplication.main(InventoryServiceApplication.java:14),位于sun.reflect.NativeMethodAccessorImpl.invoke0(本地方法),位于sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)处。 org上的java.lang.reflect.Method.invoke(Method.java:498)上的org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)上的reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) .springframework。在org.springframework.boot.loader.Launcher.launch(Launcher.java:50)处的boot.loader.Launcher.launch(Launcher.java:87)在org.springframework.boot.loader.JarLauncher.main(JarLauncher.java: 51)原因:io.grpc.StatusRuntimeException:PERMISSION_DENIED:用户无权执行此操作。在io.grpc.Status.asRuntimeException(Status.java:526)...省略了23个常见框架

1 个答案:

答案 0 :(得分:0)

此问题已解决,我缺少pubsub的projectId

spring_cloud_gcp_pubsub_projectId:XXXX

应用程序正在讨论其他项目中存在的其他pubsub