Instantiation of [simple type, class org.web3j.quorum.methods.response.raft.RaftPeer] value failed for JSON property ip due to missing (therefore NULL) value for creator parameter ip which is a non-nullable type
konbluesky opened this issue · 3 comments
System information
Geth version: geth version
Geth
Version: 1.8.18-stable
Git Commit: 20c95e5d836ebe94431ff5848e894dd938f4e147
Quorum Version: 2.4.0
Architecture: amd64
Protocol Versions: [63 62]
Network Id: 1337
Go Version: go1.11.13
Operating System: linux
GOPATH=
GOROOT=/home/travis/.gimme/versions/go1.11.13.linux.amd64
OS & Version: OSX
Branch, Commit Hash or Release: git status
Environment: docker, vagrant, host os
Expected behavior
Actual behavior
Steps to reproduce the behavior
- run RaftRpcExample.java
2.quorum.raftGetCluster().send().getCluster()
throws JsonMappingException
// raft cluster
List<RaftPeer> cluster = quorum.raftGetCluster().send().getCluster().get();
System.out.println("cluster size " + cluster.size());
System.out.println("cluster " + cluster);
- [and so on...]
Error Logs
com.fasterxml.jackson.databind.JsonMappingException: Instantiation of [simple type, class org.web3j.quorum.methods.response.raft.RaftPeer] value failed for JSON property ip due to missing (therefore NULL) value for creator parameter ip which is a non-nullable type
at [Source: buffer(ResponseBodySource(okhttp3.internal.http1.Http1ExchangeCodec$FixedLengthSource@39d76cb5)).inputStream(); line: 1, column: 258] (through reference chain: org.web3j.quorum.methods.response.raft.RaftPeer["ip"]) (through reference chain: org.web3j.quorum.methods.response.raft.RaftCluster["result"])
at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:388)
at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:348)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.wrapAndThrow(BeanDeserializerBase.java:1599)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:278)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:140)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3798)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2908)
at org.web3j.protocol.Service.send(Service.java:50)
at org.web3j.protocol.core.Request.send(Request.java:87)
at com.hthjsj.quorum.RaftRpcExample.main(RaftRpcExample.java:29)
Caused by: com.fasterxml.jackson.databind.RuntimeJsonMappingException: Instantiation of [simple type, class org.web3j.quorum.methods.response.raft.RaftPeer] value failed for JSON property ip due to missing (therefore NULL) value for creator parameter ip which is a non-nullable type
at [Source: buffer(ResponseBodySource(okhttp3.internal.http1.Http1ExchangeCodec$FixedLengthSource@39d76cb5)).inputStream(); line: 1, column: 258] (through reference chain: org.web3j.quorum.methods.response.raft.RaftPeer["ip"])
at com.fasterxml.jackson.databind.MappingIterator.next(MappingIterator.java:194)
at org.web3j.quorum.methods.response.raft.RaftCluster$ResponseDeserialiser.deserialize(RaftCluster.java:55)
at org.web3j.quorum.methods.response.raft.RaftCluster$ResponseDeserialiser.deserialize(RaftCluster.java:42)
at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:499)
at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:101)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:276)
... 6 more
Caused by: com.fasterxml.jackson.module.kotlin.MissingKotlinParameterException: Instantiation of [simple type, class org.web3j.quorum.methods.response.raft.RaftPeer] value failed for JSON property ip due to missing (therefore NULL) value for creator parameter ip which is a non-nullable type
at [Source: buffer(ResponseBodySource(okhttp3.internal.http1.Http1ExchangeCodec$FixedLengthSource@39d76cb5)).inputStream(); line: 1, column: 258] (through reference chain: org.web3j.quorum.methods.response.raft.RaftPeer["ip"])
at com.fasterxml.jackson.module.kotlin.KotlinValueInstantiator.createFromObjectWith(KotlinValueInstantiator.kt:53)
at com.fasterxml.jackson.databind.deser.impl.PropertyBasedCreator.build(PropertyBasedCreator.java:138)
at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeUsingPropertyBased(BeanDeserializer.java:471)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromObjectUsingNonDefault(BeanDeserializerBase.java:1198)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:314)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:148)
at com.fasterxml.jackson.databind.MappingIterator.nextValue(MappingIterator.java:277)
at com.fasterxml.jackson.databind.MappingIterator.next(MappingIterator.java:192)
... 11 more
Backtrace
[backtrace]
Hi @konbluesky, please note that there have been changes to the raft.cluster
api in version 2.4.0 as described here - https://github.com/jpmorganchase/quorum/blob/0b8ea86da4ed7f37bfa9b07fabd4eb11b9f6bb46/docs/Consensus/raft/raft-rpc-api.md
Further, in version 2.5.0 we have fixed an issue with the api. Please refer to Consensys/quorum#934 for further details.
can you please test with version 2.5.0 and let me know if the issue still persists?
Hi @vsmk98 ,This problem is still there, I found that was caused by project web3j-quorum
The raft file https://github.com/web3j/web3j-quorum/blob/master/src/main/kotlin/org/web3j/quorum/consensus/raft.kt ,"ip" should be changed to "hostname"
Thanks for the update @konbluesky. Will check and revert back