Использование гаечного ключа в потоке данных 2.3.0
Я пытаюсь написать в гаечный ключ некоторые сообщения из Google Pub/ Sub. Пишу для больших работ, так что ничего не упущено на фундаментальном уровне.
Я обновился до google-cloud-dataflow-java-sdk-all
v2.3.0, который включает в себя приемник SpannerIO.
Я в основном следовал примеру написания документации по API 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)
2 ответа
Посмотрите на этот пост переполнения стека: Ошибка при использовании SpannerIO в Apache Beam. Возможно, это связано или та же проблема, описанная в выпуске JIRA BEAM-2837.
Сообщение переполнения стека не имеет принятого ответа, но я смог решить проблему, явно указав требуемый 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>
Если вы используете gradle, используйте приведенный ниже фрагмент, чтобы применить версию. Это решило мою проблему здесь.
compile (group: 'com.google.api-client', name: 'google-api-client', version: '1.22.0') {
force = true
}