Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppressed: java.lang.UnsatisfiedLinkError: no netty_tcnative in java.library.path: /Users/peteaston/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:. #841

Open
utft opened this issue Jan 3, 2024 · 1 comment

Comments

@utft
Copy link

utft commented Jan 3, 2024

Prior to now, I have written a code for Hyperledger Fabric to submit a query or post to the Hyperledger Fabric Blockchain. This was when I was using MACBOOK PRO M1. It wasn't difficult for me to setup Hyperledger Fabric and creating the Connection Profile. Everything was working until I lost my MACBOOK PRO M1.

My problem started when I got MACBOOK PRO M3. I was able to enroll the Admin and also enroll the User. However, when I want to submit a query to Hyperledger Fabric using the Fabric SDK 2.1.1, I get all sorts of errors relating to SSL and Netty.

This is the error I am getting below.

java.lang.IllegalArgumentException: Failed to load any of the given libraries: [netty_tcnative_osx_aarch_64, netty_tcnative_aarch_64, netty_tcnative]
at io.netty.util.internal.NativeLibraryLoader.loadFirstAvailable(NativeLibraryLoader.java:104) ~[netty-common-4.1.38.Final.jar:4.1.38.Final]
at io.netty.handler.ssl.OpenSsl.loadTcNative(OpenSsl.java:568) ~[netty-handler-4.1.38.Final.jar:4.1.38.Final]
at io.netty.handler.ssl.OpenSsl.(OpenSsl.java:133) ~[netty-handler-4.1.38.Final.jar:4.1.38.Final]
at io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:194) ~[grpc-netty-1.23.0.jar:1.23.0]
at org.hyperledger.fabric.sdk.Endpoint.getSslContextBuilder(Endpoint.java:294) ~[fabric-sdk-java-2.1.1.jar:na]
at org.hyperledger.fabric.sdk.Endpoint.(Endpoint.java:254) ~[fabric-sdk-java-2.1.1.jar:na]
at org.hyperledger.fabric.sdk.Endpoint.createEndpoint(Endpoint.java:487) ~[fabric-sdk-java-2.1.1.jar:na]
at org.hyperledger.fabric.sdk.Peer.setTLSCertificateKeyPair(Peer.java:447) ~[fabric-sdk-java-2.1.1.jar:na]
at org.hyperledger.fabric.sdk.Channel.addPeer(Channel.java:669) ~[fabric-sdk-java-2.1.1.jar:na]
at org.hyperledger.fabric.sdk.NetworkConfig.lambda$static$2(NetworkConfig.java:758) ~[fabric-sdk-java-2.1.1.jar:na]
at org.hyperledger.fabric.sdk.NetworkConfig.reconstructChannel(NetworkConfig.java:715) ~[fabric-sdk-java-2.1.1.jar:na]
at org.hyperledger.fabric.sdk.NetworkConfig.loadChannel(NetworkConfig.java:499) ~[fabric-sdk-java-2.1.1.jar:na]
at org.hyperledger.fabric.sdk.NetworkConfig.loadChannel(NetworkConfig.java:470) ~[fabric-sdk-java-2.1.1.jar:na]
at org.hyperledger.fabric.sdk.HFClient.loadChannelFromConfig(HFClient.java:236) ~[fabric-sdk-java-2.1.1.jar:na]
at org.hyperledger.fabric.gateway.impl.GatewayImpl.getNetwork(GatewayImpl.java:232) ~[fabric-gateway-java-2.1.1.jar:na]
at gov.cbdc.service.WalletCreationTestService.createWallet(WalletCreationTestService.java:32) ~[classes/:na]
at gov.cbdc.controller.WalletController.createWallet(WalletController.java:15) ~[classes/:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:262) ~[spring-web-6.1.2.jar:6.1.2]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:190) ~[spring-web-6.1.2.jar:6.1.2]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:118) ~[spring-webmvc-6.1.2.jar:6.1.2]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:917) ~[spring-webmvc-6.1.2.jar:6.1.2]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:829) ~[spring-webmvc-6.1.2.jar:6.1.2]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-6.1.2.jar:6.1.2]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1089) ~[spring-webmvc-6.1.2.jar:6.1.2]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:979) ~[spring-webmvc-6.1.2.jar:6.1.2]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1014) ~[spring-webmvc-6.1.2.jar:6.1.2]
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:903) ~[spring-webmvc-6.1.2.jar:6.1.2]
at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:564) ~[tomcat-embed-core-10.1.17.jar:6.0]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:885) ~[spring-webmvc-6.1.2.jar:6.1.2]
at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658) ~[tomcat-embed-core-10.1.17.jar:6.0]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:205) ~[tomcat-embed-core-10.1.17.jar:10.1.17]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) ~[tomcat-embed-core-10.1.17.jar:10.1.17]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) ~[tomcat-embed-websocket-10.1.17.jar:10.1.17]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174) ~[tomcat-embed-core-10.1.17.jar:10.1.17]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) ~[tomcat-embed-core-10.1.17.jar:10.1.17]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-6.1.2.jar:6.1.2]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-6.1.2.jar:6.1.2]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174) ~[tomcat-embed-core-10.1.17.jar:10.1.17]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) ~[tomcat-embed-core-10.1.17.jar:10.1.17]
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-6.1.2.jar:6.1.2]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-6.1.2.jar:6.1.2]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174) ~[tomcat-embed-core-10.1.17.jar:10.1.17]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) ~[tomcat-embed-core-10.1.17.jar:10.1.17]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-6.1.2.jar:6.1.2]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-6.1.2.jar:6.1.2]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174) ~[tomcat-embed-core-10.1.17.jar:10.1.17]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) ~[tomcat-embed-core-10.1.17.jar:10.1.17]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:167) ~[tomcat-embed-core-10.1.17.jar:10.1.17]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90) ~[tomcat-embed-core-10.1.17.jar:10.1.17]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482) ~[tomcat-embed-core-10.1.17.jar:10.1.17]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:115) ~[tomcat-embed-core-10.1.17.jar:10.1.17]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93) ~[tomcat-embed-core-10.1.17.jar:10.1.17]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) ~[tomcat-embed-core-10.1.17.jar:10.1.17]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:340) ~[tomcat-embed-core-10.1.17.jar:10.1.17]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:391) ~[tomcat-embed-core-10.1.17.jar:10.1.17]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63) ~[tomcat-embed-core-10.1.17.jar:10.1.17]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:896) ~[tomcat-embed-core-10.1.17.jar:10.1.17]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1744) ~[tomcat-embed-core-10.1.17.jar:10.1.17]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52) ~[tomcat-embed-core-10.1.17.jar:10.1.17]
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) ~[tomcat-embed-core-10.1.17.jar:10.1.17]
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) ~[tomcat-embed-core-10.1.17.jar:10.1.17]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-10.1.17.jar:10.1.17]
at java.base/java.lang.Thread.run(Thread.java:840) ~[na:na]
Suppressed: java.lang.UnsatisfiedLinkError: could not load a native library: netty_tcnative_osx_aarch_64
at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:224) ~[netty-common-4.1.38.Final.jar:4.1.38.Final]
at io.netty.util.internal.NativeLibraryLoader.loadFirstAvailable(NativeLibraryLoader.java:96) ~[netty-common-4.1.38.Final.jar:4.1.38.Final]
... 66 common frames omitted
Caused by: java.io.FileNotFoundException: META-INF/native/libnetty_tcnative_osx_aarch_64.jnilib
at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:168)
... 67 common frames omitted
Suppressed: java.lang.UnsatisfiedLinkError: no netty_tcnative_osx_aarch_64 in java.library.path: /Users/peteaston/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2434)
at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:818)
at java.base/java.lang.System.loadLibrary(System.java:1989)
at io.netty.util.internal.NativeLibraryUtil.loadLibrary(NativeLibraryUtil.java:38)
at io.netty.util.internal.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:349)
at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:136)
... 67 common frames omitted
Suppressed: java.lang.UnsatisfiedLinkError: no netty_tcnative_osx_aarch_64 in java.library.path: /Users/peteaston/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2434)
at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:818)
at java.base/java.lang.System.loadLibrary(System.java:1989)
at io.netty.util.internal.NativeLibraryUtil.loadLibrary(NativeLibraryUtil.java:38)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at io.netty.util.internal.NativeLibraryLoader$1.run(NativeLibraryLoader.java:369)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
at io.netty.util.internal.NativeLibraryLoader.loadLibraryByHelper(NativeLibraryLoader.java:361)
at io.netty.util.internal.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:339)
... 68 common frames omitted
Suppressed: java.lang.UnsatisfiedLinkError: could not load a native library: netty_tcnative_aarch_64
at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:224) ~[netty-common-4.1.38.Final.jar:4.1.38.Final]
at io.netty.util.internal.NativeLibraryLoader.loadFirstAvailable(NativeLibraryLoader.java:96) ~[netty-common-4.1.38.Final.jar:4.1.38.Final]
... 66 common frames omitted
Caused by: java.io.FileNotFoundException: META-INF/native/libnetty_tcnative_aarch_64.jnilib
at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:168)
... 67 common frames omitted
Suppressed: java.lang.UnsatisfiedLinkError: no netty_tcnative_aarch_64 in java.library.path: /Users/peteaston/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2434)
at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:818)
at java.base/java.lang.System.loadLibrary(System.java:1989)
at io.netty.util.internal.NativeLibraryUtil.loadLibrary(NativeLibraryUtil.java:38)
at io.netty.util.internal.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:349)
at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:136)
... 67 common frames omitted
Suppressed: java.lang.UnsatisfiedLinkError: no netty_tcnative_aarch_64 in java.library.path: /Users/peteaston/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2434)
at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:818)
at java.base/java.lang.System.loadLibrary(System.java:1989)
at io.netty.util.internal.NativeLibraryUtil.loadLibrary(NativeLibraryUtil.java:38)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at io.netty.util.internal.NativeLibraryLoader$1.run(NativeLibraryLoader.java:369)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
at io.netty.util.internal.NativeLibraryLoader.loadLibraryByHelper(NativeLibraryLoader.java:361)
at io.netty.util.internal.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:339)
... 68 common frames omitted
Suppressed: java.lang.UnsatisfiedLinkError: could not load a native library: netty_tcnative
at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:224) ~[netty-common-4.1.38.Final.jar:4.1.38.Final]
at io.netty.util.internal.NativeLibraryLoader.loadFirstAvailable(NativeLibraryLoader.java:96) ~[netty-common-4.1.38.Final.jar:4.1.38.Final]
... 66 common frames omitted
Caused by: java.io.FileNotFoundException: META-INF/native/libnetty_tcnative.jnilib
at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:168)
... 67 common frames omitted
Suppressed: java.lang.UnsatisfiedLinkError: no netty_tcnative in java.library.path: /Users/peteaston/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2434)
at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:818)
at java.base/java.lang.System.loadLibrary(System.java:1989)
at io.netty.util.internal.NativeLibraryUtil.loadLibrary(NativeLibraryUtil.java:38)
at io.netty.util.internal.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:349)
at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:136)
... 67 common frames omitted
Suppressed: java.lang.UnsatisfiedLinkError: no netty_tcnative in java.library.path: /Users/peteaston/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2434)
at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:818)
at java.base/java.lang.System.loadLibrary(System.java:1989)
at io.netty.util.internal.NativeLibraryUtil.loadLibrary(NativeLibraryUtil.java:38)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at io.netty.util.internal.NativeLibraryLoader$1.run(NativeLibraryLoader.java:369)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
at io.netty.util.internal.NativeLibraryLoader.loadLibraryByHelper(NativeLibraryLoader.java:361)
at io.netty.util.internal.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:339)
... 68 common frames omitted

