导入包net.corda.client.rpc.CordaRPCClient时出错

时间:2019-03-21 11:29:05

标签: corda

执行单独的客户端应用程序时,将显示以下错误:

Error:(33, 22) Kotlin: Unresolved reference: CordaRPCClient error in importing package net.corda.client.rpc.CordaRPCClient

我的客户端代码详细信息如下。运行gradlew.bat buildnodes后复制并导入了corda-app jar

package com.template

import net.corda.client.rpc.CordaRPCClient
import net.corda.core.messaging.startFlow
import net.corda.core.utilities.NetworkHostAndPort.Companion.parse
import net.corda.core.utilities.loggerFor
import net.corda.core.identity.Party
import com.template.flows.IOUFlow
import net.corda.core.identity.CordaX500Name
import net.corda.core.utilities.getOrThrow

fun main(args: Array<String>) = Client().main(args)
private class Client {
    companion object {
        val logger = loggerFor<Client>()
    }

    fun main(args: Array<String>) {
        require(args.size == 3) { "Usage: Client <node address> <rpc username> <rpc password>" }
        val nodeAddress = parse(args[0])
        val rpcUsername = args[1]
        val rpcPassword = args[2]
        val client = CordaRPCClient(nodeAddress)
        //val proxy = client.start(rpcUsername, rpcPassword).proxy
        val connection = client.start(rpcUsername, rpcPassword)
        val cordaRPCOperations = connection.proxy

        val nodes = cordaRPCOperations.networkMapSnapshot()
        logger.info("{}", nodes)
        val x500Name = CordaX500Name.parse("O=PartyB,L=New York,C=US")

        val partyf = cordaRPCOperations.wellKnownPartyFromX500Name(x500Name)

        logger.info(cordaRPCOperations.currentNodeTime().toString())


    }
}

1 个答案:

答案 0 :(得分:1)

您的corda-rpc客户端或rpc客户端必须具有以下依赖关系:

cordaCompile "net.corda:corda-rpc:$corda_release_version"