google-cloud-java: java.lang.ClassNotFoundException: org/eclipse/jetty/alpn/ALPN
My team has built a very thing wrapper around the spanner java driver and we have ran a number of tests successfully.
An issue came up when we tried to integrate the layer we built with vert.x (http://vertx.io)
An exception is occurring on the following code block:
SpannerOptions.newBuilder().build();
The following exception is being thrown:
java.lang.IllegalArgumentException: Jetty ALPN/NPN has not been properly configured.
at io.grpc.netty.GrpcSslContexts.selectApplicationProtocolConfig(GrpcSslContexts.java:162)
at io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:136)
at io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:124)
at io.grpc.netty.GrpcSslContexts.forClient(GrpcSslContexts.java:94)
at com.google.cloud.spanner.SpannerOptions$NettyRpcChannelFactory.newSslContext(SpannerOptions.java:318)
at com.google.cloud.spanner.SpannerOptions$NettyRpcChannelFactory.newChannel(SpannerOptions.java:306)
at com.google.cloud.spanner.SpannerOptions.createChannel(SpannerOptions.java:279)
at com.google.cloud.spanner.SpannerOptions.createChannels(SpannerOptions.java:266)
at com.google.cloud.spanner.SpannerOptions.<init>(SpannerOptions.java:91)
at com.google.cloud.spanner.SpannerOptions.<init>(SpannerOptions.java:45)
at com.google.cloud.spanner.SpannerOptions$Builder.build(SpannerOptions.java:202)
at com.godaddy.commerce.store.core.RelationalStoreSpanner.<init>(RelationalStoreSpanner.java:52)
at com.godaddy.commerce.store.core.RelationalStore.<init>(RelationalStore.java:38)
at com.godaddy.commerce.store.examples.SpannerExampleVerticle.start(SpannerExampleVerticle.java:36)
at io.vertx.core.AbstractVerticle.start(AbstractVerticle.java:111)
at io.vertx.core.impl.DeploymentManager.lambda$doDeploy$10(DeploymentManager.java:481)
at io.vertx.core.impl.ContextImpl.lambda$wrapTask$2(ContextImpl.java:344)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:403)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:463)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: org/eclipse/jetty/alpn/ALPN
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at io.grpc.netty.JettyTlsUtil.isJettyAlpnConfigured(JettyTlsUtil.java:34)
at io.grpc.netty.GrpcSslContexts.selectApplicationProtocolConfig(GrpcSslContexts.java:153)
... 21 more
The dependency tree is as follows:
+- io.vertx:vertx-core:jar:3.5.0:compile
| +- io.netty:netty-common:jar:4.1.15.Final:compile
| +- io.netty:netty-buffer:jar:4.1.15.Final:compile
| +- io.netty:netty-transport:jar:4.1.15.Final:compile
| +- io.netty:netty-handler:jar:4.1.15.Final:compile
| | \- io.netty:netty-codec:jar:4.1.15.Final:compile
| +- io.netty:netty-handler-proxy:jar:4.1.15.Final:compile
| | \- io.netty:netty-codec-socks:jar:4.1.15.Final:compile
| +- io.netty:netty-codec-http:jar:4.1.15.Final:compile
| +- io.netty:netty-codec-http2:jar:4.1.15.Final:compile
| +- io.netty:netty-resolver:jar:4.1.15.Final:compile
| +- io.netty:netty-resolver-dns:jar:4.1.15.Final:compile
| | \- io.netty:netty-codec-dns:jar:4.1.15.Final:compile
| +- com.fasterxml.jackson.core:jackson-core:jar:2.9.1:compile
| \- com.fasterxml.jackson.core:jackson-databind:jar:2.9.1:compile
+- io.vertx:vertx-web:jar:3.5.0:compile
| +- io.vertx:vertx-auth-common:jar:3.5.0:compile
| \- io.vertx:vertx-bridge-common:jar:3.5.0:compile
+- io.vertx:vertx-web-client:jar:3.5.0:compile
| \- io.vertx:vertx-web-common:jar:3.5.0:compile
+- io.vertx:vertx-unit:jar:3.5.0:compile
+- junit:junit:jar:4.12:compile
| \- org.hamcrest:hamcrest-core:jar:1.3:compile
\- com.x.y:0.0.1-SNAPSHOT:compile
+- com.google.cloud:google-cloud-spanner:jar:0.32.0-beta:compile
| +- io.netty:netty-tcnative-boringssl-static:jar:2.0.6.Final:test
| +- com.google.cloud:google-cloud-core:jar:1.14.0:compile
| | +- com.google.guava:guava:jar:20.0:compile
| | +- org.json:json:jar:20160810:compile
| | +- com.google.http-client:google-http-client:jar:1.23.0:compile
| | | \- org.apache.httpcomponents:httpclient:jar:4.5.3:compile
| | | +- org.apache.httpcomponents:httpcore:jar:4.4.7:compile
| | | +- commons-logging:commons-logging:jar:1.2:compile
| | | \- commons-codec:commons-codec:jar:1.10:compile
| | +- com.google.api:api-common:jar:1.2.0:compile
| | +- com.google.api:gax:jar:1.15.0:compile
| | +- com.google.protobuf:protobuf-java-util:jar:3.4.0:compile
| | +- com.google.api.grpc:proto-google-common-protos:jar:1.0.2:compile
| | \- com.google.api.grpc:proto-google-iam-v1:jar:0.1.26:compile
| +- com.google.cloud:google-cloud-core-grpc:jar:1.14.0:compile
| | +- com.google.auth:google-auth-library-credentials:jar:0.9.0:compile
| | +- com.google.protobuf:protobuf-java:jar:3.4.0:compile
| | +- io.grpc:grpc-protobuf:jar:1.7.0:compile
| | | \- io.grpc:grpc-protobuf-lite:jar:1.7.0:compile
| | \- io.grpc:grpc-context:jar:1.7.0:compile
| +- com.google.api:gax-grpc:jar:1.15.0:compile
| | +- com.google.auto.value:auto-value:jar:1.2:compile
| | +- org.threeten:threetenbp:jar:1.3.3:compile
| | \- com.google.auth:google-auth-library-oauth2-http:jar:0.9.0:compile
| | \- com.google.http-client:google-http-client-jackson2:jar:1.19.0:compile
| +- com.google.api.grpc:proto-google-cloud-spanner-v1:jar:0.1.26:compile
| +- com.google.api.grpc:proto-google-cloud-spanner-admin-database-v1:jar:0.1.26:compile
| +- com.google.api.grpc:proto-google-cloud-spanner-admin-instance-v1:jar:0.1.26:compile
| +- com.google.api.grpc:grpc-google-cloud-spanner-v1:jar:0.1.26:compile
| +- com.google.api.grpc:grpc-google-cloud-spanner-admin-database-v1:jar:0.1.26:compile
| +- com.google.api.grpc:grpc-google-cloud-spanner-admin-instance-v1:jar:0.1.26:compile
| +- com.google.api.grpc:grpc-google-common-protos:jar:1.0.2:compile
| +- io.grpc:grpc-netty:jar:1.7.0:compile
| | \- io.grpc:grpc-core:jar:1.7.0:compile (version selected from constraint [1.7.0,1.7.0])
| | +- com.google.errorprone:error_prone_annotations:jar:2.0.19:compile
| | +- com.google.instrumentation:instrumentation-api:jar:0.4.3:compile
| | \- io.opencensus:opencensus-api:jar:0.6.0:compile
| +- io.grpc:grpc-auth:jar:1.7.0:compile
| +- io.grpc:grpc-stub:jar:1.7.0:compile
| +- com.google.code.findbugs:jsr305:jar:3.0.0:compile
| \- joda-time:joda-time:jar:2.9.2:compile
+- org.slf4j:slf4j-api:jar:1.7.25:compile
The environment I’m developing on is the following:
OS: MacOSX JDK Version: 1.8.0_152 Spanner Driver version: 0.32.0-beta
I believe this is a gRPC error. I have tried excluding dependencies such as grpc-netty but that hasn’t sorted the issue yet.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 23 (8 by maintainers)
@garrettjonesgoogle @fmatar in my case problem was in the OS itself. Once i changed OS from
java:8-jre-alpine
toopenjdk:8-jre-slim
, problem disappeared.io.netty:netty-common:jar:4.1.15.Final
andio.grpc:grpc-netty:jar:1.7.0
aren’t compatible. See https://github.com/grpc/grpc-java/blob/master/SECURITY.md#netty for a table of compatible versions; it looks like you’ll need 4.1.16 of netty.Ok the versions all seem consistent now.
Could you try calling https://github.com/GoogleCloudPlatform/google-cloud-java/blob/master/google-cloud-util/google-cloud-compat-checker/src/main/java/com/google/cloud/compatchecker/GoogleCloudCompatChecker.java from your code and see what it outputs?