fabric-java-SDK 部署 - Go语言中文社区

fabric-java-SDK 部署


准备环境:

1.centos 上搭建fabric 环境搭建成功

2.fabric-java-SDK 在本地windows eclipse 环境

环境部署:

1. centos 上下载fabric-java-SDk 

cd /opt/gopath/src/github.com/hyperledger/
git clone https://github.com/hyperledger/fabric-sdk-java.git

当前是1.2版本,因为fabric环境是1.1,将java-sdk 也切换到1.1

cd fabric-sdk-java/
git checkout release-1.1

 

2. 修改配置文件

cd src/test/fixture/sdkintegration 
vim docker-compose.yaml

 做如下修改

3.启动网络

./fabric.sh up

 

4. 当前windows 环境要求

 

参照https://github.com/hyperledger/fabric-sdk-java/blob/master/docs/EclipseSetup.md

  • java 1.8 以上
  • maven环境
  • eclipse 尽量是新版本

5. windows环境下载fabric-java-SDK


 
git clone https://github.com/hyperledger/fabric-sdk-java.git
cd fabric-sdk-java/
git checkout -b release-1.1

6. eclipse 导入maven项目

 

  •     如果报错Failed to read the project description file (.project) for 'fabric-sdk-java'. The file has been changed on disk, and it now contains invalid information. The project will not function properly until the description file is restored to a valid state. 

     删掉.project和.classpath 文件再试一次

 

  •     之后还会报一个错:No marketplace entries found to handle maven-antrun-plugin:1.4:run in Eclipse. Please see Help for more information.

    不用管,点击finish,后面处理

7.修改pom.xml

在properties中加入下面一句话:
<os.detected.classifier>windows-x86_64</os.detected.classifier>

    

8. 编译项目

mvn install 

9. 处理步骤6的错误

在eclipse 控制台中点击错误Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-antrun-plugin:1.4:run (execution: default, phase: generate-test-resources),右击处理选择“Mark goal run as ignored in eclipse”(不是直接右击就出来,可能是我的eclipse版本不够新,要折腾一下找到点击就好

10.修改TestConfig.java中服务的地址,将localhost改为自己fabric centos 环境服务器的地址

11. 重新编译项目

 

mvn install

12. Junit测试运行  End2endIT.java

        这里运行的时候出现一个问题,是显示“no junit Tests found”,解决方式是在src/test/java 目录上点右键--》Build Path--》Use as Source Folder

之后运行Junit Test 

如果报错关闭linux中的docker和fabric.sh然后重启

13. 过程中报错:

1)

在服务端可以看到错误是:timestamp 2018-07-09 03:23:01.92 +0000 UTC is more than the 1h0m0s time window difference above/below server time 2018-07-09 11:23:30.057301623 +0000 UTC m=+33.773731458. either the server and client clocks are out of sync or a relay attack has been attempted

是由于centos 的时间与windows时间不同造成的,修改centos的时间之后问题消失

2)

centos 服务器中peer0.org1 和java cli 对应的容器会因为执行错误而exit,

错误原因是没有切换版本,由于Git不是很熟悉,修改了1.2的代码后,切换版本1.1显示切换成功,但是不知为什么代码还是1.2的,之后重新git 1.1 的版本,再次按照上面步骤执行就没有错误了

版权声明:本文来源CSDN,感谢博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/xxzjwdnlwx/article/details/80916272
站方申明:本站部分内容来自社区用户分享,若涉及侵权,请联系站方删除。
  • 发表于 2019-08-26 23:03:47
  • 阅读 ( 1828 )
  • 分类:

0 条评论

请先 登录 后评论

官方社群

GO教程

猜你喜欢