Hyperledger Fabric-sdk-java

Hyperledger Fabric-sdk-java

Disclaimer: This article is a blogger original article, follow the  CC 4.0 BY-SA  copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/l_ricardo/article/details/79998789

Hyperledger Fabric-sdk-java

I use the environment macOS High Sierra 10.13.4,Java 9.0.4

Currently Hyperledger Fabric official is mainly supported fabric-sdk-node, and have a more comprehensive documentation in English. However, my project requirements as Java, all can be downloaded fabric-sdk-java.


  1. Apache Maven (can be installed via the homebrew)
  2. JDK 1.8+ (recommended is 1.8, with 1.8 project is written with Java 9meet some weird problems and the same will I)
  3. IDEA

Download Project

git clone https://github.com/hyperledger/fabric-sdk-java
  • 1

Import project

IDEA, maven project to import the project, import dependence.

A small amount of third-party libraries, before you can run the following command in the root directory:

mvn dependency:tree
  • 1

Run fabric

cd fabric-sdk-java/src/test/fixture/sdkintegration
./fabric up
  • 1
  • 2

If the corresponding docker-compose.yaml under the modified image error can not find the fabric-sdk-java / src / test / fixture / sdkintegration appearances image tagcan be.

Run the test case

We selected commonly used End2endIT.javato run.

Then you will find that we have not included code from clong down in org.hyperledger.fabric.protosthis package. So we need to download this package, and add it to the corresponding position in our project. Here are a source of Download 
Write pictures described here

After we download the corresponding jar file extraction, you can import the corresponding package.

Because it is JDK code, we use Java 9have some options when compiling Note

Write pictures described here

We need a version byte code file are set to 9. And add the following several parameters on the command line parameters.

--add-exports java.base/jdk.internal.misc=ALL-UNNAMED --add-modules java.xml.bind --add-modules java.corba
  • 1

In addition, we also need to modify pom.xml files in the project

Write pictures described here
The sourceand targetthe 1.8have changed 9if the difference is still reported some classes at compile time, in their own pom.xmlin adding a corresponding dependency. For example, I am sending java.annotationme dependencyto add in the

Write pictures described here

After rely on us to solve these over again compiled should be able to successfully run. Results are as follows in FIG. 
Write pictures described here

Guess you like

Origin www.cnblogs.com/think90/p/11455001.html