I am trying to query the blockchain using the following code and getting the access denied error. also i am getting the same error while sendTransactionProposal
method as well.
UserContext adminUserContext = RegisterEnrollUser.registerAdminUser(Config.CA_ORG1_URL, Config.ORG1_MSP, Config.ORG1);
FabricClient fabClient = new FabricClient(adminUserContext);
ChannelClient channelClient = fabClient.createChannelClient(Config.CHANNEL_NAME);
Channel channel = channelClient.getChannel();
Peer peer = fabClient.getInstance().newPeer(Config.ORG1_PEER_0, Config.ORG1_PEER_0_URL);
EventHub eventHub = fabClient.getInstance().newEventHub("eventhub01", Config.ORG1_PEER_0_URL_Eventhub);
Orderer orderer = fabClient.getInstance().newOrderer(Config.ORDERER_NAME, Config.ORDERER_URL);
channel.addPeer(peer);
channel.addEventHub(eventHub);
channel.addOrderer(orderer);
channel.initialize();
Collection<ProposalResponse> responsesQuery = channelClient.queryByChainCode("tmz", "queryAllEntries", null);
Caused by: org.hyperledger.fabric.sdk.exception.ProposalException: getConfigBlock for channel mychannel failed with peer peer0.org1.example.com. Status FAILURE, details: Sending proposal to peer0.org1.example.com failed because of: gRPC failure=Status{code=UNKNOWN, description=access denied: channel [mychannel] creator org [Org1MSP], cause=null}
Following are logs for peer0.org1.example.com
Principal deserialization failure (the supplied identity is not valid: x509: certificate signed by unknown authority) for identity. WARN 2a11 [channel: mychannel] Client authorization revoked for deliver request from Failed evaluating policy on signed data during check policy on channel [mychannel] with policy [/Channel/Application/Readers]: [Failed to reach implicit threshold of 1 sub-policies, required 1 remaining]
2018-06-14 21:05:11.545 UTC [common/deliver] Handle -> DEBU 2a12 Waiting for new SeekInfo from
2018-06-14 21:05:11.545 UTC [common/deliver] Handle -> DEBU 2a13 Attempting to read seek info message from
2018-06-14 21:05:11.609 UTC [common/deliver] Handle -> WARN 2a14 Error reading from : rpc error: code = Canceled desc = context canceled
2018-06-14 21:05:11.609 UTC [common/deliverevents] func1 -> DEBU 2a15 Closing Deliver stream