无法完成使用Hyperledger Fabric 1.4.3使用Java chaincode编写您的第一个应用程序教程

问题描述 投票:0回答:1

在成功使用javascript成功构建了“第一个网络”教程并使用默认语言成功构建了“编写第一个应用程序”教程之后,尝试使用Java执行该操作时出现错误:

./startFabric.sh java

这很重要,因为我的项目将在Java上同时开发链代码和客户端。

错误是脚本尝试在通道上实例化智能合约时。先前的命令执行OK:

Error: could not assemble transaction, err proposal response was not successful, error code 500, msg chaincode registration failed: container exited with 1

我已经尝试过基于BYFN脚本的类似步骤,并且只要扩展了ChaincodeBase类,我就可以使用所有适用于Java chaincode的东西。如果实现ContractInterface,则在使用BYFN时也会出现描述错误。我应该考虑使用ContractInterface激活java chaincode时有什么特别的措施吗? (请注意,这对于我在BYFN教程中的自定义类以及在运行普通标准的“编写第一个应用程序”教程时都失败了。1.4.3上的Java类型是否可能有问题?)

命令生成错误的完整输出(我已在BYFN教程的docker-compose-cli.yaml文件中启用了DEBUG,在该其他教程中使用):

+ echo 'Instantiating smart contract on mychannel'
Instantiating smart contract on mychannel
+ docker exec -e CORE_PEER_LOCALMSPID=Org1MSP -e CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp cli peer chaincode instantiate -o orderer.example.com:7050 -C mychannel -n fabcar -l java -v 1.0 -c '{"Args":[]}' -P 'AND('\''Org1MSP.member'\'','\''Org2MSP.member'\'')' --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem --peerAddresses peer0.org1.example.com:7051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
2019-10-05 20:53:15.020 UTC [viperutil] getKeysRecursively -> DEBU 001 Found map[string]interface{} value for peer.BCCSP
2019-10-05 20:53:15.021 UTC [viperutil] getKeysRecursively -> DEBU 002 Found map[string]interface{} value for peer.BCCSP.PKCS11
2019-10-05 20:53:15.022 UTC [viperutil] unmarshalJSON -> DEBU 003 Unmarshal JSON: value is not a string: <nil>
2019-10-05 20:53:15.028 UTC [viperutil] getKeysRecursively -> DEBU 004 Found real value for peer.BCCSP.PKCS11.Label setting to <nil> <nil>
2019-10-05 20:53:15.028 UTC [viperutil] unmarshalJSON -> DEBU 005 Unmarshal JSON: value is not a string: <nil>
2019-10-05 20:53:15.029 UTC [viperutil] getKeysRecursively -> DEBU 006 Found real value for peer.BCCSP.PKCS11.Pin setting to <nil> <nil>
2019-10-05 20:53:15.030 UTC [viperutil] unmarshalJSON -> DEBU 007 Unmarshal JSON: value is not a string: <nil>
2019-10-05 20:53:15.031 UTC [viperutil] getKeysRecursively -> DEBU 008 Found real value for peer.BCCSP.PKCS11.Hash setting to <nil> <nil>
2019-10-05 20:53:15.031 UTC [viperutil] unmarshalJSON -> DEBU 009 Unmarshal JSON: value is not a string: <nil>
2019-10-05 20:53:15.032 UTC [viperutil] getKeysRecursively -> DEBU 00a Found real value for peer.BCCSP.PKCS11.Security setting to <nil> <nil>
2019-10-05 20:53:15.033 UTC [viperutil] getKeysRecursively -> DEBU 00b Found map[string]interface{} value for peer.BCCSP.PKCS11.FileKeyStore
2019-10-05 20:53:15.033 UTC [viperutil] unmarshalJSON -> DEBU 00c Unmarshal JSON: value is not a string: <nil>
2019-10-05 20:53:15.034 UTC [viperutil] getKeysRecursively -> DEBU 00d Found real value for peer.BCCSP.PKCS11.FileKeyStore.KeyStore setting to <nil> <nil>
2019-10-05 20:53:15.035 UTC [viperutil] unmarshalJSON -> DEBU 00e Unmarshal JSON: value is not a string: <nil>
2019-10-05 20:53:15.036 UTC [viperutil] getKeysRecursively -> DEBU 00f Found real value for peer.BCCSP.PKCS11.Library setting to <nil> <nil>
2019-10-05 20:53:15.037 UTC [viperutil] unmarshalJSON -> DEBU 010 Unmarshal JSON: value cannot be unmarshalled: invalid character 'S' looking for beginning of value
2019-10-05 20:53:15.037 UTC [viperutil] getKeysRecursively -> DEBU 011 Found real value for peer.BCCSP.Default setting to string SW
2019-10-05 20:53:15.038 UTC [viperutil] getKeysRecursively -> DEBU 012 Found map[string]interface{} value for peer.BCCSP.SW
2019-10-05 20:53:15.038 UTC [viperutil] unmarshalJSON -> DEBU 013 Unmarshal JSON: value cannot be unmarshalled: invalid character 'S' looking for beginning of value
2019-10-05 20:53:15.038 UTC [viperutil] getKeysRecursively -> DEBU 014 Found real value for peer.BCCSP.SW.Hash setting to string SHA2
2019-10-05 20:53:15.039 UTC [viperutil] unmarshalJSON -> DEBU 015 Unmarshal JSON: value is not a string: 256
2019-10-05 20:53:15.039 UTC [viperutil] getKeysRecursively -> DEBU 016 Found real value for peer.BCCSP.SW.Security setting to int 256
2019-10-05 20:53:15.040 UTC [viperutil] getKeysRecursively -> DEBU 017 Found map[string]interface{} value for peer.BCCSP.SW.FileKeyStore
2019-10-05 20:53:15.040 UTC [viperutil] unmarshalJSON -> DEBU 018 Unmarshal JSON: value cannot be unmarshalled: unexpected end of JSON input
2019-10-05 20:53:15.040 UTC [viperutil] getKeysRecursively -> DEBU 019 Found real value for peer.BCCSP.SW.FileKeyStore.KeyStore setting to string 
2019-10-05 20:53:15.040 UTC [viperutil] EnhancedExactUnmarshalKey -> DEBU 01a map[peer.BCCSP:map[PKCS11:map[Label:<nil> Pin:<nil> Hash:<nil> Security:<nil> FileKeyStore:map[KeyStore:<nil>] Library:<nil>] Default:SW SW:map[FileKeyStore:map[KeyStore:] Hash:SHA2 Security:256]]]
2019-10-05 20:53:15.049 UTC [bccsp_sw] openKeyStore -> DEBU 01b KeyStore opened at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp/keystore]...done
2019-10-05 20:53:15.050 UTC [bccsp] initBCCSP -> DEBU 01c Initialize BCCSP [SW]
2019-10-05 20:53:15.051 UTC [msp] getPemMaterialFromDir -> DEBU 01d Reading directory /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp/signcerts
2019-10-05 20:53:15.054 UTC [msp] getPemMaterialFromDir -> DEBU 01e Inspecting file /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp/signcerts/[email protected]
2019-10-05 20:53:15.057 UTC [msp] getPemMaterialFromDir -> DEBU 01f Reading directory /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp/cacerts
2019-10-05 20:53:15.074 UTC [msp] getPemMaterialFromDir -> DEBU 020 Inspecting file /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp/cacerts/ca.org1.example.com-cert.pem
2019-10-05 20:53:15.078 UTC [msp] getPemMaterialFromDir -> DEBU 021 Reading directory /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp/admincerts
2019-10-05 20:53:15.081 UTC [msp] getPemMaterialFromDir -> DEBU 022 Reading directory /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp/intermediatecerts
2019-10-05 20:53:15.082 UTC [msp] getMspConfig -> DEBU 023 Intermediate certs folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp/intermediatecerts]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp/intermediatecerts: no such file or directory]
2019-10-05 20:53:15.082 UTC [msp] getPemMaterialFromDir -> DEBU 024 Reading directory /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp/tlscacerts
2019-10-05 20:53:15.084 UTC [msp] getPemMaterialFromDir -> DEBU 025 Inspecting file /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp/tlscacerts/tlsca.org1.example.com-cert.pem
2019-10-05 20:53:15.087 UTC [msp] getPemMaterialFromDir -> DEBU 026 Reading directory /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp/tlsintermediatecerts
2019-10-05 20:53:15.088 UTC [msp] getMspConfig -> DEBU 027 TLS intermediate certs folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp/tlsintermediatecerts]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp/tlsintermediatecerts: no such file or directory]
2019-10-05 20:53:15.088 UTC [msp] getPemMaterialFromDir -> DEBU 028 Reading directory /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp/crls
2019-10-05 20:53:15.089 UTC [msp] getMspConfig -> DEBU 029 crls folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp/crls]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp/crls: no such file or directory]
2019-10-05 20:53:15.092 UTC [msp] getMspConfig -> DEBU 02a Loading NodeOUs
2019-10-05 20:53:15.101 UTC [msp] newBccspMsp -> DEBU 02b Creating BCCSP-based MSP instance
2019-10-05 20:53:15.101 UTC [msp] New -> DEBU 02c Creating Cache-MSP instance
2019-10-05 20:53:15.101 UTC [msp] loadLocaMSP -> DEBU 02d Created new local MSP
2019-10-05 20:53:15.101 UTC [msp] Setup -> DEBU 02e Setting up MSP instance Org1MSP
2019-10-05 20:53:15.101 UTC [msp.identity] newIdentity -> DEBU 02f Creating identity instance for cert -----BEGIN CERTIFICATE-----
MIICUTCCAfegAwIBAgIQCbARM9hKjIu8+CFIr6eBgjAKBggqhkjOPQQDAjBzMQsw
CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy
YW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eu
b3JnMS5leGFtcGxlLmNvbTAeFw0xOTEwMDUyMDQ3MDBaFw0yOTEwMDIyMDQ3MDBa
MHMxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T
YW4gRnJhbmNpc2NvMRkwFwYDVQQKExBvcmcxLmV4YW1wbGUuY29tMRwwGgYDVQQD
ExNjYS5vcmcxLmV4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE
EB0CfJUn5SVC5wnRigjgn5ly3RqG71rMB/kpor6424CXA7nGkbNYrYMLpvphl269
ZTJw29eX8yMcFDdJiOGk96NtMGswDgYDVR0PAQH/BAQDAgGmMB0GA1UdJQQWMBQG
CCsGAQUFBwMCBggrBgEFBQcDATAPBgNVHRMBAf8EBTADAQH/MCkGA1UdDgQiBCDV
sUe8vAO3KUVLi9k3fFC1lOKAcof29iGCfW/FL+Af2zAKBggqhkjOPQQDAgNIADBF
AiEA3ZnwKLtTxA5dLaTMlo3bvM9rxePNgrXfks7PpCgcvJkCICewXOoL728OHKsf
FVfdXsxcYuvCAYxA01gOhIaDYeZv
-----END CERTIFICATE-----
2019-10-05 20:53:15.101 UTC [msp.identity] newIdentity -> DEBU 030 Creating identity instance for cert -----BEGIN CERTIFICATE-----
MIICKjCCAdCgAwIBAgIRAOKj1RX6UST5URhwxCLpuGwwCgYIKoZIzj0EAwIwczEL
MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG
cmFuY2lzY28xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2Nh
Lm9yZzEuZXhhbXBsZS5jb20wHhcNMTkxMDA1MjA0NzAwWhcNMjkxMDAyMjA0NzAw
WjBrMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMN
U2FuIEZyYW5jaXNjbzEOMAwGA1UECxMFYWRtaW4xHzAdBgNVBAMMFkFkbWluQG9y
ZzEuZXhhbXBsZS5jb20wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAR/gLdyUdjv
nfpc3a6AwB8a7rl3JyVX+MOjjqbgpLC3WCr/2PP7ruc9eykCBIldbYFjT5cmHSBx
gyRrwdaHKmewo00wSzAOBgNVHQ8BAf8EBAMCB4AwDAYDVR0TAQH/BAIwADArBgNV
HSMEJDAigCDVsUe8vAO3KUVLi9k3fFC1lOKAcof29iGCfW/FL+Af2zAKBggqhkjO
PQQDAgNIADBFAiEA68aYxGYh25KTsVL80q7Ije6IEJDLy7j19sTgbLrkvSECIEg9
L5Xolh50rmr9FUzGbrVZ1EXwrCUPlVj1JuGOuJhf
-----END CERTIFICATE-----
2019-10-05 20:53:15.103 UTC [bccsp_sw] loadPrivateKey -> DEBU 031 Loading private key [1213fbf8cd9319e6818538fcdac1e85754eca7a67e5edfa08b6bf776a36eb509] at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp/keystore/1213fbf8cd9319e6818538fcdac1e85754eca7a67e5edfa08b6bf776a36eb509_sk]...
2019-10-05 20:53:15.106 UTC [msp.identity] newIdentity -> DEBU 032 Creating identity instance for cert -----BEGIN CERTIFICATE-----
MIICKjCCAdCgAwIBAgIRAOKj1RX6UST5URhwxCLpuGwwCgYIKoZIzj0EAwIwczEL
MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG
cmFuY2lzY28xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2Nh
Lm9yZzEuZXhhbXBsZS5jb20wHhcNMTkxMDA1MjA0NzAwWhcNMjkxMDAyMjA0NzAw
WjBrMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMN
U2FuIEZyYW5jaXNjbzEOMAwGA1UECxMFYWRtaW4xHzAdBgNVBAMMFkFkbWluQG9y
ZzEuZXhhbXBsZS5jb20wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAR/gLdyUdjv
nfpc3a6AwB8a7rl3JyVX+MOjjqbgpLC3WCr/2PP7ruc9eykCBIldbYFjT5cmHSBx
gyRrwdaHKmewo00wSzAOBgNVHQ8BAf8EBAMCB4AwDAYDVR0TAQH/BAIwADArBgNV
HSMEJDAigCDVsUe8vAO3KUVLi9k3fFC1lOKAcof29iGCfW/FL+Af2zAKBggqhkjO
PQQDAgNIADBFAiEA68aYxGYh25KTsVL80q7Ije6IEJDLy7j19sTgbLrkvSECIEg9
L5Xolh50rmr9FUzGbrVZ1EXwrCUPlVj1JuGOuJhf
-----END CERTIFICATE-----
2019-10-05 20:53:15.107 UTC [msp] setupSigningIdentity -> DEBU 033 Signing identity expires at 2029-10-02 20:47:00 +0000 UTC
2019-10-05 20:53:15.114 UTC [grpc] DialContext -> DEBU 034 parsed scheme: ""
2019-10-05 20:53:15.114 UTC [grpc] DialContext -> DEBU 035 scheme "" not registered, fallback to default scheme
2019-10-05 20:53:15.115 UTC [grpc] watcher -> DEBU 036 ccResolverWrapper: sending new addresses to cc: [{peer0.org1.example.com:7051 0  <nil>}]
2019-10-05 20:53:15.115 UTC [grpc] switchBalancer -> DEBU 037 ClientConn switching balancer to "pick_first"
2019-10-05 20:53:15.115 UTC [grpc] HandleSubConnStateChange -> DEBU 038 pickfirstBalancer: HandleSubConnStateChange: 0xc0001fe630, CONNECTING
2019-10-05 20:53:15.122 UTC [grpc] HandleSubConnStateChange -> DEBU 039 pickfirstBalancer: HandleSubConnStateChange: 0xc0001fe630, READY
2019-10-05 20:53:15.131 UTC [grpc] DialContext -> DEBU 03a parsed scheme: ""
2019-10-05 20:53:15.131 UTC [grpc] DialContext -> DEBU 03b scheme "" not registered, fallback to default scheme
2019-10-05 20:53:15.133 UTC [grpc] watcher -> DEBU 03c ccResolverWrapper: sending new addresses to cc: [{peer0.org1.example.com:7051 0  <nil>}]
2019-10-05 20:53:15.134 UTC [grpc] switchBalancer -> DEBU 03d ClientConn switching balancer to "pick_first"
2019-10-05 20:53:15.135 UTC [grpc] HandleSubConnStateChange -> DEBU 03e pickfirstBalancer: HandleSubConnStateChange: 0xc0002701a0, CONNECTING
2019-10-05 20:53:15.141 UTC [grpc] HandleSubConnStateChange -> DEBU 03f pickfirstBalancer: HandleSubConnStateChange: 0xc0002701a0, READY
2019-10-05 20:53:15.146 UTC [msp] GetDefaultSigningIdentity -> DEBU 040 Obtaining default signing identity
2019-10-05 20:53:15.151 UTC [grpc] DialContext -> DEBU 041 parsed scheme: ""
2019-10-05 20:53:15.151 UTC [grpc] DialContext -> DEBU 042 scheme "" not registered, fallback to default scheme
2019-10-05 20:53:15.151 UTC [grpc] watcher -> DEBU 043 ccResolverWrapper: sending new addresses to cc: [{orderer.example.com:7050 0  <nil>}]
2019-10-05 20:53:15.152 UTC [grpc] switchBalancer -> DEBU 044 ClientConn switching balancer to "pick_first"
2019-10-05 20:53:15.153 UTC [grpc] HandleSubConnStateChange -> DEBU 045 pickfirstBalancer: HandleSubConnStateChange: 0xc0001c6ff0, CONNECTING
2019-10-05 20:53:15.161 UTC [grpc] HandleSubConnStateChange -> DEBU 046 pickfirstBalancer: HandleSubConnStateChange: 0xc0001c6ff0, READY
2019-10-05 20:53:15.163 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 047 Using default escc
2019-10-05 20:53:15.163 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 048 Using default vscc
2019-10-05 20:53:15.167 UTC [msp.identity] Sign -> DEBU 049 Sign: plaintext: 0ABE070A6608031A0B08BB85E4EC0510...324D53500A04657363630A0476736363 
2019-10-05 20:53:15.167 UTC [msp.identity] Sign -> DEBU 04a Sign: digest: F54E5852AADCA181D55B7C517AFC1E292D1A59CB19AB0B37EAED68244A4A0190 
Error: could not assemble transaction, err proposal response was not successful, error code 500, msg chaincode registration failed: container exited with 1
hyperledger-fabric blockchain
1个回答
0
投票
[尝试下载Hyperledger Fabric 2.0(link)的样本版本,然后尝试使用Java 1.8运行startFabric.sh命令。

它对我有用。

© www.soinside.com 2019 - 2024. All rights reserved.