Google Cloud tool java.lang.IllegalArgumentException: Jetty ALPN / NPN incorrectly configured

I am new to Google Cloud Spanner and am learning it. I started with the documentation provided by google here . To explore any database, we start with data operations and the same as me, I started by writing data to a wrench using a simple java application given here https://github.com/GoogleCloudPlatform/java-docs -samples / blob / master / spanner / cloud-client / src / main / java / com / example / spanner / SpannerSample.java .
I made changes to the driver class in the appropriate places indicated in the following code fragment:

 public static void main(String[] args) throws Exception {
            String path = "File_Path";

            SpannerOptions.Builder options = SpannerOptions.newBuilder().setCredentials(GoogleCredentials.fromStream(new FileInputStream(path)));
            options.setProjectId("Project_id");
            Spanner spanner = (options.build()).getService();
            try {
                DatabaseId db = DatabaseId.of("project_id", "spannerInstance", "Database_name");
                DatabaseClient dbClient = spanner.getDatabaseClient(db);
                run(dbClient);
            } finally {
                spanner.closeAsync().get();
            }
            System.out.println("Closed client");
        }

Now, when I try to execute the code, I get the following error:

Exception in thread "main" java.lang.IllegalArgumentException: Jetty ALPN/NPN has not been properly configured.
    at io.grpc.netty.GrpcSslContexts.selectApplicationProtocolConfig(GrpcSslContexts.java:174)
    at io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:151)
    at io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:139)
    at io.grpc.netty.GrpcSslContexts.forClient(GrpcSslContexts.java:109)
    at com.google.cloud.spanner.SpannerOptions$NettyRpcChannelFactory.newSslContext(SpannerOptions.java:283)
    at com.google.cloud.spanner.SpannerOptions$NettyRpcChannelFactory.newChannel(SpannerOptions.java:274)
    at com.google.cloud.spanner.SpannerOptions.createChannel(SpannerOptions.java:253)
    at com.google.cloud.spanner.SpannerOptions.createChannels(SpannerOptions.java:240)
    at com.google.cloud.spanner.SpannerOptions.<init>(SpannerOptions.java:89)
    at com.google.cloud.spanner.SpannerOptions.<init>(SpannerOptions.java:43)
    at com.google.cloud.spanner.SpannerOptions$Builder.build(SpannerOptions.java:180)

:

   compile group: 'org.eclipse.jetty.alpn', name: 'alpn-api', version: '1.1.3.v20160715'
   compile group: 'org.mortbay.jetty.alpn', name: 'jetty-alpn-agent', version: '2.0.6'
   compile group: 'io.grpc', name: 'grpc-all', version: '1.2.0'
   compile group: 'io.netty', name: 'netty-all', version: '4.0.29.Final'
   compile group: 'org.eclipse.jetty.orbit', name: 'javax.servlet', version: '3.0.0.v201112011016'

, Bigquery GCP , , google-Spanner, .
.

+4
1

, , . , .

configurations {
    compile.exclude module: 'netty-all'
}

build.gradle .

github, . github, , , , "@michaelbausor".

+2

Source: https://habr.com/ru/post/1679269/


All Articles