Below is my code and Steps to reproduce the error.

ConnectionProfile = ccp.yaml

name: "test-network"
x-type: "hlfv2"
version: "1.0"
client:
organization: Org1
connection:
timeout:
peer:
endorser: '300'

channels:
channel1:
orderers:
- orderer.example.com
peers:
peer0.org1.example.com:
endorsingPeer: true
chaincodeQuery: true
ledgerQuery: true
eventSource: true
discover: true
peer0.org2.example.com:
endorsingPeer: false
chaincodeQuery: true
ledgerQuery: true
eventSource: true
discover: true
organizations:
Org1:
mspid: Org1MSP
peers:
- peer0.org1.example.com
certificateAuthorities:
- ca.org1.example.com
adminPrivateKey:
pem: |
-----BEGIN PRIVATE KEY-----
MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgAhczZkhCO9Iqd2pI
Jssd3vzclqgacm25hDHl8k8DsN2hRANCAAQAQRJqRIgE6XoBundFwVJKlkZSNZKq
wKYJd19TT7TLhEO2C/5A5/QYvzN0AQ8tEa2AXg9indEKX64co+ZVc460
-----END PRIVATE KEY-----
signedCert:
pem: |
-----BEGIN CERTIFICATE-----
MIICJzCCAc2gAwIBAgIUfpLgVo0z512eTD4q4EwwKlPGCZUwCgYIKoZIzj0EAwIw
cDELMAkGA1UEBhMCVVMxFzAVBgNVBAgTDk5vcnRoIENhcm9saW5hMQ8wDQYDVQQH
EwZEdXJoYW0xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2Nh
Lm9yZzEuZXhhbXBsZS5jb20wHhcNMjQwMTAyMDA1NjAwWhcNMzgxMjI5MDA1NjAw
WjBwMQswCQYDVQQGEwJVUzEXMBUGA1UECBMOTm9ydGggQ2Fyb2xpbmExDzANBgNV
BAcTBkR1cmhhbTEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UEAxMT
Y2Eub3JnMS5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABGO1
UO6cjunHQyx99aDf8fXtAbu10IrIdJ7k3owicDBsfsldDmrLIsk7hy3yBLIHLmSI
wLeEgGHvdYoRjr9IYRyjRTBDMA4GA1UdDwEB/wQEAwIBBjASBgNVHRMBAf8ECDAG
AQH/AgEBMB0GA1UdDgQWBBQio7HyXZnzTg8dLgZAuLll3TkXDzAKBggqhkjOPQQD
AgNIADBFAiEAu4tz+/gRo3P0BNMM2zCoC4CwgAP4pEo1CBehHLZD0y0CIFUa5Csq
2NUG5w+9Lel6BVNxW/DJ7uf6E/ghfCS3TCsT
-----END CERTIFICATE-----
Org2:
mspid: Org2MSP
peers:
- peer0.org2.example.com
certificateAuthorities:
- ca.org2.example.com
adminPrivateKey:
pem: |
-----BEGIN PRIVATE KEY-----
MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgyFC9j4lQeUQIi/Yu
+L/m3QrpvMnmeBbQDK3DnnpDA5ehRANCAATISmgZ/+wOye7Kq6mu+T++NW95reTn
3mrMEOApnhAjtacSgjntfaW2eg/avVCtvwbRVFEL7cMZ0pWueaaFaRcX
-----END PRIVATE KEY-----
signedCert:
pem: |
-----BEGIN CERTIFICATE-----
MIICHjCCAcWgAwIBAgIUcNQwYLd3IYxpfdkGHpD4GLCYLlEwCgYIKoZIzj0EAwIw
bDELMAkGA1UEBhMCVUsxEjAQBgNVBAgTCUhhbXBzaGlyZTEQMA4GA1UEBxMHSHVy
c2xleTEZMBcGA1UEChMQb3JnMi5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eub3Jn
Mi5leGFtcGxlLmNvbTAeFw0yNDAxMDIwMDU2MDBaFw0zODEyMjkwMDU2MDBaMGwx
CzAJBgNVBAYTAlVLMRIwEAYDVQQIEwlIYW1wc2hpcmUxEDAOBgNVBAcTB0h1cnNs
ZXkxGTAXBgNVBAoTEG9yZzIuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2NhLm9yZzIu
ZXhhbXBsZS5jb20wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAS140oas+aLChDU
YUyt7OXBrVwvWbdIiQ8JqrErEsZoC+MSUFI7PJPCrLOmabfH+PHz44xV4N2ekZL9
zZ1/+ps0o0UwQzAOBgNVHQ8BAf8EBAMCAQYwEgYDVR0TAQH/BAgwBgEB/wIBATAd
BgNVHQ4EFgQU+AcZyg61XHbSEOtttU0zfB8lK5wwCgYIKoZIzj0EAwIDRwAwRAIg
SnpCnIkQ23Zj6ewS0dxcOXGFLPXcRn/yzOGFItAhEt8CIH8xEuhyGK1avhPe2OPa
navwMj/0SUcTLIOChYIko9Ip
-----END CERTIFICATE-----

