I am getting the below exception when running the sample "speech" application as a plain java application. I have not run it on any server as of now.
Sample application can be found at- https://github.com/GoogleCloudPlatform/java-docs-samples/tree/master/speech/cloud-client.
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 io.grpc.netty.NettyChannelBuilder$NettyTransportFactory.
at io.grpc.netty.NettyChannelBuilder.buildTransportFactory(NettyChannelBuilder.java:338)
at io.grpc.internal.AbstractManagedChannelImplBuilder.build(AbstractManagedChannelImplBuilder.java:305)
at com.google.api.gax.grpc.InstantiatingChannelProvider.createChannel(InstantiatingChannelProvider.java:139)
at com.google.api.gax.grpc.InstantiatingChannelProvider.getChannel(InstantiatingChannelProvider.java:116)
at com.google.api.gax.grpc.ChannelAndExecutor.create(ChannelAndExecutor.java:65)
at com.google.api.gax.grpc.ClientSettings.getChannelAndExecutor(ClientSettings.java:91)
at com.google.cloud.speech.v1.SpeechClient.
at com.google.cloud.speech.v1.SpeechClient.create(SpeechClient.java:131)
at com.google.cloud.speech.v1.SpeechClient.create(SpeechClient.java:123)
at com.example.speech.QuickstartSample.main(QuickstartSample.java:38)
I have tried most of the steps provided over the net but no luck. It uses google cloud speech version - 0.20.3-alpha. I have also tried with google cloud speech version -0.17.1-alpha but same issue.
@naushad97 per https://github.com/GoogleCloudPlatform/google-cloud-java/issues/2240, could you confirm you're running on a supported architecture for gRPC?
@tcoffee-google I have run this as simple Java application on Jdk1.7. and 1.8 and on Windows 7 and 10 and. I have not tried on any container like tomcat etc.
As I'm away, I'll pass this off to @neozwu who's handling new issues this week.
@naushad97 can you try add netty-tcnative as a dependency to your project ? This is a recommended way of using GRPC over TLS, and windows should be supported (see here for details).
@neozwu I tried by adding dependency -
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative-boringssl-static</artifactId>
<version>2.0.3.Final</version>
</dependency>
but still the same issue.
I also added alpn-boot-7.1.0.v20141016.jar (as I am executing on jdk1.7.0_51, OS- Windows 7) in Bootstrap entries (described here) and run the application from Eclipse IDE- It is throwing the below error -
io.grpc.Context: Storage override doesn't exist. Using default.
java.lang.ClassNotFoundException: io.grpc.override.ContextStorageOverride
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:190)
at io.grpc.Context.<clinit>(Context.java:132)
at io.grpc.internal.ClientCallImpl.<init>(ClientCallImpl.java:108)
at io.grpc.internal.ManagedChannelImpl$RealChannel.newCall(ManagedChannelImpl.java:554)
at com.google.api.gax.grpc.GrpcHeaderInterceptor.interceptCall(GrpcHeaderInterceptor.java:57)
at io.grpc.ClientInterceptors$InterceptorChannel.newCall(ClientInterceptors.java:119)
at io.grpc.internal.ManagedChannelImpl.newCall(ManagedChannelImpl.java:533)
at com.google.api.gax.grpc.GrpcDirectCallable.newCall(GrpcDirectCallable.java:67)
at com.google.api.gax.grpc.GrpcDirectCallable.futureCall(GrpcDirectCallable.java:61)
at com.google.api.gax.grpc.GrpcExceptionCallable.futureCall(GrpcExceptionCallable.java:65)
at com.google.api.gax.grpc.GrpcAttemptCallable.call(GrpcAttemptCallable.java:80)
at com.google.api.gax.grpc.GrpcRetryingCallable.futureCall(GrpcRetryingCallable.java:64)
at com.google.api.gax.grpc.GrpcRetryingCallable.futureCall(GrpcRetryingCallable.java:46)
at com.google.api.gax.rpc.EntryPointUnaryCallable.futureCall(EntryPointUnaryCallable.java:70)
at com.google.api.gax.rpc.UnaryCallable.futureCall(UnaryCallable.java:89)
at com.google.api.gax.rpc.UnaryCallable.call(UnaryCallable.java:114)
at com.google.cloud.speech.v1.SpeechClient.recognize(SpeechClient.java:225)
at com.google.cloud.speech.v1.SpeechClient.recognize(SpeechClient.java:189)
at com.example.speech.QuickstartSample.main(QuickstartSample.java:62)
Exception in thread "main" com.google.api.gax.grpc.GrpcApiException: io.grpc.StatusRuntimeException: DEADLINE_EXCEEDED
at com.google.api.gax.grpc.GrpcExceptionCallable$ExceptionTransformingFuture.onFailure(GrpcExceptionCallable.java:112)
at com.google.api.core.ApiFutures$1.onFailure(ApiFutures.java:53)
at com.google.common.util.concurrent.Futures$4.run(Futures.java:1123)
at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:435)
at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:900)
at com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:811)
at com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:675)
at io.grpc.stub.ClientCalls$GrpcFuture.setException(ClientCalls.java:466)
at io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:442)
at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:426)
at io.grpc.internal.ClientCallImpl.access$100(ClientCallImpl.java:76)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:512)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$700(ClientCallImpl.java:429)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:544)
at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:52)
at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:117)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: io.grpc.StatusRuntimeException: DEADLINE_EXCEEDED
at io.grpc.Status.asRuntimeException(Status.java:543)
... 15 more
Dependency Tree - >
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ speech-google-cloud-samples ---
[INFO] com.example.speech:speech-google-cloud-samples:jar:1.0.0
[INFO] +- com.google.cloud:google-cloud:jar:0.21.0-alpha:compile
[INFO] | +- com.google.cloud:google-cloud-bigquery:jar:0.21.0-beta:compile
[INFO] | | +- com.google.cloud:google-cloud-core-http:jar:1.3.0:compile
[INFO] | | | +- com.google.auth:google-auth-library-credentials:jar:0.7.0:compile
[INFO] | | | +- com.google.auth:google-auth-library-oauth2-http:jar:0.7.0:compile
[INFO] | | | +- com.google.http-client:google-http-client:jar:1.22.0:compile
[INFO] | | | | \- org.apache.httpcomponents:httpclient:jar:4.0.1:compile
[INFO] | | | | +- org.apache.httpcomponents:httpcore:jar:4.0.1:compile
[INFO] | | | | +- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] | | | | \- commons-codec:commons-codec:jar:1.3:compile
[INFO] | | | +- com.google.oauth-client:google-oauth-client:jar:1.22.0:compile
[INFO] | | | +- com.google.api-client:google-api-client:jar:1.22.0:compile
[INFO] | | | +- com.google.http-client:google-http-client-appengine:jar:1.22.0:compile
[INFO] | | | +- com.google.http-client:google-http-client-jackson:jar:1.22.0:compile
[INFO] | | | | \- org.codehaus.jackson:jackson-core-asl:jar:1.9.11:compile
[INFO] | | | \- com.google.http-client:google-http-client-jackson2:jar:1.22.0:compile
[INFO] | | | \- com.fasterxml.jackson.core:jackson-core:jar:2.1.3:compile
[INFO] | | \- com.google.apis:google-api-services-bigquery:jar:v2-rev347-1.22.0:compile
[INFO] | +- com.google.cloud:google-cloud-compute:jar:0.21.0-alpha:compile
[INFO] | | \- com.google.apis:google-api-services-compute:jar:v1-rev103-1.21.0:compile
[INFO] | +- com.google.cloud:google-cloud-core:jar:1.3.0:compile
[INFO] | | +- joda-time:joda-time:jar:2.9.2:compile
[INFO] | | +- org.json:json:jar:20160810:compile
[INFO] | | +- com.google.api:api-common:jar:1.1.0:compile
[INFO] | | +- com.google.api:gax:jar:1.5.0:compile
[INFO] | | | +- com.google.auto.value:auto-value:jar:1.2:compile
[INFO] | | | \- org.threeten:threetenbp:jar:1.3.3:compile
[INFO] | | +- com.google.protobuf:protobuf-java-util:jar:3.3.1:compile
[INFO] | | | +- com.google.protobuf:protobuf-java:jar:3.3.1:compile
[INFO] | | | \- com.google.code.gson:gson:jar:2.7:compile
[INFO] | | +- com.google.api.grpc:proto-google-common-protos:jar:0.1.14:compile
[INFO] | | \- com.google.api.grpc:proto-google-iam-v1:jar:0.1.14:compile
[INFO] | +- com.google.cloud:google-cloud-datastore:jar:1.3.0:compile
[INFO] | | +- com.google.cloud.datastore:datastore-v1-protos:jar:1.3.0:compile
[INFO] | | +- com.google.cloud.datastore:datastore-v1-proto-client:jar:1.3.0:compile
[INFO] | | | \- com.google.http-client:google-http-client-protobuf:jar:1.20.0:compile
[INFO] | | \- com.google.api.grpc:grpc-google-common-protos:jar:0.1.14:compile
[INFO] | | \- io.grpc:grpc-protobuf:jar:1.4.0:compile
[INFO] | | \- io.grpc:grpc-protobuf-lite:jar:1.4.0:compile
[INFO] | +- com.google.cloud:google-cloud-dns:jar:0.21.0-alpha:compile
[INFO] | | +- com.google.apis:google-api-services-dns:jar:v1-rev7-1.21.0:compile
[INFO] | | \- commons-fileupload:commons-fileupload:jar:1.3.2:compile
[INFO] | | \- commons-io:commons-io:jar:2.2:compile
[INFO] | +- com.google.cloud:google-cloud-errorreporting:jar:0.21.0-alpha:compile
[INFO] | | +- com.google.cloud:google-cloud-core-grpc:jar:1.3.0:compile
[INFO] | | | \- io.grpc:grpc-context:jar:1.4.0:compile
[INFO] | | +- com.google.api.grpc:proto-google-cloud-error-reporting-v1beta1:jar:0.1.14:compile
[INFO] | | +- io.grpc:grpc-netty:jar:1.4.0:compile
[INFO] | | | +- io.grpc:grpc-core:jar:1.4.0:compile (version selected from constraint [1.4.0,1.4.0])
[INFO] | | | | \- com.google.instrumentation:instrumentation-api:jar:0.4.2:compile
[INFO] | | | +- io.netty:netty-codec-http2:jar:4.1.11.Final:compile (version selected from constraint [4.1.11.Final,4.1.11.Final])
[INFO] | | | | +- io.netty:netty-codec-http:jar:4.1.11.Final:compile
[INFO] | | | | | \- io.netty:netty-codec:jar:4.1.11.Final:compile
[INFO] | | | | \- io.netty:netty-handler:jar:4.1.11.Final:compile
[INFO] | | | | \- io.netty:netty-buffer:jar:4.1.11.Final:compile
[INFO] | | | | \- io.netty:netty-common:jar:4.1.11.Final:compile
[INFO] | | | \- io.netty:netty-handler-proxy:jar:4.1.11.Final:compile
[INFO] | | | +- io.netty:netty-transport:jar:4.1.11.Final:compile
[INFO] | | | | \- io.netty:netty-resolver:jar:4.1.11.Final:compile
[INFO] | | | \- io.netty:netty-codec-socks:jar:4.1.11.Final:compile
[INFO] | | +- io.grpc:grpc-stub:jar:1.4.0:compile
[INFO] | | \- io.grpc:grpc-auth:jar:1.4.0:compile
[INFO] | +- com.google.cloud:google-cloud-language:jar:0.21.0-beta:compile
[INFO] | | +- com.google.api.grpc:proto-google-cloud-language-v1:jar:0.1.14:compile
[INFO] | | \- com.google.api.grpc:proto-google-cloud-language-v1beta2:jar:0.1.14:compile
[INFO] | +- com.google.cloud:google-cloud-logging:jar:1.3.0:compile
[INFO] | | +- com.google.api:gax-grpc:jar:0.22.0:compile
[INFO] | | \- com.google.api.grpc:proto-google-cloud-logging-v2:jar:0.1.14:compile
[INFO] | +- com.google.cloud:google-cloud-monitoring:jar:0.21.0-alpha:compile
[INFO] | | \- com.google.api.grpc:proto-google-cloud-monitoring-v3:jar:0.1.14:compile
[INFO] | +- com.google.cloud:google-cloud-pubsub:jar:0.21.0-beta:compile
[INFO] | | +- com.google.api.grpc:proto-google-cloud-pubsub-v1:jar:0.1.14:compile
[INFO] | | \- com.google.api.grpc:grpc-google-cloud-pubsub-v1:jar:0.1.14:compile
[INFO] | +- com.google.cloud:google-cloud-resourcemanager:jar:0.21.0-alpha:compile
[INFO] | | \- com.google.apis:google-api-services-cloudresourcemanager:jar:v1beta1-rev10-1.21.0:compile
[INFO] | +- com.google.cloud:google-cloud-speech:jar:0.21.0-alpha:compile
[INFO] | | +- com.google.api.grpc:proto-google-cloud-speech-v1beta1:jar:0.1.14:compile
[INFO] | | \- com.google.api.grpc:proto-google-cloud-speech-v1:jar:0.1.14:compile
[INFO] | +- com.google.cloud:google-cloud-storage:jar:1.3.0:compile
[INFO] | | \- com.google.apis:google-api-services-storage:jar:v1-rev108-1.22.0:compile
[INFO] | +- com.google.cloud:google-cloud-trace:jar:0.21.0-alpha:compile
[INFO] | | \- com.google.api.grpc:proto-google-cloud-trace-v1:jar:0.1.14:compile
[INFO] | +- com.google.cloud:google-cloud-translate:jar:1.3.0:compile
[INFO] | | \- com.google.apis:google-api-services-translate:jar:v2-rev47-1.22.0:compile
[INFO] | +- com.google.cloud:google-cloud-vision:jar:0.21.0-beta:compile
[INFO] | | \- com.google.api.grpc:proto-google-cloud-vision-v1:jar:0.1.14:compile
[INFO] | \- com.google.cloud:google-cloud-spanner:jar:0.21.0-beta:compile
[INFO] | +- com.google.api.grpc:proto-google-cloud-spanner-v1:jar:0.1.14:compile
[INFO] | +- com.google.api.grpc:proto-google-cloud-spanner-admin-database-v1:jar:0.1.14:compile
[INFO] | +- com.google.api.grpc:proto-google-cloud-spanner-admin-instance-v1:jar:0.1.14:compile
[INFO] | +- com.google.api.grpc:grpc-google-cloud-spanner-v1:jar:0.1.14:compile
[INFO] | +- com.google.api.grpc:grpc-google-cloud-spanner-admin-database-v1:jar:0.1.14:compile
[INFO] | +- com.google.api.grpc:grpc-google-cloud-spanner-admin-instance-v1:jar:0.1.14:compile
[INFO] | +- com.google.api.grpc:grpc-google-longrunning-v1:jar:0.1.14:compile
[INFO] | | \- com.google.api.grpc:proto-google-longrunning-v1:jar:0.1.14:compile
[INFO] | \- com.google.code.findbugs:jsr305:jar:3.0.0:compile
[INFO] +- io.netty:netty-tcnative-boringssl-static:jar:2.0.3.Final:compile
[INFO] +- junit:junit:jar:4.12:test
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] \- com.google.truth:truth:jar:0.34:test
[INFO] +- com.google.guava:guava:jar:20.0:compile
[INFO] \- com.google.errorprone:error_prone_annotations:jar:2.0.18:compile
md5-05e04736d647a5abbe5035273e6ba299
package com.example.speech;
// [START speech_quickstart]
// Imports the Google Cloud client library
import com.google.cloud.speech.v1.RecognitionAudio;
import com.google.cloud.speech.v1.RecognitionConfig;
import com.google.cloud.speech.v1.RecognitionConfig.AudioEncoding;
import com.google.cloud.speech.v1.RecognizeResponse;
import com.google.cloud.speech.v1.SpeechClient;
import com.google.cloud.speech.v1.SpeechRecognitionAlternative;
import com.google.cloud.speech.v1.SpeechRecognitionResult;
import com.google.protobuf.ByteString;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
public class QuickstartSample {
public static void main(String... args) throws Exception {
Logger.getLogger("").setLevel(Level.FINE);
// Instantiates a client
SpeechClient speech = SpeechClient.create();
// The path to the audio file to transcribe
String fileName = "./resources/audio.raw";
// Reads the audio file into memory
Path path = Paths.get(fileName);
byte[] data = Files.readAllBytes(path);
ByteString audioBytes = ByteString.copyFrom(data);
// Builds the sync recognize request
RecognitionConfig config = RecognitionConfig.newBuilder()
.setEncoding(AudioEncoding.LINEAR16)
.setSampleRateHertz(16000)
.setLanguageCode("en-US")
.build();
RecognitionAudio audio = RecognitionAudio.newBuilder()
.setContent(audioBytes)
.build();
// Performs speech recognition on the audio file
RecognizeResponse response = speech.recognize(config, audio);
List<SpeechRecognitionResult> results = response.getResultsList();
for (SpeechRecognitionResult result: results) {
List<SpeechRecognitionAlternative> alternatives = result.getAlternativesList();
for (SpeechRecognitionAlternative alternative: alternatives) {
System.out.printf("Transcription: %s%n", alternative.getTranscript());
}
}
speech.close();
}
}
// [END speech_quickstart]
Without alpn-boot-7.1.0.v20141016.jar, it is always throwing the error - Jetty ALPN/NPN has not been properly configured.
@NagarajP , your pom declares a dependency on 2.0.5.Final of netty-tcnative-boringssl-static , could you try 2.0.3.Final instead to match grpc 1.4's dependency exactly?
@garrettjonesgoogle , even after changing the version ( from 2.0.5.Final to 2.0.3.Final), still i am getting the same error. Please find below. Thanks.
java.lang.IllegalArgumentException: Jetty ALPN/NPN has not been properly configured.
at com.google.cloud.logging.LoggingOptions$DefaultLoggingRpcFactory.create(LoggingOptions.java:66)
at com.google.cloud.logging.LoggingOptions$DefaultLoggingRpcFactory.create(LoggingOptions.java:58)
at com.google.cloud.ServiceOptions.getRpc(ServiceOptions.java:445)
at com.google.cloud.logging.LoggingOptions.getLoggingRpcV2(LoggingOptions.java:134)
at com.google.cloud.logging.LoggingImpl.<init>(LoggingImpl.java:108)
at com.google.cloud.logging.LoggingOptions$DefaultLoggingFactory.create(LoggingOptions.java:46)
at com.google.cloud.logging.LoggingOptions$DefaultLoggingFactory.create(LoggingOptions.java:41)
at com.google.cloud.ServiceOptions.getService(ServiceOptions.java:432)
at com.mycompany.googlecomponents.example.App.<init>(App.java:33)
at com.mycompany.googlecomponents.example.App.main(App.java:37)
Caused by: java.io.IOException: java.lang.IllegalArgumentException: Jetty ALPN/NPN has not been properly configured.
at com.google.cloud.logging.spi.v2.GrpcLoggingRpc.<init>(GrpcLoggingRpc.java:140)
at com.google.cloud.logging.LoggingOptions$DefaultLoggingRpcFactory.create(LoggingOptions.java:64)
... 9 more
Caused by: 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 io.grpc.netty.NettyChannelBuilder$NettyTransportFactory.<init>(NettyChannelBuilder.java:470)
at io.grpc.netty.NettyChannelBuilder.buildTransportFactory(NettyChannelBuilder.java:338)
at io.grpc.internal.AbstractManagedChannelImplBuilder.build(AbstractManagedChannelImplBuilder.java:305)
at com.google.api.gax.grpc.InstantiatingChannelProvider.createChannel(InstantiatingChannelProvider.java:125)
at com.google.api.gax.grpc.InstantiatingChannelProvider.getChannel(InstantiatingChannelProvider.java:110)
at com.google.api.gax.grpc.GrpcTransportProvider.getTransport(GrpcTransportProvider.java:98)
at com.google.cloud.logging.spi.v2.GrpcLoggingRpc.<init>(GrpcLoggingRpc.java:111)
... 10 more
Hi @garrettjonesgoogle , Any updated resolution for this issue? Thanks
@naushad97 , @scraly , @pupimvictor , @jonathanbl - all of you have filed issues (one of them the present one) related to this issue. I have bootstrapped a compatibility checker:
Please run it and paste the output here. This will tell me which of you still need more investigation for root cause, and which of you are running on an unsupported platform.
Thanks!
Oh and @NagarajP also, please try the compatibility checker.
Hi @garrettjonesgoogle , Please find the required info from my machine:
OS details:
os.detected.name: windows
os.detected.arch: x86_64
os.detected.classifier: windows-x86_64
os.detected.release: null
os.detected.release.version: null
Checking compatibility...
This OS + architecture is supported by Forked Tomcat Native.
Result: UNKNOWN (checker implementation not complete)
I am working on getting a Windows machine procured in order to investigate. @NagarajP , which version of Windows exactly are you using?
In the meantime, are any other requesters able to provide the compat-checker output for their environments?
Hi @garrettjonesgoogle , it is windows 7 Enterprise Service Pack 1. It is just my development environment. My production environment is Google Cloud Platform, most likely OS will be Ubuntu. if you feel that, this code work in Mac, i can test there also. Thanks.
This code should work on Ubuntu & Mac. For that matter, it should work on Windows too - I have no idea if it is because you're on Windows 7 and not Windows 10.
I got same exception message when running the sample "speech" application as a plain java application.
(My OS is windows 7, too)
how can I fix this problem? T.T
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 io.grpc.netty.NettyChannelBuilder$NettyTransportFactory.
at io.grpc.netty.NettyChannelBuilder.buildTransportFactory(NettyChannelBuilder.java:338)
at io.grpc.internal.AbstractManagedChannelImplBuilder.build(AbstractManagedChannelImplBuilder.java:305)
at com.google.api.gax.grpc.InstantiatingChannelProvider.createChannel(InstantiatingChannelProvider.java:125)
at com.google.api.gax.grpc.InstantiatingChannelProvider.getChannel(InstantiatingChannelProvider.java:110)
at com.google.api.gax.grpc.GrpcTransportProvider.getTransport(GrpcTransportProvider.java:98)
at com.google.api.gax.grpc.GrpcTransportProvider.getTransport(GrpcTransportProvider.java:59)
at com.google.api.gax.rpc.ClientContext.create(ClientContext.java:97)
at com.google.cloud.speech.v1.stub.GrpcSpeechStub.create(GrpcSpeechStub.java:89)
at com.google.cloud.speech.v1.SpeechSettings.createStub(SpeechSettings.java:122)
at com.google.cloud.speech.v1.SpeechClient.
at com.google.cloud.speech.v1.SpeechClient.create(SpeechClient.java:112)
at com.google.cloud.speech.v1.SpeechClient.create(SpeechClient.java:104)
at com.example.speech.QuickstartSample.main(QuickstartSample.java:38)
@seongyeolpark I suspect that netty-tcnative doesn't work on Windows 7, but I don't have access to Windows 7 to verify. Do you have any way of trying your code on Windows 10?
@garrettjonesgoogle I got the same error in Windows 10 as well.
For all those having trouble, make sure that you're running the 64-bit version of Java and not the 32-bit version. That was my problem, independent of running Windows 10 64-bit.
You can also check for yourself if OpenSSL is available with: io.netty.handler.ssl.OpenSsl.isAvailable()
And if not, then print the reason with: io.netty.handler.ssl.OpenSsl.unavailabilityCause().printStackTrace();
Thanks @jbrew138 ! I will be adding these checks to google-cloud-compat-checker.
I have added additional checks to the google-cloud-compat-checker. For anyone who is still having issues, please sync to the latest version and re-run it. I'm interested in hearing both 1) when the checker finds the problem someone is having, (yay, you know what to fix now!) and 2) when the checker still isn't finding anything wrong (we need to figure out other potential causes).
There have been no new responses in the last 4 days from anyone having trouble, so I'm going to close this out now. If anyone is having trouble that is still undiagnosed, feel free to reopen.
Hi @garrettjonesgoogle , Sorry for the delay. Now i am trying in Mac. The above said problem is gone. However getting
com.google.cloud.logging.LoggingException: io.grpc.StatusRuntimeException: PERMISSION_DENIED: The request is missing a valid API key. error. Not sure , what is the special permission i should have to read the logs through API as i am able to read it through console. Please clarify. Thanks.
@NagarajP could you file a new issue? The present one is already closed, and your new issue is a different problem.
Sure, will do. @garrettjonesgoogle. Thanks
Adding this dependency worked for me.
Still seeing this issue in Ubuntu 17.04
OS details:
os.detected.name: linux
os.detected.arch: x86_64
os.detected.classifier: linux-x86_64
os.detected.release: ubuntu
os.detected.release.version: 17.04
JVM details:
Java version: 1.8.0_131
Java specification version: 1.8
JVM bit mode: 64
OpenSSL details:
open ssl is available: true
ALPN is supported: true
Checking compatibility...
[PASS] This OS + architecture is supported.
[PASS] 64-bit JVM is supported.
[PASS] Open SSL is available
[PASS] Open SSL ALPN is supported
Result: UNKNOWN (checker implementation not complete)
Based on what was checked, nothing was identified that would
prevent you from using grpc-based APIs.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.933 s
[INFO] Finished at: 2017-09-27T18:21:20+00:00
[INFO] Final Memory: 17M/470M
[INFO] ------------------------------------------------------------------------
and
com.google.cloud.logging.LoggingException: java.lang.IllegalArgumentException: Jetty ALPN/NPN has not been properly
configured.
1419 at com.google.cloud.logging.LoggingOptions$DefaultLoggingRpcFactory.create(LoggingOptions.java:66)
1420 at com.google.cloud.logging.LoggingOptions$DefaultLoggingRpcFactory.create(LoggingOptions.java:58)
1421 at com.google.cloud.ServiceOptions.getRpc(ServiceOptions.java:472)
1422 at com.google.cloud.logging.LoggingOptions.getLoggingRpcV2(LoggingOptions.java:134)
1423 at com.google.cloud.logging.LoggingImpl.<init>(LoggingImpl.java:108)
1424 at com.google.cloud.logging.LoggingOptions$DefaultLoggingFactory.create(LoggingOptions.java:46)
1425 at com.google.cloud.logging.LoggingOptions$DefaultLoggingFactory.create(LoggingOptions.java:41)
1426 at com.google.cloud.ServiceOptions.getService(ServiceOptions.java:459)
1427 at com.myproject.framework.logger.StackdriverAppender.<init>(StackdriverAppender.java:49)
1428 at com.myproject.framework.utils.LoggerControl.addStackdriverAppender(LoggerControl.java:131)
1429 at com.myproject.framework.config.CoreInitializer.initialize(CoreInitializer.java:510)
1430 at org.springframework.boot.SpringApplication.applyInitializers(SpringApplication.java:635)
1431 at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:349)
1432 at org.springframework.boot.SpringApplication.run(SpringApplication.java:313)
1433 at com.myproject.framework.configserver.StartConfigServer.main(StartConfigServer.java:45)
1434 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
1435 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
1436 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
1437 at java.lang.reflect.Method.invoke(Method.java:498)
1438 at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
1439 at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
1440 at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
1441 at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
1442 Caused by: java.io.IOException: java.lang.IllegalArgumentException: Jetty ALPN/NPN has not been properly
configured.
1443 at com.google.cloud.logging.spi.v2.GrpcLoggingRpc.<init>(GrpcLoggingRpc.java:141)
1444 at com.google.cloud.logging.LoggingOptions$DefaultLoggingRpcFactory.create(LoggingOptions.java:64)
1445 ... 22 common frames omitted
1446 Caused by: java.lang.IllegalArgumentException: Jetty ALPN/NPN has not been properly configured.
1447 at io.grpc.netty.GrpcSslContexts.selectApplicationProtocolConfig(GrpcSslContexts.java:159)
1448 at io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:136)
1449 at io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:124)
1450 at io.grpc.netty.GrpcSslContexts.forClient(GrpcSslContexts.java:94)
1451 at
io.grpc.netty.NettyChannelBuilder$NettyTransportFactory$DefaultNettyTransportCreationParamsFilterFactory.<init>(NettyChannelBuilder.java:525)
1452 at
io.grpc.netty.NettyChannelBuilder$NettyTransportFactory$DefaultNettyTransportCreationParamsFilterFactory.<init>(NettyChannelBuilder.java:518)
1453 at io.grpc.netty.NettyChannelBuilder$NettyTransportFactory.<init>(NettyChannelBuilder.java:457)
1454 at io.grpc.netty.NettyChannelBuilder.buildTransportFactory(NettyChannelBuilder.java:326)
1455 at io.grpc.internal.AbstractManagedChannelImplBuilder.build(AbstractManagedChannelImplBuilder.java:315)
1456 at
com.google.api.gax.grpc.InstantiatingChannelProvider.createChannel(InstantiatingChannelProvider.java:131)
1457 at com.google.api.gax.grpc.InstantiatingChannelProvider.getChannel(InstantiatingChannelProvider.java:116)
1458 at com.google.api.gax.grpc.GrpcTransportProvider.getTransport(GrpcTransportProvider.java:98)
1459 at com.google.cloud.logging.spi.v2.GrpcLoggingRpc.<init>(GrpcLoggingRpc.java:112)
1460 ... 23 common frames omitted
excluding swapping netty-tcnative-boringssl-static for 2.0.5/6 did not make a difference either.
not having any luck resolving this one -> should I open a new issue for it?
I'm getting this on App Engine (java7 runtime):
com.google.cloud.firestore.FirestoreException: java.lang.IllegalArgumentException: Jetty ALPN/NPN has not been properly configured.
at com.google.cloud.firestore.FirestoreException.networkException(FirestoreException.java:75)
at com.google.cloud.firestore.FirestoreOptions$DefaultFirestoreRpcFactory.create(FirestoreOptions.java:73)
at com.google.cloud.firestore.FirestoreOptions$DefaultFirestoreRpcFactory.create(FirestoreOptions.java:63)
at com.google.cloud.ServiceOptions.getRpc(ServiceOptions.java:472)
at com.google.cloud.firestore.FirestoreOptions.getFirestoreRpc(FirestoreOptions.java:163)
at com.google.cloud.firestore.FirestoreImpl.<init>(FirestoreImpl.java:140)
at com.google.cloud.firestore.FirestoreOptions$DefaultFirestoreFactory.create(FirestoreOptions.java:54)
at com.google.cloud.firestore.FirestoreOptions$DefaultFirestoreFactory.create(FirestoreOptions.java:47)
at com.google.cloud.ServiceOptions.getService(ServiceOptions.java:459)
at com.test.FirebaseAppHolder.startListener(FirebaseAppHolder.java:102)
at com.test.ServletContextListenerImpl.contextInitialized(ServletContextListenerImpl.java:10)
at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:548)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.createHandler(AppVersionHandlerMap.java:203)
at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.getHandler(AppVersionHandlerMap.java:176)
at com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:134)
at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.dispatchServletRequest(JavaRuntime.java:680)
at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.dispatchRequest(JavaRuntime.java:642)
at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.run(JavaRuntime.java:612)
at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:454)
at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:461)
at com.google.tracing.CurrentContext.runInContext(CurrentContext.java:297)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:320)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:312)
at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:458)
at com.google.apphosting.runtime.ThreadGroupPool$PoolEntry.run(ThreadGroupPool.java:274)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: java.lang.IllegalArgumentException: Jetty ALPN/NPN has not been properly configured.
at com.google.cloud.firestore.spi.v1beta1.GrpcFirestoreRpc.<init>(GrpcFirestoreRpc.java:129)
at com.google.cloud.firestore.FirestoreOptions$DefaultFirestoreRpcFactory.create(FirestoreOptions.java:71)
... 29 more
Caused by: java.lang.IllegalArgumentException: Jetty ALPN/NPN has not been properly configured.
at io.grpc.netty.GrpcSslContexts.selectApplicationProtocolConfig(GrpcSslContexts.java:159)
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 io.grpc.netty.NettyChannelBuilder$NettyTransportFactory$DefaultNettyTransportCreationParamsFilterFactory.<init>(NettyChannelBuilder.java:525)
at io.grpc.netty.NettyChannelBuilder$NettyTransportFactory$DefaultNettyTransportCreationParamsFilterFactory.<init>(NettyChannelBuilder.java:518)
at io.grpc.netty.NettyChannelBuilder$NettyTransportFactory.<init>(NettyChannelBuilder.java:457)
at io.grpc.netty.NettyChannelBuilder.buildTransportFactory(NettyChannelBuilder.java:326)
at io.grpc.internal.AbstractManagedChannelImplBuilder.build(AbstractManagedChannelImplBuilder.java:315)
at com.google.api.gax.grpc.InstantiatingChannelProvider.createChannel(InstantiatingChannelProvider.java:131)
at com.google.api.gax.grpc.InstantiatingChannelProvider.getChannel(InstantiatingChannelProvider.java:116)
at com.google.api.gax.grpc.GrpcTransportProvider.getTransport(GrpcTransportProvider.java:98)
at com.google.cloud.firestore.spi.v1beta1.GrpcFirestoreRpc.<init>(GrpcFirestoreRpc.java:104)
... 30 more
@hiranya911 have you considered using Java 8 runtime?
For those who landed on this issue from search, please see the gRPC troubleshooting guide that should help you resolve most of the issues: https://github.com/grpc/grpc-java/blob/master/SECURITY.md#troubleshooting
Most helpful comment
@naushad97 can you try add netty-tcnative as a dependency to your project ? This is a recommended way of using GRPC over TLS, and windows should be supported (see here for details).