, это может быть связано с конфликтом с библиотекой Google Guava. Corda 3 использует Guava 21. В моем случае, в моем build.gradle не было явно выражения Guava, но моя версия jHipster использовала Guava 27. Я просто добавил следующее в конец зависимостей на моем build.gradle, и оно исправлено проблема.
ытался перейти с Corda Server на Spring Boot. Я ссылался на проект Джоэла (официальный представитель Corda) в Kotlin, но получил это исключение при попытке использовать rpcOps.
RPCClientProxyHandler.artemisMessageHandler - RPC reply arrived to unknown RPC ID RpcRequestId(toLong=2111196934580277300), this indicates an internal RPC error.
[ERROR] 2018-02-02T07:54:05,227 [Thread-0 (ActiveMQ-client-global-threads)] client - AMQ214000: Failed to call onMessage
com.esotericsoftware.kryo.KryoException: java.lang.IllegalArgumentException: Privacy salt should be 32 bytes.
Serialization trace:
legalIdentitiesAndCerts (net.corda.core.node.NodeInfo)
value (net.corda.core.utilities.Try$Success)
at com.esotericsoftware.kryo.serializers.ObjectField.read(ObjectField.java:144) ~[kryo-4.0.0.jar:?]
at com.esotericsoftware.kryo.serializers.CompatibleFieldSerializer.read(CompatibleFieldSerializer.java:147) ~[kryo-4.0.0.jar:?]
at com.esotericsoftware.kryo.Kryo.readClassAndObject(Kryo.java:813) ~[kryo-4.0.0.jar:?]
at com.esotericsoftware.kryo.serializers.CollectionSerializer.read(CollectionSerializer.java:134) ~[kryo-4.0.0.jar:?]
at com.esotericsoftware.kryo.serializers.CollectionSerializer.read(CollectionSerializer.java:40) ~[kryo-4.0.0.jar:?]
at com.esotericsoftware.kryo.Kryo.readObject(Kryo.java:731) ~[kryo-4.0.0.jar:?]
at com.esotericsoftware.kryo.serializers.ObjectField.read(ObjectField.java:125) ~[kryo-4.0.0.jar:?]
at com.esotericsoftware.kryo.serializers.CompatibleFieldSerializer.read(CompatibleFieldSerializer.java:147) ~[kryo-4.0.0.jar:?]
at com.esotericsoftware.kryo.Kryo.readClassAndObject(Kryo.java:813) ~[kryo-4.0.0.jar:?]
at net.corda.nodeapi.internal.serialization.AbstractKryoSerializationScheme$deserialize$inlined$use$lambdaНиже мой RPConnector:1.invoke(SerializationScheme.kt:209) ~[corda-node-api-2.0.0.jar:?]
at net.corda.nodeapi.internal.serialization.AbstractKryoSerializationScheme$deserialize$inlined$use$lambdaНиже мой RPConnector:1.invoke(SerializationScheme.kt:152) ~[corda-node-api-2.0.0.jar:?]
at net.corda.nodeapi.internal.serialization.AbstractKryoSerializationScheme.withContext(SerializationScheme.kt:191) ~[corda-node-api-2.0.0.jar:?]
at net.corda.nodeapi.internal.serialization.AbstractKryoSerializationScheme.access$withContext(SerializationScheme.kt:152) ~[corda-node-api-2.0.0.jar:?]
at net.corda.nodeapi.internal.serialization.AbstractKryoSerializationScheme$deserialize$inlined$use$lambda$1.execute(SerializationScheme.kt:206) ~[corda-node-api-2.0.0.jar:?]
at com.esotericsoftware.kryo.pool.KryoPoolQueueImpl.run(KryoPoolQueueImpl.java:61) ~[kryo-4.0.0.jar:?]
at net.corda.nodeapi.internal.serialization.AbstractKryoSerializationScheme.deserialize(SerializationScheme.kt:205) ~[corda-node-api-2.0.0.jar:?]
at net.corda.nodeapi.internal.serialization.SerializationFactoryImpl$deserializeНиже мой RPConnector:1.invoke(SerializationScheme.kt:115) ~[corda-node-api-2.0.0.jar:?]
at net.corda.core.serialization.SerializationFactory.withCurrentContext(SerializationAPI.kt:53) ~[corda-core-2.0.0.jar:?]
at net.corda.nodeapi.internal.serialization.SerializationFactoryImpl$deserialize$1.invoke(SerializationScheme.kt:115) ~[corda-node-api-2.0.0.jar:?]
at net.corda.nodeapi.internal.serialization.SerializationFactoryImpl$deserialize$1.invoke(SerializationScheme.kt:95) ~[corda-node-api-2.0.0.jar:?]
at net.corda.core.serialization.SerializationFactory.asCurrent(SerializationAPI.kt:67) ~[corda-core-2.0.0.jar:?]
at net.corda.nodeapi.internal.serialization.SerializationFactoryImpl.deserialize(SerializationScheme.kt:115) ~[corda-node-api-2.0.0.jar:?]
at net.corda.nodeapi.RPCApi$ServerToClient$Companion.fromClientMessage(RPCApi.kt:234) ~[corda-node-api-2.0.0.jar:?]
at net.corda.client.rpc.internal.RPCClientProxyHandler.artemisMessageHandler(RPCClientProxyHandler.kt:242) ~[corda-rpc-2.0.0.jar:?]
at net.corda.client.rpc.internal.RPCClientProxyHandler.access$artemisMessageHandler(RPCClientProxyHandler.kt:65) ~[corda-rpc-2.0.0.jar:?]
at net.corda.client.rpc.internal.RPCClientProxyHandler$start$3.invoke(RPCClientProxyHandler.kt:192) ~[corda-rpc-2.0.0.jar:?]
at net.corda.client.rpc.internal.RPCClientProxyHandler$start$3.invoke(RPCClientProxyHandler.kt:65) ~[corda-rpc-2.0.0.jar:?]
at net.corda.client.rpc.internal.RPCClientProxyHandlerKt$sam$MessageHandler$cbde6789.onMessage(RPCClientProxyHandler.kt) ~[corda-rpc-2.0.0.jar:?]
at org.apache.activemq.artemis.core.client.impl.ClientConsumerImpl.callOnMessage(ClientConsumerImpl.java:997) ~[artemis-core-client-2.1.0.jar:2.1.0]
at org.apache.activemq.artemis.core.client.impl.ClientConsumerImpl.access$400(ClientConsumerImpl.java:49) ~[artemis-core-client-2.1.0.jar:2.1.0]
at org.apache.activemq.artemis.core.client.impl.ClientConsumerImpl$Runner.run(ClientConsumerImpl.java:1120) [artemis-core-client-2.1.0.jar:2.1.0]
at org.apache.activemq.artemis.utils.OrderedExecutorFactory$OrderedExecutor$ExecutorTask.run(OrderedExecutorFactory.java:101) [artemis-commons-2.1.0.jar:2.1.0]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_144]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_144]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_144]
Caused by: java.lang.IllegalArgumentException: Privacy salt should be 32 bytes.
at net.corda.core.contracts.PrivacySalt.<init>(Structures.kt:272) ~[corda-core-2.0.0.jar:?]
at net.corda.nodeapi.internal.serialization.DefaultKryoCustomizer$PrivacySaltSerializer.read(DefaultKryoCustomizer.kt:188) ~[corda-node-api-2.0.0.jar:?]
at net.corda.nodeapi.internal.serialization.DefaultKryoCustomizer$PrivacySaltSerializer.read(DefaultKryoCustomizer.kt:182) ~[corda-node-api-2.0.0.jar:?]
at com.esotericsoftware.kryo.Kryo.readClassAndObject(Kryo.java:813) ~[kryo-4.0.0.jar:?]
at com.esotericsoftware.kryo.serializers.CollectionSerializer.read(CollectionSerializer.java:134) ~[kryo-4.0.0.jar:?]
at com.esotericsoftware.kryo.serializers.CollectionSerializer.read(CollectionSerializer.java:40) ~[kryo-4.0.0.jar:?]
at com.esotericsoftware.kryo.Kryo.readObject(Kryo.java:731) ~[kryo-4.0.0.jar:?]
at com.esotericsoftware.kryo.serializers.ObjectField.read(ObjectField.java:125) ~[kryo-4.0.0.jar:?]
... 34 more
Ниже мой RPConnector:
private CordaRPCOps rpcOps;
@PostConstruct
private void init() {
System.out.println("RPConnector [host=" + host + ", username=" + username + ", password=" + password
+ ", rpcPort=" + rpcPort + "]");
NetworkHostAndPort rpcAddress = new NetworkHostAndPort(host, Integer.valueOf(rpcPort));
CordaRPCClient rpcClient = new CordaRPCClient(rpcAddress);
CordaRPCConnection rpcConnection = rpcClient.start(username, password);
rpcOps = rpcConnection.getProxy();
}
public CordaRPCOps getRPCops() {
return rpcOps;
}
Соединение происходит успешно, но когда я пытаюсь использовать разъем RPC, я получаю следующую ошибку: Ниже мой контроллер. Когда я пытаюсь получить все узлы, я получаю ошибку:
@Autowired
private RPConnector rpcOps;
private final List<String> serviceNames = ImmutableList.of("Controller", "Network Map Service");
@GetMapping("/allnodes")
@Produces(MediaType.APPLICATION_JSON)
public Map<String, List<CordaX500Name>> getAllNodes() {
List<NodeInfo> nodeInfoSnapshot = rpcOps.getRPCops().networkMapSnapshot();
return ImmutableMap.of("allnodes",
nodeInfoSnapshot.stream().map(node -> node.getLegalIdentities().get(0).getName()).filter(
name -> !name.equals(rpcOps.getRPCops().nodeInfo().getLegalIdentities().get(0).getName())
&& !serviceNames.contains(name.getOrganisation()))
.collect(toList()));
}
Спасибо.
Обновление при ошибке, исключение нулевого указателя:
java.lang.NullPointerException
at net.corda.core.serialization.SerializedBytes.getHash(SerializationAPI.kt)
at net.corda.core.serialization.SerializedBytes.<init>(SerializationAPI.kt:201)
at net.corda.nodeapi.internal.serialization.AbstractKryoSerializationScheme$serializeНиже мой RPConnector:1.invoke(SerializationScheme.kt:233)
at net.corda.nodeapi.internal.serialization.AbstractKryoSerializationScheme$serializeНиже мой RPConnector:1.invoke(SerializationScheme.kt:152)
at net.corda.nodeapi.internal.serialization.AbstractKryoSerializationScheme.withContext(SerializationScheme.kt:191)
at net.corda.nodeapi.internal.serialization.AbstractKryoSerializationScheme.access$withContext(SerializationScheme.kt:152)
at net.corda.nodeapi.internal.serialization.AbstractKryoSerializationScheme$serialize$1.execute(SerializationScheme.kt:221)
at net.corda.nodeapi.internal.serialization.AbstractKryoSerializationScheme$serialize$1.execute(SerializationScheme.kt:152)
at com.esotericsoftware.kryo.pool.KryoPoolQueueImpl.run(KryoPoolQueueImpl.java:61)
at net.corda.nodeapi.internal.serialization.AbstractKryoSerializationScheme.serialize(SerializationScheme.kt:220)
at net.corda.nodeapi.internal.serialization.SerializationFactoryImpl$serializeНиже мой RPConnector:1.invoke(SerializationScheme.kt:119)
at net.corda.nodeapi.internal.serialization.SerializationFactoryImpl$serializeНиже мой RPConnector:1.invoke(SerializationScheme.kt:95)
at net.corda.core.serialization.SerializationFactory.withCurrentContext(SerializationAPI.kt:53)
at net.corda.nodeapi.internal.serialization.SerializationFactoryImpl$serialize$1.invoke(SerializationScheme.kt:119)
at net.corda.nodeapi.internal.serialization.SerializationFactoryImpl$serialize$1.invoke(SerializationScheme.kt:95)
at net.corda.core.serialization.SerializationFactory.asCurrent(SerializationAPI.kt:67)
at net.corda.nodeapi.internal.serialization.SerializationFactoryImpl.serialize(SerializationScheme.kt:119)
at net.corda.core.serialization.SerializationAPIKt.serialize(SerializationAPI.kt:191)
at net.corda.core.serialization.SerializationAPIKt.serialize$default(SerializationAPI.kt:190)
at net.corda.nodeapi.RPCApi$ClientToServer$RpcRequest.writeToClientMessage(RPCApi.kt:113)
at net.corda.client.rpc.internal.RPCClientProxyHandler.invoke(RPCClientProxyHandler.kt:215)
at com.sun.proxy.$Proxy22.networkMapSnapshot(Unknown Source)