orderers:
orderer.example.com:
url: grpcs://localhost:7050
grpcOptions:
ssl-target-name-override: order.example.com
tlsCACerts:
pem: |
-----BEGIN CERTIFICATE-----
MIICCjCCAbGgAwIBAgIUK7pWJqTH9cCF+9vvrGn9TPqu9zMwCgYIKoZIzj0EAwIw
YjELMAkGA1UEBhMCVVMxETAPBgNVBAgTCE5ldyBZb3JrMREwDwYDVQQHEwhOZXcg
WW9yazEUMBIGA1UEChMLZXhhbXBsZS5jb20xFzAVBgNVBAMTDmNhLmV4YW1wbGUu
Y29tMB4XDTI0MDEwMTIzNDkwMFoXDTM4MTIyODIzNDkwMFowYjELMAkGA1UEBhMC
VVMxETAPBgNVBAgTCE5ldyBZb3JrMREwDwYDVQQHEwhOZXcgWW9yazEUMBIGA1UE
ChMLZXhhbXBsZS5jb20xFzAVBgNVBAMTDmNhLmV4YW1wbGUuY29tMFkwEwYHKoZI
zj0CAQYIKoZIzj0DAQcDQgAERvwnaqciYCk7EFjnuEixwbObnyHAShUi5Uz07qPE
YsGuXx8ZK8/XZ8EfglOY8agOXPJpL444X50UvwPwLbq+NaNFMEMwDgYDVR0PAQH/
BAQDAgEGMBIGA1UdEwEB/wQIMAYBAf8CAQEwHQYDVR0OBBYEFPPDWmG2l5oSU6en
myR+NfVBXDsPMAoGCCqGSM49BAMCA0cAMEQCIB5r/icO5RJF+9hKxCjLVllFwCKJ
+Nd+BV0J2kEMaouIAiAg9Fs01okDnDn2GJsYPhfTpo1kizD8K4eRLYkcMQ5GCw==
-----END CERTIFICATE-----
peers:
peer0.org1.example.com:
url: grpcs://localhost:7051
grpcOptions:
ssl-target-name-override: peer0.org1.example.com
hostnameOverride: peer0.org1.example.com
tlsCACerts:
pem: |
-----BEGIN CERTIFICATE-----
MIICJjCCAc2gAwIBAgIUOUoWwmfJFgdGZJKK1IDk4v72sM4wCgYIKoZIzj0EAwIw
cDELMAkGA1UEBhMCVVMxFzAVBgNVBAgTDk5vcnRoIENhcm9saW5hMQ8wDQYDVQQH
EwZEdXJoYW0xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2Nh
Lm9yZzEuZXhhbXBsZS5jb20wHhcNMjQwMTAxMjM0OTAwWhcNMzgxMjI4MjM0OTAw
WjBwMQswCQYDVQQGEwJVUzEXMBUGA1UECBMOTm9ydGggQ2Fyb2xpbmExDzANBgNV
BAcTBkR1cmhhbTEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UEAxMT
Y2Eub3JnMS5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABN7L
VhWTqA59i0FJHQJLxvTpOlQnIu8RA1mLnnNqhEsUDqOS1jJn+K78McxubkqMVY7v
sq/L50mLSprY7UUNz4KjRTBDMA4GA1UdDwEB/wQEAwIBBjASBgNVHRMBAf8ECDAG
AQH/AgEBMB0GA1UdDgQWBBTTi7V1Gl0VtwsDzyf6p8B1KEGfqzAKBggqhkjOPQQD
AgNHADBEAiBNusW6M8yPRszE/s7k/NcxdGae46h2sGlEm39AUzr4RQIgT703itHz
+BMBHk5xzxjZ+C/rCL73jdZLR+0LQhk40yI=
-----END CERTIFICATE-----
peer0.org2.example.com:
url: grpcs://localhost:9051
grpcOptions:
ssl-target-name-override: peer0.org2.example.com
hostnameOverride: peer0.org2.example.com
tlsCACerts:
pem: |
-----BEGIN CERTIFICATE-----
MIICHjCCAcWgAwIBAgIUM17V7pOvOWtwJOpSxRdZRhNM/AswCgYIKoZIzj0EAwIw
bDELMAkGA1UEBhMCVUsxEjAQBgNVBAgTCUhhbXBzaGlyZTEQMA4GA1UEBxMHSHVy
c2xleTEZMBcGA1UEChMQb3JnMi5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eub3Jn
Mi5leGFtcGxlLmNvbTAeFw0yNDAxMDEyMzQ5MDBaFw0zODEyMjgyMzQ5MDBaMGwx
CzAJBgNVBAYTAlVLMRIwEAYDVQQIEwlIYW1wc2hpcmUxEDAOBgNVBAcTB0h1cnNs
ZXkxGTAXBgNVBAoTEG9yZzIuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2NhLm9yZzIu
ZXhhbXBsZS5jb20wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAATFjrGfxdEDl/uk
aSWo0Jm/J4WBIqUGtafc6dKfN3mKzzGqMn2JNglTeGUcJqY/ic07/S+yJQq/8kvn
Gce97T0jo0UwQzAOBgNVHQ8BAf8EBAMCAQYwEgYDVR0TAQH/BAgwBgEB/wIBATAd
BgNVHQ4EFgQUdN0ArIkFUVMVCIPo77gXQM3ztcMwCgYIKoZIzj0EAwIDRwAwRAIg
F3Id/W/VzYwsz097kmqV9Hdx2/zYcwEhNSPN+Xk1ykgCIDU5PImtttXg9ptUwnO7
dDJoslVKjMtldL9/GG/uHYLY
-----END CERTIFICATE-----
certificateAuthorities:
ca.org1.example.com:
url: https://localhost:7054
httpOptions:
verify: false
tlsCACerts:
pem: |
-----BEGIN CERTIFICATE-----
MIICJjCCAc2gAwIBAgIUOUoWwmfJFgdGZJKK1IDk4v72sM4wCgYIKoZIzj0EAwIw
cDELMAkGA1UEBhMCVVMxFzAVBgNVBAgTDk5vcnRoIENhcm9saW5hMQ8wDQYDVQQH
EwZEdXJoYW0xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2Nh
Lm9yZzEuZXhhbXBsZS5jb20wHhcNMjQwMTAxMjM0OTAwWhcNMzgxMjI4MjM0OTAw
WjBwMQswCQYDVQQGEwJVUzEXMBUGA1UECBMOTm9ydGggQ2Fyb2xpbmExDzANBgNV
BAcTBkR1cmhhbTEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UEAxMT
Y2Eub3JnMS5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABN7L
VhWTqA59i0FJHQJLxvTpOlQnIu8RA1mLnnNqhEsUDqOS1jJn+K78McxubkqMVY7v
sq/L50mLSprY7UUNz4KjRTBDMA4GA1UdDwEB/wQEAwIBBjASBgNVHRMBAf8ECDAG
AQH/AgEBMB0GA1UdDgQWBBTTi7V1Gl0VtwsDzyf6p8B1KEGfqzAKBggqhkjOPQQD
AgNHADBEAiBNusW6M8yPRszE/s7k/NcxdGae46h2sGlEm39AUzr4RQIgT703itHz
+BMBHk5xzxjZ+C/rCL73jdZLR+0LQhk40yI=
-----END CERTIFICATE-----
registrar:
- enrollId: admin
enrollSecret: adminpw
caName: ca-org1
ca.org2.example.com:
url: https://localhost:8054
httpOptions:
verify: false
tlsCACerts:
pem: |
-----BEGIN CERTIFICATE-----
MIICHjCCAcWgAwIBAgIUM17V7pOvOWtwJOpSxRdZRhNM/AswCgYIKoZIzj0EAwIw
bDELMAkGA1UEBhMCVUsxEjAQBgNVBAgTCUhhbXBzaGlyZTEQMA4GA1UEBxMHSHVy
c2xleTEZMBcGA1UEChMQb3JnMi5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eub3Jn
Mi5leGFtcGxlLmNvbTAeFw0yNDAxMDEyMzQ5MDBaFw0zODEyMjgyMzQ5MDBaMGwx
CzAJBgNVBAYTAlVLMRIwEAYDVQQIEwlIYW1wc2hpcmUxEDAOBgNVBAcTB0h1cnNs
ZXkxGTAXBgNVBAoTEG9yZzIuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2NhLm9yZzIu
ZXhhbXBsZS5jb20wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAATFjrGfxdEDl/uk
aSWo0Jm/J4WBIqUGtafc6dKfN3mKzzGqMn2JNglTeGUcJqY/ic07/S+yJQq/8kvn
Gce97T0jo0UwQzAOBgNVHQ8BAf8EBAMCAQYwEgYDVR0TAQH/BAgwBgEB/wIBATAd
BgNVHQ4EFgQUdN0ArIkFUVMVCIPo77gXQM3ztcMwCgYIKoZIzj0EAwIDRwAwRAIg
F3Id/W/VzYwsz097kmqV9Hdx2/zYcwEhNSPN+Xk1ykgCIDU5PImtttXg9ptUwnO7
dDJoslVKjMtldL9/GG/uHYLY
-----END CERTIFICATE-----
registrar:
- enrollId: admin
enrollSecret: adminpw
caName: ca-org2

