首页 > 解决方案 > Java Hyperledger-panic:runtimr 错误:无效的内存地址或 nil 指针取消引用

问题描述

我开始使用 Java 开发 Hyperledger Fabric,为此,我正在关注构建你的第一个网络教程。我正在尝试在对等方上安装链代码,但我一直遇到同样的问题,不知道如何解决。我想这将是链码地址的问题,但我无法真正纠正它。我在这里也粘贴了我获得教程的网页。https://hyperledger-fabric.readthedocs.io/en/latest/build_network.html

使用的命令:

peer chaincode install -n mycc -v 1.0 -l java -p /opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/java/

错误:

panic: runtime error: invalid memory address or nil pointer dereference 
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0xea273b]

完整的结果:

checkChaincodeCmdParams -> INFO 001 Using default escc
2019-03-08 09:23:44.382 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vsccpanic: 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(0x7ffd07ebd54a, 0x48, 0x0, 0x0, 0x1874100, 0xc00014be30, 0x60, 0x1691f40)      /opt/gopath/src/github.com/hyperledger/fabric/core/container/util/writer.go:64 +0xcb
path/filepath.Walk(0x7ffd07ebd54a, 0x48, 0xc000162240, 0x2, 0x3)      
/opt/go/src/path/filepath/path.go:402 +0x6a
github.com/hyperledger/fabric/core/container/util.WriteFolderToTarPackage(0xc00024c700, 0x7ffd07ebd54a, 0x48, 0xc0003f5858, 0x3, 0x3, 0x0, 0xc000135230, 0xc00024c700, 0x0)     /opt/gopath/src/github.com/hyperledger/fabric/core/container/util/writer.go:136 +0x241
github.com/hyperledger/fabric/core/container/util.WriteJavaProjectToPackage(0xc00024c700, 0x7ffd07ebd54a, 0x48, 0xc0003f5940, 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, 0x7ffd07ebd54a, 0x49, 0x4, 0xc0000bf968, 0x1716e01, 0x4, 0xc0003f59c0)       /opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/platforms/java/platform.go:123 +0x1e0
github.com/hyperledger/fabric/core/chaincode/platforms.(*Registry).GetDeploymentPayload(0xc00031c460, 0x1716e08, 0x4, 0x7ffd07ebd54a, 0x49, 0x4, 0x7ffd07ebd54a, 0x49, 0x0, 0x0)        /opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/platforms/platforms.go:103 +0x8f
github.com/hyperledger/fabric/core/container.GetChaincodePackageBytes(0xc00031c460, 0xc0002b9d00, 0x0, 0x16740c0, 0xc0001834a0, 0xc0002cbb94, 0x4)
        /opt/gopath/src/github.com/hyperledger/fabric/core/container/controller.go:191 +0xc7
github.com/hyperledger/fabric/peer/chaincode.getChaincodeDeploymentSpec(0xc0002b9d00, 0xc0002b9d01, 0x0, 0x0, 0x0)
        /opt/gopath/src/github.com/hyperledger/fabric/peer/chaincode/common.go:58 +0x11c
github.com/hyperledger/fabric/peer/chaincode.genChaincodeDeploymentSpec(0xc0002f8780, 0x7ffd07ebd533, 0x4, 0x7ffd07ebd53b, 0x3, 0x0, 0x8020103, 0x0)
/opt/gopath/src/github.com/hyperledger/fabric/peer/chaincode/install.go:109 +0xac
github.com/hyperledger/fabric/peer/chaincode.chaincodeInstall(0xc0002f8780, 0x0, 0x0, 0xc00013e0b0, 0x0, 0x0)      /opt/gopath/src/github.com/hyperledger/fabric/peer/chaincode/install.go:177 +0x156
github.com/hyperledger/fabric/peer/chaincode.installCmd.func1(0xc0002f8780, 0xc0000c0b80, 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(0xc0002f8780, 0xc0000c0a00, 0x8, 0x8, 0xc0002f8780, 0xc0000c0a00)    /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, 0xc00037bf40, 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

标签: javahyperledger-fabricblockchain

解决方案


他们已经使用新的 workin 命令更新了文档。

peer chaincode install -n mycc -v 1.0 -l java -p /opt/gopath/src/github.com/chaincode/chaincode_example02/java/

推荐阅读