1

I can connect to h2 database using this default jdbc:h2:tcp://10.0.1.6:53062/node for a particular node. I wanted to change it to custom as 50002. So I addedd the port in build.gradle file and started the node in using customOverrides in Main file.

build.gradle file :

node {
    name "O=PartyA,L=London,C=GB"
    advertisedServices = []
    p2pPort 10108
    rpcPort 10109
    webPort 10110
    h2Port 50002
    cordapps = [
            "com.template:states-and-contracts:$version",
            "com.template:other-sources:$version",
            "net.corda:corda-finance:$corda_release_version"
    ]
    rpcUsers = [[ user: "user1", "password": "test", "permissions": ["ALL"]]]
}

Main File:

startNode(providedName = CordaX500Name("PartyA", "London", "GB"), rpcUsers = listOf(user),customOverrides = mapOf("h2Port" to 50002))

But still it I couldnt connect to 50002. After building this is the config file structure.

node.conf file:

 h2port=50002
myLegalName="O=PartyA,L=New York,C=US"
networkMapService {
    address="localhost:10102"
    legalName="O=Controller,L=London,C=GB"
}
p2pAddress="localhost:10108"
rpcAddress="localhost:10109"
rpcUsers=[
    {
        password=test
        permissions=[
            ALL
        ]
        user=user1
    }
]
webAddress="localhost:10110" 

I can connect to this port only when I run via command prompt. I am facing this problem when I run via intellij idea. Please help

ToniyaSundaram
  • 191
  • 3
  • 12

1 Answers1

1

When running the nodes via IntelliJ, the build.gradle file is ignored. Instead, the nodes are configured and started using the node driver (https://github.com/corda/cordapp-example/blob/release-V1/kotlin-source/src/test/kotlin/com/example/NodeDriver.kt).

You can configure a node's H2 port when using the node driver as follows:

fun main(args: Array<String>) {
    driver {
        startNode(
            customOverrides = mapOf("h2port" to "12345")
        ).getOrThrow()
    }
}
Joel
  • 22,762
  • 5
  • 26
  • 41