====================================================

AppConfig.java
package gov.cbdc.config;

public class AppConfig {
public String pemFile = "/Users/peteaston/hlfa/fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem";
public boolean allowAllHostNames = true;
public String caBaseUrl = "https://localhost:7054";
public String walletAdmin = "admin";
public String walletAdminSecret = "adminpw";
public String host = "localhost";
public String profile = "tls";
public String mspId = "Org1MSP";
public String appUser = "appUser";
public String affiliation = "org1.department1";

public String networkConfigPath = "/Users/peteaston/ge/cbdchandler/handlerx/ccp.yaml";
public String channelName = "channel1";

}

====================================================

WalletCreationTestService.java

package gov.cbdc.service;

import gov.cbdc.config.AppConfig;
import org.hyperledger.fabric.gateway.Gateway;
import org.hyperledger.fabric.gateway.Network;
import org.hyperledger.fabric.gateway.Wallet;
import org.hyperledger.fabric.gateway.Wallets;
import org.springframework.stereotype.Service;

import java.nio.file.Path;
import java.nio.file.Paths;

@service
public class WalletCreationTestService {
AppConfig appConfig = new AppConfig();

static {
    System.setProperty("org.hyperledger.fabric.sdk.service_discovery.as_localhost", "true");
}

public String createWallet() throws Exception {
    Path walletPath = Paths.get("wallet");
    Wallet wallet = Wallets.newFileSystemWallet(walletPath);
    Path networkConfigPath = Paths.get(appConfig.networkConfigPath);
    Gateway.Builder builder = Gateway.createBuilder();
    builder.identity(wallet, appConfig.appUser)
            .networkConfig(networkConfigPath)
            .discovery(true);
    //new AdminEnrollmentService().enrollAdmin();
    //new UserEnrollmentService().enrollUser();
    Gateway gateway = builder.connect();
    Network network = gateway.getNetwork(appConfig.channelName);
    return null;
}

}

In the WalletCreationTestService.java above, the code works until I try to get the network. I get the message at the bottom part of the error thrown:

Bottom part of error:
Suppressed: java.lang.UnsatisfiedLinkError: no netty_tcnative in java.library.path: /Users/peteaston/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.

Top part of error:
java.lang.IllegalArgumentException: Failed to load any of the given libraries: [netty_tcnative_osx_aarch_64, netty_tcnative_aarch_64, netty_tcnative]

=========================================

My POM.XML


4.0.0

<groupId>gov.cbdc</groupId>
<artifactId>handlerx</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
    <maven.compiler.source>17</maven.compiler.source>
    <maven.compiler.target>17</maven.compiler.target>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
    <extensions>
        <!-- Use os-maven-plugin to initialize the "os.detected" properties -->
        <extension>
            <groupId>kr.motd.maven</groupId>
            <artifactId>os-maven-plugin</artifactId>
            <version>1.7.1</version>
        </extension>
    </extensions>
    <plugins>
        <!-- Use Ant to configure the appropriate "tcnative.classifier" property -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
                <execution>
                    <phase>initialize</phase>
                    <configuration>
                        <exportAntProperties>true</exportAntProperties>
                        <target>
                            <condition property="tcnative.classifier"
                                       value="${os.detected.classifier}-fedora"
                                       else="${os.detected.classifier}">
                                <isset property="os.detected.release.fedora"/>
                            </condition>
                        </target>
                    </configuration>
                    <goals>
                        <goal>run</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

