I'm trying to run a Java program on a RPi 3B+, but when I ran it I got the following error. I tried all the fixes from Failed to load any of the given libraries: [netty-tcnative-linux-x86_64,netty-tcnative], and none of them worked. I tried using Java 11, using a 64 bit OS instead of 32 bit OS, and adding the native netty dependencies (using the latest version). I'm really not sure why can't load the netty_tcnative_linux_aarch64_fedora library, as I specifically imported netty for that specific architecture, and when I run mvn clean package
, I can see in the logs that it includes the linux aarch64 libraries in the jar. Is there any other way to make this work? Or am I doing something wrong?
The error:
java.lang. IllegalArgumentException: Failed to load any of the given libraries: [netty_tcnative_linux_aarch_64,netty_tcnative_linux_aarch_64_fedora,netty_tcnative_aarch_64,netty_tcnative]
at io.grpc.netty.shaded.io.netty.util.internal.NativeLibraryLoader.loadFirstAvailable(NativeLibraryLoader.java:107)
at io.grpc.netty.shaded.io.netty.handler.ssl.OpenSsl.loadTcNative(OpenSsl.java:705)
at io.grpc.netty.shaded.io.netty.handler.ssl.OpenSsl.<clinit>(OpenSsl.java:146)
at io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts.defaultSslProvider(GrpcSslContexts.java:230)
at io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:146)
at io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts.forClient(GrpcSslContexts.java:95)
at io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilderSDefaultProtocolNegotiator.newNegotiator(NettyChannelBuilder.java:628)
at io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder.buildTransportFactory(NettyChannelBuilder.java:530)
at io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilderSNettyChannelTransportFactoryBuilder.buildclientTransportFactory(NettyChannelBuilder.java:188)
at io.grpc.internal.ManagedChannelImplBuilder.build(ManagedChannelImplBuilder.java:626)
at io.grpc.internal.AbstractManagedChannelImplBuilder.build(AbstractManagedChannelImplBuilder.java:297)
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createSingleChannel(InstantiatingGrpcChannelProvider.java:388)
at com.google.api.gax.grpc.ChannelPool.<init>(ChannelPool.java:105)
at com.google.api.gax.grpc.ChannelPool.create(ChannelPool.java:83)
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createChannel(InstantiatingGrpcChannelProvider.java:236)
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.getTransportChannel(InstantiatingGrpcChannelProvider.java:230)
at com.google.api.gax.rpc.ClientContext.create(ClientContext.java:201)
The dependencies (Maven):
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative</artifactId>
<version>2.0.52.Final</version>
<classifier>linux-aarch_64-fedora</classifier>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative-boringssl-static</artifactId>
<version>2.0.52.Final</version>
<classifier>linux-aarch_64</classifier>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-handler</artifactId>
<version>4.1.77.Final</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty-shaded</artifactId>
<version>1.47.0</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.1.77.Final</version>
</dependency>
The logs showing the netty libraries being included in the jar:
[INFO] Including io.netty:netty-tcnative:jar:linux-aarch_64-fedora:2.0.52.Final in the shaded jar.
[INFO] Including io.netty:netty-tcnative-classes:jar:2.0.52.Final in the shaded jar.
[INFO] Including io.netty:netty-tcnative-boringssl-static:jar:linux-aarch_64:2.0.52.Final in the shaded jar.
[INFO] Including io.netty:netty-tcnative-boringssl-static:jar:linux-x86_64:2.0.52.Final in the shaded jar.
[INFO] Including io.netty:netty-tcnative-boringssl-static:jar:osx-x86_64:2.0.52.Final in the shaded jar.
[INFO] Including io.netty:netty-tcnative-boringssl-static:jar:osx-aarch_64:2.0.52.Final in the shaded jar.
[INFO] Including io.netty:netty-tcnative-boringssl-static:jar:windows-x86_64:2.0.52.Final in the shaded jar.
Edit: I think I might have gotten it working on the Raspberry pi, but there was another error that required me to switch to Java 8. I didn't know how to switch to Java 8, because somehow the command didn't work, so I switched to a Linux x86-64 distro, where I'm back at the exact same error. I have the libraries imported but they won't load. Does anyone know how to get Java 8 on the Rpi, or how to fix this problem?
Somehow, when I run the program on my aarch64 Mac from command line, it has the exact same error except it still works? I have no idea what is going on