【发布时间】:2018-12-21 18:31:03
【问题描述】:
无法在我的 CustomController 中使用 CordaRPCOps 实现方法,
@RequestMapping(value="/peers", produces = MediaType.APPLICATION_JSON)
public Map<String, List<String>> peers() throws Exception
{
CordaRPCOps proxy=rpc.getParameterValue("proxy");
Party myIdentity= proxy.nodeInfo().getLegalIdentities().get(0);
return ImmutableMap.of("peers", rpcOpsImpl.networkMapSnapshot()
.stream()
.filter(nodeInfo -> nodeInfo.getLegalIdentities().get(0) != myIdentity)
.map(it -> it.getLegalIdentities().get(0).getName().getOrganisation())
.collect(toList()));
}
在构建 runPartyAServer 时出错,
APPLICATION FAILED TO START
Description:
Field services in net.corda.server.controllers.CustomController required a bean of type 'net.corda.core.messaging.CordaRPCOps' that could not be found.
Action:
Consider defining a bean of type 'net.corda.core.messaging.CordaRPCOps' in your configuration.
【问题讨论】:
-
你能得到代码来显示
rpc变量在哪里被实例化吗? -
@Controller public class CustomController { private NodeRPCConnection rpc;私有 CordaRPCOps rpcOpsImpl; } 从 NodeRPCConnection 获取代理值,使用 CordaRPCOps proxy=rpc.getParameterValue("proxy");
-
谁能帮我解决这个异常