netty: Netty won't load OpenSSL

Hello ,I am putting the TLS into a RPC project. I copied the Netty example source codes and run it. But I got an exception when I used the OpenSSL . Exception: java.lang.IllegalArgumentException: Failed to load any of the given libraries: [netty_tcnative_windows_x86_64, netty_tcnative_x86_64, netty_tcnative]

Expected behavior

should work

Actual behavior

I followed the official guide on the wiki on how to install the netty-tcnative with the following link [(https://netty.io/wiki/forked-tomcat-native.html)]

maven file … <dependency> <groupId>io.netty</groupId> <artifactId>netty-tcnative-boringssl-static</artifactId> <version>2.0.0.Final</version> <classifier>${os.detected.classifier}</classifier> </dependency> … <extensions> <extension> <groupId>kr.motd.maven</groupId> <artifactId>os-maven-plugin</artifactId> <version>1.4.0.Final</version> </extension> </extensions>

I got the following exception when I run the souce code. java.lang.IllegalArgumentException: Failed to load any of the given libraries: [netty_tcnative_windows_x86_64, netty_tcnative_x86_64, netty_tcnative]

Steps to reproduce

// Configure SSL. SslContext sslCtx; try { if (SSL) { SslProvider provider = OpenSsl.isAlpnSupported() ? SslProvider.OPENSSL : SslProvider.JDK; SelfSignedCertificate ssc = new SelfSignedCertificate(); sslCtx = io.netty.handler.ssl.SslContextBuilder .forServer(ssc.certificate(), ssc.privateKey()) .sslProvider(provider) /* * NOTE: the cipher filter may not include all ciphers required by the HTTP/2 * specification. Please refer to the HTTP/2 specification for cipher * requirements. */ .ciphers(Http2SecurityUtil.CIPHERS, SupportedCipherSuiteFilter.INSTANCE) .applicationProtocolConfig( new ApplicationProtocolConfig( ApplicationProtocolConfig.Protocol.ALPN, // NO_ADVERTISE is currently the only mode supported by both OpenSsl and JDK // providers. ApplicationProtocolConfig.SelectorFailureBehavior.NO_ADVERTISE, // ACCEPT is currently the only mode supported by both OpenSsl and JDK // providers. ApplicationProtocolConfig.SelectedListenerFailureBehavior.ACCEPT, ApplicationProtocolNames.HTTP_2, ApplicationProtocolNames.HTTP_1_1)) .build();

Minimal yet complete reproducer code (or URL to code)

Netty version

Netty version 4.1.25.Final

JVM version (e.g. java -version)

“1.8.0_221”

OS version (e.g. uname -a)

Win 10 pro

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 15 (6 by maintainers)

Most upvoted comments

What netty version you use ?

Also you should use the latest netty-tcnative-boringssl-static version:

      <version>2.0.25.Final</version>

Please provide full output of java -version

I suspect you are not running x64 JVM.