in src/main/java/com/lambdajavablockchain/service/ManagedBlockchainService.java [74:94]
private FabricUser enrollAdmin() throws AppException, ManagedBlockchainServiceException {
if (client == null || caClient == null) {
log.error("Client/CA Client not initialized. Run ManagedBlockchainService.setupClient() first");
throw new ManagedBlockchainServiceException("Client/CA Client not initialized!");
}
try {
// Retrieve admin User Context
FabricUser fabricUser = getAdmin(caClient);
// Set client to act on behalf of adminUser
client.setUserContext(fabricUser);
log.info("Using admin user context");
return fabricUser;
} catch (InvalidArgumentException | org.hyperledger.fabric_ca.sdk.exception.InvalidArgumentException
| EnrollmentException e) {
log.error("Error enrolling Admin user - " + e.getMessage());
e.printStackTrace();
throw new AppException("Error enrolling Admin user - " + e.getMessage(), e);
}
}