【问题标题】:Google Dataflow jar file packaging issue with FileSystemRefistrarFileSystemRefistrar 的 Google Dataflow jar 文件打包问题
【发布时间】:2018-03-21 03:41:13
【问题描述】:

我正在 IntelliJ 中测试我的数据流 Java 应用程序,它运行良好。但是在linux系统中运行dataflow jar文件时,出现了这个问题:

这是我用于数据流的选项: --project=myproject --stagingLocation=gs://mybucket/staging2 --tempLocation=gs://mybucket/gcp-temp2 --gcpTempLocation=gs://mybucket/gcp-temp2 --bigtableProjectId=myinstance --bigtableInstanceId=user-test --bigtableTableId=test_table1

所以问题是gs目录没有被正确识别。事实上,它被认为是我运行 jar 文件的服务器的本地目录。

出现这个目录问题的原因如下:

我查找了 [maven assembly jar] 与 [maven shade jar] 之间的区别,发现 FileSystemRefistrar 指向了错误的文件。

但是使用 shade 插件并不能解决问题,我很幸运 GcsFileSystemRegistrar 的类没有被覆盖。当我更改依赖顺序时再次出现同样的问题。

要完成这项工作,我必须按以下顺序拥有这两个库:

beam-runners-google-cloud-dataflow-java

beam-sdks-java-core

“beam-sdks-java-core”包含在“beam-runners-google-cloud-dataflow-java”中,但我需要在“beam-runners-google-cloud-dataflow-java”之后添加它。所以dependencyHierarchy看起来很有趣,但这是我可以让它工作的唯一方法。这是它的外观:

如果我排除 'beam-sdks-java-core' 或更改顺序,问题会再次出现。我尝试使用 maven 插件排除它,但它不起作用。

所以我的问题是如何正确设置 FileSystemRegistrar?我不知道为什么会这样。

+我希望有这个问题的人可以从这篇文章中得到提示。我为此挣扎了很多:'(

【问题讨论】:

  • stackoverflow.com/questions/44365545/…这篇文章解决了这个问题。我需要使用带有 ServicesResourceTransformer 的 maven shade 插件
  • 我想请您发布解决方案作为答案。社区应该更容易看到它。

标签: maven jar google-cloud-platform dataflow


【解决方案1】:

正如 OGCheeze 评论的那样,它是通过使用带有 ServicesResourceTransformer 的 maven shade 插件来解决的。在this post 有更详细的解释。

【讨论】:

  • 我不知道如何自我回答我的问题。感谢您的回答
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-04-10
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多