问题描述
我已经在tomcat容器中部署了一个Web应用程序,并使用了带有netty-tcnative-boringssl-static:jar:1.1.33.Fork26的grpc-netty(1.2.0).
I have deployed a web-application inside a tomcat container and have used grpc-netty (1.2.0) with netty-tcnative-boringssl-static:jar:1.1.33.Fork26.
当我打开调试日志时,它会告诉您"java.lang.IllegalArgumentException:无法加载任何给定的库:[netty-tcnative-linux-x86_64,netty-tcnative-linux-x86_64-fedora,netty-tcnative ]",然后出现错误消息"java.lang.IllegalArgumentException:码头ALPN/NPN尚未正确配置.".
When i switch on debug logs it tells that "java.lang.IllegalArgumentException: Failed to load any of the given libraries: [netty-tcnative-linux-x86_64, netty-tcnative-linux-x86_64-fedora, netty-tcnative]" and then a error message "java.lang.IllegalArgumentException: Jetty ALPN/NPN has not been properly configured.".
我已经完成了 https://github的疑难解答部分.com/grpc/grpc-java/blob/master/SECURITY.md 并已验证我的netty版本,这看起来还不错.以下是我的Maven依赖项列表
I have gone through the troubleshooting section of https://github.com/grpc/grpc-java/blob/master/SECURITY.md and have verified my netty versions and this looks to be fine. Below is my maven dependency list
[INFO] | +- io.grpc:grpc-core:jar:1.2.0:compile
[INFO] | | +- com.google.guava:guava:jar:19.0:compile
[INFO] | | +- com.google.errorprone:error_prone_annotations:jar:2.0.11:compile
[INFO] | | +- com.google.code.findbugs:jsr305:jar:3.0.0:compile
[INFO] | | +- io.grpc:grpc-context:jar:1.2.0:compile
[INFO] | | \- com.google.instrumentation:instrumentation-api:jar:0.3.0:compile
[INFO] | +- io.grpc:grpc-netty:jar:1.2.0:compile
[INFO] | | +- io.netty:netty-codec-http2:jar:4.1.8.Final:compile (version selected from constraint [4.1.8.Final,4.1.8.Final])
[INFO] | | | +- io.netty:netty-codec-http:jar:4.1.8.Final:compile
[INFO] | | | | \- io.netty:netty-codec:jar:4.1.8.Final:compile
[INFO] | | | \- io.netty:netty-handler:jar:4.1.8.Final:compile
[INFO] | | | \- io.netty:netty-buffer:jar:4.1.8.Final:compile
[INFO] | | | \- io.netty:netty-common:jar:4.1.8.Final:compile
[INFO] | | \- io.netty:netty-handler-proxy:jar:4.1.8.Final:compile
[INFO] | | +- io.netty:netty-transport:jar:4.1.8.Final:compile
[INFO] | | | \- io.netty:netty-resolver:jar:4.1.8.Final:compile
[INFO] | | \- io.netty:netty-codec-socks:jar:4.1.8.Final:compile
[INFO] | +- io.grpc:grpc-protobuf:jar:1.2.0:compile
[INFO] | | +- com.google.protobuf:protobuf-java:jar:3.2.0:compile
[INFO] | | +- com.google.protobuf:protobuf-java-util:jar:3.2.0:compile
[INFO] | | | \- com.google.code.gson:gson:jar:2.7:compile
[INFO] | | \- io.grpc:grpc-protobuf-lite:jar:1.2.0:compile
[INFO] | +- io.grpc:grpc-stub:jar:1.2.0:compile
[INFO] | +- net.javacrumbs.future-converter:future-converter-java8-guava:jar:1.1.0:compile
[INFO] | | +- net.javacrumbs.future-converter:future-converter-common:jar:1.1.0:compile
[INFO] | | +- net.javacrumbs.future-converter:future-converter-java8-common:jar:1.1.0:compile
[INFO] | | \- net.javacrumbs.future-converter:future-converter-guava-common:jar:1.1.0:compile
[INFO] | +- io.netty:netty-tcnative-boringssl-static:jar:1.1.33.Fork26:compile
调试日志:
2018-04-23 11:38:28 DEBUG NativeLibraryLoader:71 - -Dio.netty.tmpdir: /opt/tomcat/temp (java.io.tmpdir)
2018-04-23 11:38:28 DEBUG NativeLibraryLoader:71 - -Dio.netty.native.workdir: /opt/tomcat/temp (io.netty.tmpdir)
2018-04-23 11:38:28 DEBUG NativeLibraryLoader:81 - Unable to load the library 'netty-tcnative-linux-x86_64', trying other loading mechanism.
java.lang.UnsatisfiedLinkError: no netty-tcnative-linux-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:273)
at java.security.AccessController.doPrivileged(Native Method)
at io.netty.util.internal.NativeLibraryLoader.loadLibraryByHelper(NativeLibraryLoader.java:264)
at io.netty.util.internal.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:252)
at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:199)
at io.netty.util.internal.NativeLibraryLoader.loadFirstAvailable(NativeLibraryLoader.java:170)
at io.netty.handler.ssl.OpenSsl.loadTcNative(OpenSsl.java:412)
at io.netty.handler.ssl.OpenSsl.<clinit>(OpenSsl.java:90)
at io.grpc.netty.GrpcSslContexts.defaultSslProvider(GrpcSslContexts.java:158)
at io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:139)
at io.grpc.netty.GrpcSslContexts.forClient(GrpcSslContexts.java:109)
2018-04-23 11:38:28 DEBUG NativeLibraryLoader:81 - Unable to load the library 'netty-tcnative-linux-x86_64', trying next name...
java.lang.UnsatisfiedLinkError: no netty-tcnative-linux-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 io.netty.util.internal.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:259)
at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:199)
at io.netty.util.internal.NativeLibraryLoader.loadFirstAvailable(NativeLibraryLoader.java:170)
at io.netty.handler.ssl.OpenSsl.loadTcNative(OpenSsl.java:412)
at io.netty.handler.ssl.OpenSsl.<clinit>(OpenSsl.java:90)
at io.grpc.netty.GrpcSslContexts.defaultSslProvider(GrpcSslContexts.java:158)
at io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:139)
at io.grpc.netty.GrpcSslContexts.forClient(GrpcSslContexts.java:109
2018-04-23 11:38:28 DEBUG OpenSsl:91 - Failed to load netty-tcnative; OpenSslEngine will be unavailable, unless the application has already loaded the symbols by some other means. See http://netty.io/wiki/forked-tomcat-native.html for more information.
java.lang.IllegalArgumentException: Failed to load any of the given libraries: [netty-tcnative-linux-x86_64, netty-tcnative-linux-x86_64-fedora, netty-tcnative]
at io.netty.util.internal.NativeLibraryLoader.loadFirstAvailable(NativeLibraryLoader.java:177)
at io.netty.handler.ssl.OpenSsl.loadTcNative(OpenSsl.java:412)
at io.netty.handler.ssl.OpenSsl.<clinit>(OpenSsl.java:90)
at io.grpc.netty.GrpcSslContexts.defaultSslProvider(GrpcSslContexts.java:158)
at io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:139)
at io.grpc.netty.GrpcSslContexts.forClient(GrpcSslContexts.java:109)
推荐答案
我找到了解决方案,我将netty-tcnative-boringssl-static升级到2.0.7,并且通过此更改,所有其他版本都必须升级(检查 https://github.com/grpc/grpc-java/blob/master/SECURITY.md ).这是我使用过的列表,
I found out the solution, i upgraded netty-tcnative-boringssl-static to 2.0.7 and with this change all the other versions had to be upgraded (check the table in troubleshooting section in https://github.com/grpc/grpc-java/blob/master/SECURITY.md). This is the list i have used,
grpc-netty-1.9.1.jar
netty-3.2.2.Final.jar
netty-buffer-4.1.17.Final.jar
netty-codec-4.1.17.Final.jar
netty-codec-http-4.1.17.Final.jar
netty-codec-http2-4.1.17.Final.jar
netty-codec-socks-4.1.17.Final.jar
netty-common-4.1.17.Final.jar
netty-handler-4.1.17.Final.jar
netty-handler-proxy-4.1.17.Final.jar
netty-resolver-4.1.17.Final.jar
netty-tcnative-boringssl-static-2.0.7.Final.jar
netty-transport-4.1.17.Final.jar
grpc-context-1.9.1.jar
grpc-core-1.9.1.jar
grpc-protobuf-1.9.1.jar
grpc-protobuf-lite-1.9.1.jar
grpc-stub-1.9.1.jar
opencensus-contrib-grpc-metrics-0.10.0.jar
这篇关于无法加载任何给定的库:[netty-tcnative-linux-x86_64,netty-tcnative]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!