我将1.4.0-rc2用于docker图像和java代码。
尝试使用以下命令将java链码从cli安装到对等节点时:
peer chaincode install -p github.com/hyperledger/chaincode/java/ -l java -n java_chaincode -v 0抛出以下错误:
2019-01-09 14:36:11.799 UTC [main] InitCmd -> WARN 001 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
2019-01-09 14:36:11.819 UTC [main] SetOrdererEnv -> WARN 002 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
2019-01-09 14:36:11.824 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2019-01-09 14:36:11.824 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0xea273b]
goroutine 1 [running]:
github.com/hyperledger/fabric/core/container/util.WriteFolderToTarPackage.func1(0x7fffb7459543, 0x31, 0x0, 0x0, 0x1874100, 0xc0002c4a50, 0x60, 0x1691f40)
/opt/gopath/src/github.com/hyperledger/fabric/core/container/util/writer.go:64 +0xcb
path/filepath.Walk(0x7fffb7459543, 0x31, 0xc0003b8c60, 0x2, 0x3)
/opt/go/src/path/filepath/path.go:402 +0x6a
github.com/hyperledger/fabric/core/container/util.WriteFolderToTarPackage(0xc00011dc00, 0x7fffb7459543, 0x31, 0xc000435858, 0x3, 0x3, 0x0, 0xc00012dc80, 0xc00011dc00, 0x0)
/opt/gopath/src/github.com/hyperledger/fabric/core/container/util/writer.go:136 +0x241
github.com/hyperledger/fabric/core/container/util.WriteJavaProjectToPackage(0xc00011dc00, 0x7fffb7459543, 0x31, 0xc000435940, 0x1)
/opt/gopath/src/github.com/hyperledger/fabric/core/container/util/writer.go:152 +0x158
github.com/hyperledger/fabric/core/chaincode/platforms/java.(*Platform).GetDeploymentPayload(0x2429b40, 0x7fffb7459543, 0x32, 0x4, 0xc000167188, 0x1716e01, 0x4, 0xc0004359c0)
/opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/platforms/java/platform.go:123 +0x1e0
github.com/hyperledger/fabric/core/chaincode/platforms.(*Registry).GetDeploymentPayload(0xc00000c540, 0x1716e08, 0x4, 0x7fffb7459543, 0x32, 0x4, 0x7fffb7459543, 0x32, 0x0, 0x0)
/opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/platforms/platforms.go:103 +0x8f
github.com/hyperledger/fabric/core/container.GetChaincodePackageBytes(0xc00000c540, 0xc00024a5c0, 0x0, 0x16740c0, 0xc0000b2cd0, 0xc000040704, 0x4)
/opt/gopath/src/github.com/hyperledger/fabric/core/container/controller.go:191 +0xc7
github.com/hyperledger/fabric/peer/chaincode.getChaincodeDeploymentSpec(0xc00024a5c0, 0xc00024a501, 0x0, 0x0, 0x0)
/opt/gopath/src/github.com/hyperledger/fabric/peer/chaincode/common.go:58 +0x11c
github.com/hyperledger/fabric/peer/chaincode.genChaincodeDeploymentSpec(0xc0000c4c80, 0x7fffb7459581, 0x1b, 0x7fffb74595a0, 0x1, 0x0, 0x8020106, 0x2)
/opt/gopath/src/github.com/hyperledger/fabric/peer/chaincode/install.go:109 +0xac
github.com/hyperledger/fabric/peer/chaincode.chaincodeInstall(0xc0000c4c80, 0x0, 0x0, 0xc00003a4d0, 0x0, 0x0)
/opt/gopath/src/github.com/hyperledger/fabric/peer/chaincode/install.go:177 +0x156
github.com/hyperledger/fabric/peer/chaincode.installCmd.func1(0xc0000c4c80, 0xc000150480, 0x0, 0x8, 0x0, 0x0)
/opt/gopath/src/github.com/hyperledger/fabric/peer/chaincode/install.go:44 +0x54
github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).execute(0xc0000c4c80, 0xc000150300, 0x8, 0x8, 0xc0000c4c80, 0xc000150300)
/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:762 +0x473
github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0x2320300, 0x8, 0x0, 0x231f4c0)
/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:852 +0x2fd
github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).Execute(0x2320300, 0xc00044ff40, 0x1)
/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:800 +0x2b
main.main()
/opt/gopath/src/github.com/hyperledger/fabric/peer/main.go:53 +0x2f7在该文件夹内是根据教程创建的jar,即on github。
编辑1:
上面的错误是因为路径不正确,我使用的是相对于gopath的路径,因为我之前必须对go链码执行此操作,但使用完整路径对安装有效。
对于实例化:
peer chaincode instantiate -n chaincode -v 0 -C channel -c '{"Args":["init"]}' -l java出现以下错误:
Error: could not assemble transaction, err proposal response was not successful, error code 500, msg error starting container: error starting container: Failed to generate platform-specific docker build: Error returned from build: 127 "/bin/sh: 1: ./build.sh: not found
"这是对等体的日志:
2019-01-10 07:43:44.504 UTC [chaincode.platform.java] GenerateDockerBuild -> ERRO 3e9 Can't build java chaincode Error returned from build: 127 "/bin/sh: 1: ./build.sh: not found
"
2019-01-10 07:43:44.505 UTC [chaincode.platform] func1 -> ERRO 3ea Failed to generate platform-specific docker build: Error returned from build: 127 "/bin/sh: 1: ./build.sh: not found
"
2019-01-10 07:43:44.505 UTC [dockercontroller] deployImage -> ERRO 3eb Error building image: Failed to generate platform-specific docker build: Error returned from build: 127 "/bin/sh: 1:./build.sh: not found
"
2019-01-10 07:43:44.505 UTC [dockercontroller] deployImage -> ERRO 3ec Build Output:
********************
********************
2019-01-10 07:43:44.507 UTC [endorser] callChaincode -> INFO 3ed [channel][6ba7c224] Exit chaincode: name:"lscc" (1563ms)
2019-01-10 07:43:44.507 UTC [endorser] SimulateProposal -> ERRO 3ee [channel][6ba7c224] failed to invoke chaincode name:"lscc" , error: Failed to generate platform-specific docker build: Error returned from build: 127 "/bin/sh: 1: ./build.sh: not found
"
error starting container
error starting container我将很乐意提供更多的信息和代码。
发布于 2019-01-10 13:31:54
直接从jar安装链码并不那么简单,您需要为此更改脚本或从jar文件创建自定义映像,我花了几个小时才弄明白这一点。为,
对等链代码安装和对等链代码实例化
源代码是“必要的”,因为peer执行"docker pull“来下载特定于java的镜像,以便在内部构建并启动链码容器。您可以执行docker exec来检查chaincode.jar是在链码容器中创建的。
现在来看看你的错误运行时错误:无效的内存地址或空指针引用,你能检查它的路径是否正确,并分享对等日志,我很乐意帮助你。
https://stackoverflow.com/questions/54112720
复制相似问题