使用rpc

时间:2018-09-03 07:00:14

标签: spring-boot block rpc blockchain corda

我正在尝试制作一个简单的Cordapp,并尝试通过Spring Boot应用程序使用rpc连接到它。 Cordapp和Spring Boot应用程序都可以正常工作,没有任何错误,但是在通过邮递员发出请求时显示 错误404 。我不知道我在做什么错。有人可以帮我吗?

我的Spring Boot应用程序的application.properties文件:

server.contextPath=/Chubb-Insurance

server.port=7090

node.PartyA.rpc.hostport=localhost:50004

db.connection=jdbc:h2:tcp://localhost:2005/node
nodename=insurer
logging.level.org.springframework.web=DEBUG


cron.expression=0 0 0 01 * ?

debit.point.qry.gt.200=100
debit.point.qry.gt.30

我的控制器:

enter image description here

cordapp的build.graddle文件:

task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
directory "./build/nodes"
node {
    name "O=Notary,L=London,C=GB"
    notary = [validating: true]
    rpcSettings {
        address("localhost:10008")
        adminAddress("localhost:10048")
    }
    p2pPort 10006
    cordapps = ["$corda_release_group:corda-finance:$corda_release_version"]
}
node {
    name "O=PartyA,L=London,C=GB"
    p2pPort 10007
    rpcSettings {
        address("localhost:50004")
        adminAddress("localhost:50005")
    }
    //webPort 10009
    h2Port 59001
    cordapps = ["$corda_release_group:corda-finance:$corda_release_version"]
    rpcUsers = [[user: "user1", "password": "test", "permissions": ["ALL"]]]
}
node {
    name "O=PartyB,L=New York,C=US"
    p2pPort 10010
    rpcSettings {
        address("localhost:50006")
        adminAddress("localhost:50007")
    }
    //webPort 10012
    h2Port 59002
    cordapps = ["$corda_release_group:corda-finance:$corda_release_version"]
    rpcUsers = [[user: "user1", "password": "test", "permissions": ["ALL"]]]
}
node {
    name "O=PartyC,L=Sydney,C=AU"
    p2pPort 10013
    rpcSettings {
        address("localhost:50008")
        adminAddress("localhost:50009")
    }
    // webPort 10015
    h2Port 59003
    cordapps = ["$corda_release_group:corda-finance:$corda_release_version"]
    rpcUsers = [[user: "user1", "password": "test", "permissions": ["ALL"]]]
}


}

1 个答案:

答案 0 :(得分:1)

您似乎尚未将自己的cordapp添加到cordapps中节点的build.gradle属性中。在其中添加它们,它应该可以工作。