This can be fixed by using "*netty-tcnative-boringssl-static*" library.

On Thursday, November 1, 2018 at 7:25:46 AM UTC-7, [email protected] wrote:
>
> I want to set-up SSL on my GRPC server. Here is what I'm doing:
>
>  File certChain = new File("conf/server.crt");
>  File privateKey = new File("conf/pkcs8_key.pem");
>
>
>  Server server = NettyServerBuilder.forPort(8080)
>  .useTransportSecurity(certChain, privateKey)
>  .addService(new HelloWorldService())
>  .build();
>
> *I am getting following error stack:*
>
> Exception in thread "main" 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.forServer(GrpcSslContexts.java:104)
>  at io.grpc.netty.NettyServerBuilder.useTransportSecurity(
> NettyServerBuilder.java:404)
>  at server.MyServer.main(MyServer.java:22)
> 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)
>  ... 5 more
>
>
> *Here is my gradle dependency block:*
>
> dependencies {
>     compile("io.grpc:grpc-netty:1.7.0")
>     compile("io.grpc:grpc-protobuf:1.7.0")
>     compile("io.grpc:grpc-stub:1.7.0")
>  
>  compile group: 'io.netty', name: 'netty-handler', version: '4.1.16.Final'
>  compile group: 'io.netty', name: 'netty-tcnative-boringssl-static', 
> version: '2.0.6.Final'
>  compile group: 'com.google.gradle', name: 'osdetector-gradle-plugin', 
> version: '1.2.1'
>  
> }
>
>
> Grpc doesn't think I have OpenSSL as SSLProvider available.
>   private static SslProvider defaultSslProvider() {
>     return OpenSsl.isAvailable() ? SslProvider.OPENSSL : SslProvider.JDK;
>   }
>
> Yet, for OpenSSL to be available, I need *netty-tcnative-boringssl-static 
> *on my classpath. Which I have.
>
> Even with JDK as SSLProvider, I don't understand why can't it load class 
> in this grpc internal method:
>
>   static synchronized boolean isJettyAlpnConfigured() {
>     try {
>       Class.forName("org.eclipse.jetty.alpn.ALPN", true, null);
>       return true;
>     } catch (ClassNotFoundException e) {
>       jettyAlpnUnavailabilityCause = e;
>       return false;
>     }
>   }
>
> I do have ALPN in my classpath, as well.
>
>
> Any help is appreciated!!
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/481b8979-4d4a-427e-892e-dd933be92728%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to