1.13.1
I am using java 8 to build an executable jar. Below is the java version:
$ /usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/bin/java -version
openjdk version "1.8.0_171"
OpenJDK Runtime Environment (build 1.8.0_171-8u171-b11-2~14.04-b11)
OpenJDK 64-Bit Server VM (build 25.171-b11, mixed mode)
I am using gradle 3.4.1 to generate the jar as follows:
/opt/gradle-3.4.1/bin/gradle jar -Dorg.gradle.java.home=/usr/lib/jvm/java-1.8.0-openjdk-amd64/
Below are the dependencies defined in the module-level build.gradle file:
dependencies {
compile files("$TOOLCHAIN_VERSION_DIR/lib/commons-io-2.6.jar")
compile files("$TOOLCHAIN_VERSION_DIR/lib/grpc-all.jar")
compile files("$TOOLCHAIN_VERSION_DIR/lib/java-protobuf.jar")
compile files("$TOOLCHAIN_VERSION_DIR/lib/jetty.jar")
compile files("$TOOLCHAIN_VERSION_DIR/lib/log4j-core-2.8.jar")
compile files("$TOOLCHAIN_VERSION_DIR/lib/log4j-slf4j-impl-2.8.jar")
compile files("$TOOLCHAIN_VERSION_DIR/lib/netty-tcnative-boringssl-static-2.0.20.Final.jar")
compile files("$TOOLCHAIN_VERSION_DIR/lib/netty-tcnative-2.0.20.Final.jar")
compile files("$TOOLCHAIN_VERSION_DIR/lib/picocli-3.8.2.jar")
compile group: 'com.google.guava', name: 'guava', version: '20.0'
compile files("$TOOLCHAIN_VERSION_DIR/lib/javassist-3.19.0-GA.jar")
compile project(':annotation')
}
After building, I am running the jar on an AIX7.2 machine as follows:
/usr/java8_64/jre/bin/java -jar agent-1.0.jar
The java version on the AIX machine is as follows:
$ /usr/java8_64/jre/bin/java -version
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 8.0.5.26 - pap6480sr5fp26-20181115_03(SR5 FP26))
IBM J9 VM (build 2.9, JRE 1.8.0 AIX ppc64-64-Bit Compressed References 20181106_401576 (JIT enabled, AOT enabled)
OpenJ9 - fde1d6f
OMR - d8c3617
IBM - 5c4a9f0)
JCL - 20181022_01 based on Oracle jdk8u191-b26
But I am getting the following error while running:
Feb 17, 2019 3:11:33 AM io.grpc.netty.GrpcSslContexts defaultSslProvider
INFO: netty-tcnative unavailable (this may be normal)
java.lang.IllegalArgumentException: Failed to load any of the given libraries: [netty_tcnative_aix_ppc_64, netty_tcnative_ppc_64, netty_tcnative]
at io.netty.util.internal.NativeLibraryLoader.loadFirstAvailable(NativeLibraryLoader.java:93)
at io.netty.handler.ssl.OpenSsl.loadTcNative(OpenSsl.java:430)
at io.netty.handler.ssl.OpenSsl.<clinit>(OpenSsl.java:97)
at io.grpc.netty.GrpcSslContexts.defaultSslProvider(GrpcSslContexts.java:242)
at io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:171)
at io.grpc.netty.GrpcSslContexts.forServer(GrpcSslContexts.java:151)
at io.grpc.netty.NettyServerBuilder.useTransportSecurity(NettyServerBuilder.java:456)
at io.grpc.netty.NettyServerBuilder.useTransportSecurity(NettyServerBuilder.java:55)
at com.ankit.agents.AgentMain.<init>(AgentMain.java:91)
at com.ankit.agents.AgentMain.main(AgentMain.java:132)
Suppressed: java.lang.UnsatisfiedLinkError: could not load a native library: netty_tcnative_aix_ppc_64
at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:205)
at io.netty.util.internal.NativeLibraryLoader.loadFirstAvailable(NativeLibraryLoader.java:85)
... 9 more
Caused by: java.io.FileNotFoundException: META-INF/native/libnetty_tcnative_aix_ppc_64.a
at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:161)
... 10 more
Suppressed: java.lang.UnsatisfiedLinkError: netty_tcnative_aix_ppc_64 (Not found in java.library.path)
at java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:1425)
at java.lang.ClassLoader.loadLibraryWithClassLoader(ClassLoader.java:1395)
at java.lang.System.loadLibrary(System.java:565)
at io.netty.util.internal.NativeLibraryUtil.loadLibrary(NativeLibraryUtil.java:38)
at io.netty.util.internal.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:243)
at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:124)
... 10 more
Suppressed: java.lang.UnsatisfiedLinkError: netty_tcnative_aix_ppc_64 (Not found in java.library.path)
at java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:1425)
at java.lang.ClassLoader.loadLibraryWithClassLoader(ClassLoader.java:1395)
at java.lang.System.loadLibrary(System.java:565)
at io.netty.util.internal.NativeLibraryUtil.loadLibrary(NativeLibraryUtil.java:38)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:508)
at io.netty.util.internal.NativeLibraryLoader$1.run(NativeLibraryLoader.java:263)
at java.security.AccessController.doPrivileged(AccessController.java:647)
at io.netty.util.internal.NativeLibraryLoader.loadLibraryByHelper(NativeLibraryLoader.java:255)
at io.netty.util.internal.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:233)
... 11 more
Suppressed: java.lang.UnsatisfiedLinkError: could not load a native library: netty_tcnative_ppc_64
at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:205)
at io.netty.util.internal.NativeLibraryLoader.loadFirstAvailable(NativeLibraryLoader.java:85)
... 9 more
Caused by: java.io.FileNotFoundException: META-INF/native/libnetty_tcnative_ppc_64.a
at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:161)
... 10 more
Suppressed: java.lang.UnsatisfiedLinkError: netty_tcnative_ppc_64 (Not found in java.library.path)
at java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:1425)
at java.lang.ClassLoader.loadLibraryWithClassLoader(ClassLoader.java:1395)
at java.lang.System.loadLibrary(System.java:565)
at io.netty.util.internal.NativeLibraryUtil.loadLibrary(NativeLibraryUtil.java:38)
at io.netty.util.internal.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:243)
at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:124)
... 10 more
Suppressed: java.lang.UnsatisfiedLinkError: netty_tcnative_ppc_64 (Not found in java.library.path)
at java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:1425)
at java.lang.ClassLoader.loadLibraryWithClassLoader(ClassLoader.java:1395)
at java.lang.System.loadLibrary(System.java:565)
at io.netty.util.internal.NativeLibraryUtil.loadLibrary(NativeLibraryUtil.java:38)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:508)
at io.netty.util.internal.NativeLibraryLoader$1.run(NativeLibraryLoader.java:263)
at java.security.AccessController.doPrivileged(AccessController.java:647)
at io.netty.util.internal.NativeLibraryLoader.loadLibraryByHelper(NativeLibraryLoader.java:255)
at io.netty.util.internal.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:233)
... 11 more
Suppressed: java.lang.UnsatisfiedLinkError: could not load a native library: netty_tcnative
at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:205)
at io.netty.util.internal.NativeLibraryLoader.loadFirstAvailable(NativeLibraryLoader.java:85)
... 9 more
Caused by: java.io.FileNotFoundException: META-INF/native/libnetty_tcnative.a
at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:161)
... 10 more
Suppressed: java.lang.UnsatisfiedLinkError: netty_tcnative (Not found in java.library.path)
at java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:1425)
at java.lang.ClassLoader.loadLibraryWithClassLoader(ClassLoader.java:1395)
at java.lang.System.loadLibrary(System.java:565)
at io.netty.util.internal.NativeLibraryUtil.loadLibrary(NativeLibraryUtil.java:38)
at io.netty.util.internal.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:243)
at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:124)
... 10 more
Suppressed: java.lang.UnsatisfiedLinkError: netty_tcnative (Not found in java.library.path)
at java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:1425)
at java.lang.ClassLoader.loadLibraryWithClassLoader(ClassLoader.java:1395)
at java.lang.System.loadLibrary(System.java:565)
at io.netty.util.internal.NativeLibraryUtil.loadLibrary(NativeLibraryUtil.java:38)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:508)
at io.netty.util.internal.NativeLibraryLoader$1.run(NativeLibraryLoader.java:263)
at java.security.AccessController.doPrivileged(AccessController.java:647)
at io.netty.util.internal.NativeLibraryLoader.loadLibraryByHelper(NativeLibraryLoader.java:255)
at io.netty.util.internal.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:233)
... 11 more
Feb 17, 2019 3:11:33 AM io.grpc.netty.GrpcSslContexts defaultSslProvider
INFO: Conscrypt not found (this may be normal)
Feb 17, 2019 3:11:33 AM io.grpc.netty.GrpcSslContexts defaultSslProvider
INFO: Jetty ALPN unavailable (this may be normal)
java.lang.ClassNotFoundException: org.eclipse.jetty.alpn.ALPN
at java.lang.Class.forNameImpl(Native Method)
at java.lang.Class.forName(Class.java:403)
at io.grpc.netty.JettyTlsUtil.isJettyAlpnConfigured(JettyTlsUtil.java:64)
at io.grpc.netty.JettyTlsUtil.getJettyAlpnUnavailabilityCause(JettyTlsUtil.java:75)
at io.grpc.netty.GrpcSslContexts.defaultSslProvider(GrpcSslContexts.java:255)
at io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:171)
at io.grpc.netty.GrpcSslContexts.forServer(GrpcSslContexts.java:151)
at io.grpc.netty.NettyServerBuilder.useTransportSecurity(NettyServerBuilder.java:456)
at io.grpc.netty.NettyServerBuilder.useTransportSecurity(NettyServerBuilder.java:55)
at com.ankit.agents.AgentMain.<init>(AgentMain.java:91)
at com.ankit.agents.AgentMain.main(AgentMain.java:132)
Exception in thread "main" java.lang.IllegalStateException: Could not find TLS ALPN provider; no working netty-tcnative, Conscrypt, or Jetty NPN/ALPN available
at io.grpc.netty.GrpcSslContexts.defaultSslProvider(GrpcSslContexts.java:256)
at io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:171)
at io.grpc.netty.GrpcSslContexts.forServer(GrpcSslContexts.java:151)
at io.grpc.netty.NettyServerBuilder.useTransportSecurity(NettyServerBuilder.java:456)
at io.grpc.netty.NettyServerBuilder.useTransportSecurity(NettyServerBuilder.java:55)
at com.ankit.agents.AgentMain.<init>(AgentMain.java:91)
at com.ankit.agents.AgentMain.main(AgentMain.java:132)
However, it is running fine on an Ubuntu machine. I am running the jar as follows:
/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/bin/java -jar agent-1.0.jar
The java version here is:
$ /usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/bin/java -version
openjdk version "1.8.0_171"
OpenJDK Runtime Environment (build 1.8.0_171-8u171-b11-2~14.04-b11)
OpenJDK 64-Bit Server VM (build 25.171-b11, mixed mode)
What is the problem here and how to solve this?
It could be that: https://github.com/grpc/grpc-java/blob/master/SECURITY.md#tls-with-netty-tcnative-on-boringssl
I added runtime 'io.netty:netty-tcnative-boringssl-static:2.0.25.Final'
in my build.gradle and it worked
I have answered this in another similar question also, this issue can also be because of alpine base image incompaitibility if you are using it.
"Looks like you are using base image as alpine, which actually doesn't supports gRPC, you need to add the gcompact apk in your application. So, what you can do is : Using docker :"
RUN apk add gcompat
ENV LD_PRELOAD=/lib/libgcompat.so.0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With