How to modify h2 port in Corda for IntelliJ

0 votes

I want to change the h2 port from the default value to a custom value. The code is as follows:

build.gradle file :

node {

    name "O=A,P=B,Q=C"

    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: "edureka_user", "password": "12345678", "permissions": ["ALL"]]]

}

Main File:

startNode(providedName = CordaX500Name("O", "P", "Q"), rpcUsers = listOf(user),customOverrides = mapOf("h2Port" to 50002))

node.conf file:

 h2port=50002

myLegalName="O=A,P=B,Q=C"

networkMapService {

    address="localhost:10102"

    legalName="O=A,P=B,Q=C"

}

p2pAddress="localhost:10108"

rpcAddress="localhost:10109"

rpcUsers=[

    {

        password=12345678

        permissions=[

            ALL

        ]

        user=edureka_user

    }

]

webAddress="localhost:10110"

It is working fine via Command prompt but not when I use IntelliJ. Please help

Jul 27, 2018 in Blockchain by digger
• 26,740 points
588 views

1 answer to this question.

0 votes

When you use IntelliJ, the nodes are configured using the node driver and the build.gradle file is neglected.

To configure the h2 port of a node you need to specify it so that the node driver can be aware of the modification. You can use the following code (change it as per your requirement):

fun main(args: Array<String>) {

    driver {

        startNode(

            customOverrides = mapOf("h2port" to "12345")

        ).getOrThrow()

    }

}

(Source: https://github.com/corda/cordapp-example/blob/release-V1/kotlin-source/src/test/kotlin/com/example/NodeDriver.kt)

answered Jul 27, 2018 by slayer
• 29,350 points

Related Questions In Blockchain

0 votes
1 answer

In a Blockchain, how difficult is it to modify the third to last block?

Technically, it's not difficult at all, all ...READ MORE

answered Apr 20, 2018 in Blockchain by Christine
• 15,790 points
833 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

How to store photos in Hyperledger smart contract?

To do this, you need to represent ...READ MORE

answered Jul 9, 2018 in Blockchain by slayer
• 29,350 points
686 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP