I'm trying to run the Java Fabric Sample application: https://github.com/hyperledger/fabric-samples/tree/release-2.2/asset-transfer-basic/application-java
But I'm having trouble following the instructions in oracle:
Java SDK - You can install and use the Hyperledger Fabric Java SDK. The default grpc module must be rebuilt to connect to the OBP's orderers and peers. You can do this manually or you can use the already modified package provided here.
Go to the rebuilding grpc-java package guide. (https://docs.oracle.com/en/cloud/paas/blockchain-cloud/usingoci/use-hyperledger-fabric-sdks-develop-applications.html#GUID-88F8526B-5F4A-4768-B454-72297C420533)
Download grpc-netty-shaded-1.38.0.jar package.
Go to Hyperledger Fabric SDK documentation.
OBP - If you want your applications to interact with the current OBP instance, you can download the development package and export Admin Credential, which includes all blockchain configurations and cryptos.
Please refer the following flow, copy Admin Credential to the development package.
1.Export admin credential from console.
2.Copy admin cert to "artifacts/crypto/peerOrganizations/bc/signcert/bc-signcert.pem".
3.Copy admin key to "artifacts/crypto/peerOrganizations/bc/keystore/bc-key.pem".
Download the development package.
In particular I don't know where to download the "admin credentials" or where to copy the grpc-netty-shaded-1.38.0.jar
You need to download and uncompres two things from the Oracle Blockchain Platform Cloud Console:
Then in "bc-instance-info" (the folder inside the development package) you have to
With this you will have the "bc-instance-info/network.yaml" and "bc-instance-info/artifacts" folder you need to connect an application to fabric.
An example of this connection for fabric 2.2 can be found in the CarDealer Sample from the Oracle Blockchain Platform Cloud Console (Developer Tools tab/Samples/Car Dealer).
In the CarDealer folder you can replace the artifacts folder and network.yaml with the ones you've just created. In theory you could then just run the sample as explained in the "./CarDealer/java/readme.md".
However, as of today it seems it wont work. The reason is that as explained in: https://docs.oracle.com/en/cloud/paas/blockchain-cloud/usingoci/use-hyperledger-fabric-sdks-develop-applications.html#GUID-88F8526B-5F4A-4768-B454-72297C420533
You need to use the modified "grpc-netty-shaded-1.38.0.jar". However, this is not a direct dependency of the project. The project uses fabric-gateway-java:2.2.0 that depends on some version of fabric-sdk-java which might depend on some version of grpc-netty-shaded.
To force the use of grpc-netty-shaded:1.38.0, I know you can (but perhaps its not the best solution) edit the pom in maven of:
~/.m2/repository/org/hyperledger/fabric/fabric-gateway-java/2.2.0/fabric-gateway-java-2.2.0.pom
and replace fabric-sdk-java dependency with:
<dependency>
<groupId>org.hyperledger.fabric-sdk-java</groupId>
<artifactId>fabric-sdk-java</artifactId>
<version>2.2.10</version>
</dependency>
Then running the CarDealer as explained in the readme.md should work.
A final observation is that CarDealer uses maven while the application you're trying to run uses Gradle. The official documentation does not show examples with gradle, but a similar solution should work albeit with Gradle specific commands.