我正在尝试编写来自google pub / sub的一些消息。写作大型作品,所以基础层面没有任何遗漏。
我已升级到google-cloud-dataflow-java-sdk-all
v2.3.0,其中包括SpannerIO接收器。
我基本上都遵循了API docs of SpannerIO的写作示例。
但是,我收到异常internal_static_google_rpc_LocalizedMessage_fieldAccessorTable
完整堆栈跟踪:
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:java (default-cli) on project second-dataflow: An exception occured while executing the Java class. internal_static_google_rpc_LocalizedMessage_fieldAccessorTable
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: An exception occured while executing the Java class. internal_static_google_rpc_LocalizedMessage_fieldAccessorTable
at org.codehaus.mojo.exec.ExecJavaMojo.execute (ExecJavaMojo.java:339)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: java.lang.NoSuchFieldError: internal_static_google_rpc_LocalizedMessage_fieldAccessorTable
at com.google.rpc.LocalizedMessage.internalGetFieldAccessorTable (LocalizedMessage.java:87)
at com.google.protobuf.GeneratedMessageV3.getDescriptorForType (GeneratedMessageV3.java:121)
at io.grpc.protobuf.ProtoUtils.keyForProto (ProtoUtils.java:126)
at com.google.cloud.spanner.spi.v1.SpannerErrorInterceptor.<clinit> (SpannerErrorInterceptor.java:47)
at com.google.cloud.spanner.spi.v1.GrpcSpannerRpc.<init> (GrpcSpannerRpc.java:128)
at com.google.cloud.spanner.SpannerOptions$DefaultSpannerRpcFactory.create (SpannerOptions.java:70)
at com.google.cloud.spanner.SpannerOptions$DefaultSpannerRpcFactory.create (SpannerOptions.java:65)
at com.google.cloud.ServiceOptions.getRpc (ServiceOptions.java:443)
at com.google.cloud.spanner.SpannerOptions.getSpannerRpcV1 (SpannerOptions.java:315)
at com.google.cloud.spanner.SpannerImpl.<init> (SpannerImpl.java:138)
at com.google.cloud.spanner.SpannerOptions$DefaultSpannerFactory.create (SpannerOptions.java:60)
at com.google.cloud.spanner.SpannerOptions$DefaultSpannerFactory.create (SpannerOptions.java:55)
at com.google.cloud.ServiceOptions.getService (ServiceOptions.java:430)
at org.apache.beam.sdk.io.gcp.spanner.SpannerConfig.connectToSpanner (SpannerConfig.java:155)
at com.crypto20.DeveloperSubscription.main (DeveloperSubscription.java:94)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:282)
at java.lang.Thread.run (Thread.java:748)
指定withProjectId()
无法解决问题。
也没有升级所有依赖项,包括传递中的依赖项 - 除非我犯了错误(我不习惯数据流在内部的结构以及每个依赖项的作用)。更新依赖项之后,甚至没有暂存已编译的项目。
我怀疑存在需要更新的特定依赖关系,我尝试了各种组合,但无济于事。
更新
我尝试过的其中一件事就是将grpc-google-common-protos
固定在0.1.9
或甚至是最新的1.2.0
。
如果我这样做,甚至没有上传管道,因为我在上传之前得到以下例外:
Mar 12, 2018 7:40:22 AM org.apache.beam.runners.dataflow.util.PackageUtil stageClasspathElements
INFO: Uploading 120 files from PipelineOptions.filesToStage to staging location to prepare for execution.
[WARNING]
java.lang.RuntimeException: Error while staging packages
at org.apache.beam.runners.dataflow.util.PackageUtil.stageClasspathElements (PackageUtil.java:396)
at org.apache.beam.runners.dataflow.util.PackageUtil.stageClasspathElements (PackageUtil.java:272)
at org.apache.beam.runners.dataflow.util.GcsStager.stageFiles (GcsStager.java:76)
at org.apache.beam.runners.dataflow.util.GcsStager.stageDefaultFiles (GcsStager.java:64)
at org.apache.beam.runners.dataflow.DataflowRunner.run (DataflowRunner.java:661)
at org.apache.beam.runners.dataflow.DataflowRunner.run (DataflowRunner.java:174)
at org.apache.beam.sdk.Pipeline.run (Pipeline.java:311)
at org.apache.beam.sdk.Pipeline.run (Pipeline.java:297)
at com.crypto20.DeveloperSubscription.main (DeveloperSubscription.java:106)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:282)
at java.lang.Thread.run (Thread.java:748)
Caused by: java.io.IOException: Error executing batch GCS request
at org.apache.beam.sdk.util.GcsUtil.executeBatches (GcsUtil.java:610)
at org.apache.beam.sdk.util.GcsUtil.getObjects (GcsUtil.java:341)
at org.apache.beam.sdk.extensions.gcp.storage.GcsFileSystem.matchNonGlobs (GcsFileSystem.java:216)
at org.apache.beam.sdk.extensions.gcp.storage.GcsFileSystem.match (GcsFileSystem.java:85)
at org.apache.beam.sdk.io.FileSystems.match (FileSystems.java:123)
at org.apache.beam.sdk.io.FileSystems.matchSingleFileSpec (FileSystems.java:188)
at org.apache.beam.runners.dataflow.util.PackageUtil.alreadyStaged (PackageUtil.java:159)
at org.apache.beam.runners.dataflow.util.PackageUtil.stagePackageSynchronously (PackageUtil.java:183)
at org.apache.beam.runners.dataflow.util.PackageUtil.lambda$stagePackage$1 (PackageUtil.java:173)
at org.apache.beam.runners.dataflow.repackaged.com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly (TrustedListenableFutureTask.java:111)
at org.apache.beam.runners.dataflow.repackaged.com.google.common.util.concurrent.InterruptibleTask.run (InterruptibleTask.java:58)
at org.apache.beam.runners.dataflow.repackaged.com.google.common.util.concurrent.TrustedListenableFutureTask.run (TrustedListenableFutureTask.java:75)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
at java.lang.Thread.run (Thread.java:748)
Caused by: java.util.concurrent.ExecutionException: com.google.api.client.http.HttpResponseException: 404 Not Found
Not Found
at org.apache.beam.sdks.java.extensions.google.cloud.platform.core.repackaged.com.google.common.util.concurrent.AbstractFuture.getDoneValue (AbstractFuture.java:500)
at org.apache.beam.sdks.java.extensions.google.cloud.platform.core.repackaged.com.google.common.util.concurrent.AbstractFuture.get (AbstractFuture.java:479)
at org.apache.beam.sdks.java.extensions.google.cloud.platform.core.repackaged.com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get (AbstractFuture.java:76)
at org.apache.beam.sdk.util.GcsUtil.executeBatches (GcsUtil.java:602)
at org.apache.beam.sdk.util.GcsUtil.getObjects (GcsUtil.java:341)
at org.apache.beam.sdk.extensions.gcp.storage.GcsFileSystem.matchNonGlobs (GcsFileSystem.java:216)
at org.apache.beam.sdk.extensions.gcp.storage.GcsFileSystem.match (GcsFileSystem.java:85)
at org.apache.beam.sdk.io.FileSystems.match (FileSystems.java:123)
at org.apache.beam.sdk.io.FileSystems.matchSingleFileSpec (FileSystems.java:188)
at org.apache.beam.runners.dataflow.util.PackageUtil.alreadyStaged (PackageUtil.java:159)
at org.apache.beam.runners.dataflow.util.PackageUtil.stagePackageSynchronously (PackageUtil.java:183)
at org.apache.beam.runners.dataflow.util.PackageUtil.lambda$stagePackage$1 (PackageUtil.java:173)
at org.apache.beam.runners.dataflow.repackaged.com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly (TrustedListenableFutureTask.java:111)
at org.apache.beam.runners.dataflow.repackaged.com.google.common.util.concurrent.InterruptibleTask.run (InterruptibleTask.java:58)
at org.apache.beam.runners.dataflow.repackaged.com.google.common.util.concurrent.TrustedListenableFutureTask.run (TrustedListenableFutureTask.java:75)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
at java.lang.Thread.run (Thread.java:748)
Caused by: com.google.api.client.http.HttpResponseException: 404 Not Found
Not Found
at com.google.api.client.http.HttpRequest.execute (HttpRequest.java:1070)
at com.google.api.client.googleapis.batch.BatchRequest.execute (BatchRequest.java:241)
at org.apache.beam.sdk.util.GcsUtil.lambda$executeBatches$0 (GcsUtil.java:596)
at org.apache.beam.sdks.java.extensions.google.cloud.platform.core.repackaged.com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly (TrustedListenableFutureTask.java:111)
at org.apache.beam.sdks.java.extensions.google.cloud.platform.core.repackaged.com.google.common.util.concurrent.InterruptibleTask.run (InterruptibleTask.java:58)
at org.apache.beam.sdks.java.extensions.google.cloud.platform.core.repackaged.com.google.common.util.concurrent.TrustedListenableFutureTask.run (TrustedListenableFutureTask.java:75)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
at java.lang.Thread.run (Thread.java:748)
Mar 12, 2018 7:40:22 AM org.apache.beam.runners.dataflow.repackaged.com.google.common.util.concurrent.AggregateFuture$RunningState handleException
SEVERE: Got more than one input Future failure. Logging failures after the first
java.io.IOException: Error executing batch GCS request
at org.apache.beam.sdk.util.GcsUtil.executeBatches(GcsUtil.java:610)
at org.apache.beam.sdk.util.GcsUtil.getObjects(GcsUtil.java:341)
at org.apache.beam.sdk.extensions.gcp.storage.GcsFileSystem.matchNonGlobs(GcsFileSystem.java:216)
at org.apache.beam.sdk.extensions.gcp.storage.GcsFileSystem.match(GcsFileSystem.java:85)
at org.apache.beam.sdk.io.FileSystems.match(FileSystems.java:123)
at org.apache.beam.sdk.io.FileSystems.matchSingleFileSpec(FileSystems.java:188)
at org.apache.beam.runners.dataflow.util.PackageUtil.alreadyStaged(PackageUtil.java:159)
at org.apache.beam.runners.dataflow.util.PackageUtil.stagePackageSynchronously(PackageUtil.java:183)
at org.apache.beam.runners.dataflow.util.PackageUtil.lambda$stagePackage$1(PackageUtil.java:173)
at org.apache.beam.runners.dataflow.repackaged.com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:111)
at org.apache.beam.runners.dataflow.repackaged.com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:58)
at org.apache.beam.runners.dataflow.repackaged.com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:75)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
答案 0 :(得分:2)
看看这个Stack Overflow帖子:Error using SpannerIO in apache beam。它可能与JIRA问题BEAM-2837中描述的相关或相同的问题有关。
Stack Overflow帖子没有接受的答案,但我能够通过明确定义所需的com.google.api.grpc
依赖关系并从org.apache.beam
中排除版本来解决问题。
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>grpc-google-common-protos</artifactId>
<version>0.1.9</version>
</dependency>
<dependency>
<groupId>org.apache.beam</groupId>
<artifactId>beam-sdks-java-io-google-cloud-platform</artifactId>
<version>${beam.version}</version>
<exclusions>
<exclusion>
<groupId>com.google.api.grpc</groupId>
<artifactId>grpc-google-common-protos</artifactId>
</exclusion>
</exclusions>
</dependency>
答案 1 :(得分:0)
如果您使用的是gradle,请使用以下代码段来强制执行该版本。这解决了我的问题。
compile (group: 'com.google.api-client', name: 'google-api-client', version: '1.22.0') {
force = true
}