grpc-java icon indicating copy to clipboard operation
grpc-java copied to clipboard

java.lang.UnsatisfiedLinkError: no netty_tcnative_osx_x86_64 in java.library.path

Open luncongzhang opened this issue 6 years ago • 7 comments

why cant load

java.lang.UnsatisfiedLinkError: no netty_tcnative_osx_x86_64 in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867) at java.lang.Runtime.loadLibrary0(Runtime.java:870) at java.lang.System.loadLibrary(System.java:1122) at io.netty.util.internal.NativeLibraryUtil.loadLibrary(NativeLibraryUtil.java:38) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at io.netty.util.internal.NativeLibraryLoader$1.run(NativeLibraryLoader.java:336) at java.security.AccessController.doPrivileged(Native Method) at io.netty.util.internal.NativeLibraryLoader.loadLibraryByHelper(NativeLibraryLoader.java:328) at io.netty.util.internal.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:306) at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:136) at io.netty.util.internal.NativeLibraryLoader.loadFirstAvailable(NativeLibraryLoader.java:96) at io.netty.handler.ssl.OpenSsl.loadTcNative(OpenSsl.java:440) at io.netty.handler.ssl.OpenSsl.(OpenSsl.java:97) at io.netty.handler.ssl.SslContext.defaultProvider(SslContext.java:119) at io.netty.handler.ssl.SslContext.defaultClientProvider(SslContext.java:115) at io.netty.handler.ssl.SslContext.newClientContextInternal(SslContext.java:764) at io.netty.handler.ssl.SslContextBuilder.build(SslContextBuilder.java:452)

luncongzhang avatar Feb 20 '20 15:02 luncongzhang

I am also facing the same issue - https://github.com/grpc/grpc-java/issues/6735

raviprakashmishra avatar Feb 20 '20 22:02 raviprakashmishra

@raviprakashmishra i solved,unzip grpc-netty-shaded jar,in METS_INF/native have 3 native file,then use -Djava.library.path config this 3 native file load,its ok

luncongzhang avatar Feb 21 '20 12:02 luncongzhang

Right, I fixed the issue same way but I think if the environment variable is not defined then logging the message with the stack trace is bit too much even at the debug level. I don't want to maintain extra set of native dlls in my environment for any possible compatibility problems.

raviprakashmishra avatar Feb 21 '20 22:02 raviprakashmishra

As you are using grpc-netty-shaded, you should use BoringSSL instead of OpenSSL otherwise you might need to shade OpenSSL as well which probably will not work.

dapengzhang0 avatar Feb 22 '20 00:02 dapengzhang0

what does it mean to shade the OpenSSL? Is there any documentation on using BoringSSL vs OpenSSL with grpc-netty-shaded?

raviprakashmishra avatar Feb 22 '20 00:02 raviprakashmishra

See BoringSSL for using BoringSSL. For shading you need to use "maven shade plugin" which is quite complicated if you did not know it. I don't think shading will work because tcnative contains JNI.

dapengzhang0 avatar Feb 22 '20 00:02 dapengzhang0

@metayx, you should not unzip grpc-netty-shaded. Instead you should add a dependency on netty-tcnative-boringssl-static.

ejona86 avatar Feb 24 '20 19:02 ejona86