hyperledger-fabrichyperledger-fabric-sdk-java

Hyperledger Fabric: Channel configuration has no channels defined


I got to the project that is based on BYFN sample, but limited to one organization only.

In the app when I call following code:

private Contract getContract(Gateway gw) {
    return gw.getNetwork("mychannel").getContract("realchain");
}

following error is produced:

2019-10-30 09:34:51.433  INFO 23108 --- [nio-8080-exec-3] org.hyperledger.fabric.gateway.Gateway   : Unable to load channel configuration from connection profile:

org.hyperledger.fabric.sdk.exception.NetworkConfigurationException: Channel configuration has no channels defined.
    at org.hyperledger.fabric.sdk.NetworkConfig.loadChannel(NetworkConfig.java:519) ~[fabric-sdk-java-1.4.5-20190620.151745-1.jar:na]
    at org.hyperledger.fabric.sdk.HFClient.loadChannelFromConfig(HFClient.java:161) ~[fabric-sdk-java-1.4.5-20190620.151745-1.jar:na]
    at org.hyperledger.fabric.gateway.impl.GatewayImpl.getNetwork(GatewayImpl.java:258) ~[fabric-gateway-java-1.4.0-20191002.055106-31.jar:na]
    ...

...the app recovers somehow itself, but I suspect this error to slow down the whole interaction with the ledger.

Also I'd love to keep my logs clean from any exceptions if possible.

Anyone encountered and resolved the same error?


Solution

  • That is normal behaviour. If the connection profile does not contain a channel definition then the client uses peer definitions (currently for your client identity's organisation only) and assumes the channel exists for those peers. It should not impact performance at all.

    You have the option of adding a channel definition to the connection profile, which will avoid this log message occurring, but we wanted to avoid this being necessary.

    I agree that the exception appearing in the log gives the false impression that a real error has occurred and I have removed that in the current development code.