Java 着色io后,netty tcnative停止工作
由于依赖项之间存在冲突,我想对io.netty进行着色。着色后,本机ssl库netty tcnative boringssl static的加载停止工作 主聚甲醛 我的主要pom具有以下依赖性:Java 着色io后,netty tcnative停止工作,java,netty,google-cloud-pubsub,Java,Netty,Google Cloud Pubsub,由于依赖项之间存在冲突,我想对io.netty进行着色。着色后,本机ssl库netty tcnative boringssl static的加载停止工作 主聚甲醛 我的主要pom具有以下依赖性: ... <dependency> <groupId>com.example.myapp</groupId> <artifactId>pubsub-library<artifactId> <version>1.
...
<dependency>
<groupId>com.example.myapp</groupId>
<artifactId>pubsub-library<artifactId>
<version>1.0</version>
</dependency>
...
我已经查看了主pom生成的jar内部。并且没有与该名称匹配的本机库。这在META-INF/native目录中:
libnetty-tcnative-linux-x86_64.so
libnetty-tcnative-osx-x86_64.jnilib
libnetty-transport-native-epoll.so
linux32
linux64
netty-tcnative-windows-x86_64.dll
osx
windows32
windows64
我做错了什么?我怎样才能在不破坏tcnative的情况下为io.netty添加阴影。看一下
这可能与您正在使用的版本不同,但它表明它使用很少的启发式方法来查找本机库,而且很可能这些启发式方法在shade上失败,但可能很容易修复
仔细研究代码,可能重写/调试/记录NativeLibraryLoader
您是否被迫使用某些依赖项库的两个版本,从而不能只使用maven排除
17:44:48.230 [main] DEBUG com.example.myapp.shaded.io.netty.util.internal.NativeLibraryLoader - -Dio.netty.tmpdir: /var/folders/ll/wy1vgf8945l_87mpfc9ylb94fglr7d/T (java.io.tmpdir)
17:44:48.230 [main] DEBUG com.example.myapp.shaded.io.netty.util.internal.NativeLibraryLoader - -Dio.netty.native.workdir: /var/folders/ll/wy1vgf8945l_87mpfc9ylb94fglr7d/T (io.netty.tmpdir)
17:44:48.241 [main] DEBUG com.example.myapp.shaded.io.netty.util.internal.NativeLibraryLoader - Unable to load the library 'com.example.myapp-shaded-netty-tcnative-osx-x86_64', trying other loading mechanism.
java.lang.UnsatisfiedLinkError: no com.example.myapp-shaded-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 com.example.myapp.shaded.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 com.example.myapp.shaded.io.netty.util.internal.NativeLibraryLoader$1.run(NativeLibraryLoader.java:311)
at java.security.AccessController.doPrivileged(Native Method)
at com.example.myapp.shaded.io.netty.util.internal.NativeLibraryLoader.loadLibraryByHelper(NativeLibraryLoader.java:303)
at com.example.myapp.shaded.io.netty.util.internal.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:291)
at com.example.myapp.shaded.io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:224)
at com.example.myapp.shaded.io.netty.util.internal.NativeLibraryLoader.loadFirstAvailable(NativeLibraryLoader.java:172)
at com.example.myapp.shaded.io.netty.handler.ssl.OpenSsl.loadTcNative(OpenSsl.java:423)
at com.example.myapp.shaded.io.netty.handler.ssl.OpenSsl.<clinit>(OpenSsl.java:91)
at com.example.myapp.job.audit.GoogleCloudCompatChecker.check(GoogleCloudCompatChecker.java:30)
at com.example.myapp.job.audit.AuditJobMain.main(AuditJobMain.java:8)
libnetty-tcnative-linux-x86_64.so
libnetty-tcnative-osx-x86_64.jnilib
libnetty-transport-native-epoll.so
linux32
linux64
netty-tcnative-windows-x86_64.dll
osx
windows32
windows64