0

I am trying to make a simple Cordapp and trying to connect to it using rpc via a Spring Boot application. Both Cordapp and Spring Boot applications are working fine without any errors but while making the request via postman it shows, error 404. I dont know what I am doing wrong. Can someone help me with this?

My application.properties file for Spring Boot app:

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

My Controller:

enter image description here

My build.graddle file for the cordapp:

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"]]]
}


}
Kshitiz Sharma
  • 722
  • 6
  • 14
  • 34
  • What URL are you visiting to get the 404 error? A 404 means "Not Found". If it was a CorDapp problem, you'd expect a 500 error code. – Joel Sep 17 '18 at 12:46

1 Answers1

0

It looks like you have not added your own cordapps to the cordapps property of the nodes in the build.gradle. Add them there and it should work.

Dan Newton
  • 910
  • 6
  • 7
  • My cordapp is working fine i guess. The main problem is connecting it to Spring boot app via rpc – Kshitiz Sharma Sep 03 '18 at 08:38
  • so you definitely added your cordapp? Im pretty sure if it fails with failure to connect to rpc it should output an error in the log file for you saying that is the reason why. Does your rpc connection look something like this? ```init { val rpcAddress = NetworkHostAndPort(host, rpcPort) val rpcClient = CordaRPCClient(rpcAddress) rpcConnection = rpcClient.start(username, password) proxy = rpcConnection.proxy }``` – Dan Newton Sep 03 '18 at 09:01
  • No its not showing any logs on the Cordapp side. It is just showing 404 while I am trying to make the request to the api exposed by Spring Boot – Kshitiz Sharma Sep 03 '18 at 09:05
  • There are no logs in the Spring app instead a warning is generated. https://stackoverflow.com/questions/52146450/warning-starting-the-spring-boot-application – Kshitiz Sharma Sep 03 '18 at 11:14
  • Looking at the code from that link I agree with the answer to it. Just use `@Controller`, use `@RestController` if possible. – Dan Newton Sep 03 '18 at 11:23
  • Even after removing that and using @RestController I am getting the same warning. – Kshitiz Sharma Sep 03 '18 at 11:28
  • I find the provider warnt unlikely if you have removed it and recompiled properly – Dan Newton Sep 03 '18 at 11:58