使用Cloud Spanner的数据流:java.lang.IllegalArgumentException:尚未正确配置Jetty ALPN / NPN

时间:2017-08-15 10:26:46

标签: java scala google-cloud-platform google-cloud-dataflow google-cloud-spanner

我有一个将结果写入Cloud Spanner表的数据流作业。当我在本地运行作业但在Dataflow上运行它时,一切正常,会出现以下错误 -

java.lang.IllegalArgumentException: Jetty ALPN/NPN has not been properly configured.
    io.grpc.netty.GrpcSslContexts.selectApplicationProtocolConfig(GrpcSslContexts.java:174)
    io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:151)
    io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:139)
    io.grpc.netty.GrpcSslContexts.forClient(GrpcSslContexts.java:109)
    com.google.cloud.spanner.SpannerOptions$NettyRpcChannelFactory.newSslContext(SpannerOptions.java:289)
    com.google.cloud.spanner.SpannerOptions$NettyRpcChannelFactory.newChannel(SpannerOptions.java:278)
    com.google.cloud.spanner.SpannerOptions.createChannel(SpannerOptions.java:252)
    com.google.cloud.spanner.SpannerOptions.createChannels(SpannerOptions.java:239)
    com.google.cloud.spanner.SpannerOptions.<init>(SpannerOptions.java:88)
    com.google.cloud.spanner.SpannerOptions.<init>(SpannerOptions.java:43)
    com.google.cloud.spanner.SpannerOptions$Builder.build(SpannerOptions.java:179)

尝试创建SpannerOptions实例时出现此错误 -

val options: SpannerOptions = SpannerOptions.newBuilder().build()

我看到了this question,但如下所示排除netty-all无效。

libraryDependencies ++= libraries(
  apache_beam,
  circe,
  scalatest % Test,
  junit % Test,
  hamcrest % Test
).map(_.exclude("io.netty", "netty-all"))

我该怎么做才能解决这个问题?

1 个答案:

答案 0 :(得分:1)

通过将google-cloud-spanner版本与Apache Beam的pom.xml中指定的版本进行匹配来修复。