<dependencies>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-autoconfigure</artifactId>
        <version>3.2.1</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <version>3.2.1</version>
    </dependency>

    <dependency>
        <groupId>org.yaml</groupId>
        <artifactId>snakeyaml</artifactId>
        <version>1.8</version>
    </dependency>

    <dependency>
        <groupId>io.grpc</groupId>
        <artifactId>grpc-netty-shaded</artifactId>
        <version>1.59.0</version>
        <scope>runtime</scope>
    </dependency>

    <dependency>
        <groupId>org.hyperledger.fabric</groupId>
        <artifactId>fabric-gateway</artifactId>
        <version>1.4.0</version>
    </dependency>

    <dependency>
        <groupId>org.hyperledger.fabric</groupId>
        <artifactId>fabric-gateway-java</artifactId>
        <version>2.1.1</version>
    </dependency>

    <dependency>
        <groupId>io.netty</groupId>
        <artifactId>netty-tcnative</artifactId>
        <version>2.0.62.Final</version> <!-- see table for correct version -->
        <scope>runtime</scope>
    </dependency>

</dependencies>
==========================================

Please help. I am thoroughly grounded.

My System's Configuration

MacBook Pro
Chip: Apple M3 Pro
macOS: Sonoma 14.1 (23B2073)

@H-Dynamite
Copy link

H-Dynamite commented Apr 16, 2024

I encountered the same issue, and this is how I resolved it: you need to add the following dependency:

<dependency> <groupId>io.netty</groupId> <artifactId>netty-tcnative-classes</artifactId> <version>2.0.59.Final</version> </dependency>

It is crucial that this dependency is added before the inclusion of netty-handler-4.1.91.Final.jar. I discovered through compiling both netty-handler-4.1.91.Final.jar and Netty-tcnative-classes myself that the order in which these dependencies are introduced via Maven can indeed affect the loading logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants