I have developed one sample cordapp. There is a total of 4 nodes(Notary, Dealer, Manufacturer, and HDFC). All the nodes are running successfully apart from the Dealer node. I am getting the below error. I am also sharing the build.gradle file.
error screenshot
task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
nodeDefaults {
projectCordapp {
deploy = false
}
cordapp project(':contracts')
cordapp project(':workflows')
}
node {
name "O=Notary,L=London,C=GB"
notary = [validating : false]
p2pPort 10002
rpcSettings {
address("localhost:10003")
adminAddress("localhost:10043")
}
}
node {
name "O=Dealer,L=London,C=GB"
p2pPort 10005
rpcSettings {
address("localhost:10006")
adminAddress("localhost:10046")
}
rpcUsers = [[ user: "user1", "password": "test", "permissions": ["ALL"]]]
}
node {
name "O=Manufacturer,L=New York,C=US"
p2pPort 10006
rpcSettings {
address("localhost:10009")
adminAddress("localhost:10049")
}
rpcUsers = [[ user: "user1", "password": "test", "permissions": ["ALL"]]]
}
node {
name "O=HDFC,L=New York,C=US"
p2pPort 10008
rpcSettings {
address("localhost:10012")
adminAddress("localhost:10052")
}
rpcUsers = [[ user: "user1", "password": "test", "permissions": ["ALL"]]]
}
}
You seem to be getting a port binding issue, which means the ports 10046 and 10006 are already in use in your system.
Either change the ports in your node config block in the build.gradle file, or kill the processes running in your port.
Linux
Use below command to find information about process bind to a particular port.
lsof -i :<portNumber>
Use below command to kill the process.
kill <process_id>
Windows
If you are on windows see this SO post to find a kill process on a port: How can you find out which process is listening on a port on Windows?
Always remember to shutdown your nodes properly by typing bye inside each node terminal (including the notary); otherwise you'll run into your current problem (some Java process is still allocating a port that you require for a certain node).
Personally I don't like using runNodes command and its XTerm window; I prefer to do the following:
Browse to a certain node: cd /path-to-project/build/nodes/PartyA
Start the node: java -jar corda.jar
To shutdown the node: bye
Related
Problem:
I am trying Corda official documentation hello word application. After Deploying CorDapp I issued
start IOUFlow iouValue: 99, otherParty: "O=PartyB,L=New York,C=US"
This command on Party A. After doing that I tried to check the ledger state by issuing this command on Party A and B.
run vaultQuery contractStateType: com.template.states.IOUState
But it gives the same output as the notary like this.
states: []
statesMetadata: []
totalStatesAvailable: -1
stateTypes: "UNCONSUMED"
otherResults: []
But Output should be like this.
states:
- state:
data:
value: 99
lender: "C=GB,L=London,O=PartyA"
borrower: "C=US,L=New York,O=PartyB"
participants:
- "C=GB,L=London,O=PartyA"
- "C=US,L=New York,O=PartyB"
contract: "com.template.contract.IOUContract"
notary: "C=GB,L=London,O=Notary"
encumbrance: null
constraint:
attachmentId: "F578320232CAB87BB1E919F3E5DB9D81B7346F9D7EA6D9155DC0F7BA8E472552"
ref:
txhash: "5CED068E790A347B0DD1C6BB5B2B463406807F95E080037208627565E6A2103B"
index: 0
statesMetadata:
- ref:
txhash: "5CED068E790A347B0DD1C6BB5B2B463406807F95E080037208627565E6A2103B"
index: 0
contractStateClassName: "com.template.state.IOUState"
recordedTime: 1506415268.875000000
consumedTime: null
status: "UNCONSUMED"
notary: "C=GB,L=London,O=Notary"
lockId: null
lockUpdateTime: 1506415269.548000000
totalStatesAvailable: -1
stateTypes: "UNCONSUMED"
otherResults: []
This is my build.gradle task deployNodes.
task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
nodeDefaults {
projectCordapp {
deploy = true
}
cordapp project(':contracts')
cordapp project(':workflows')
}
directory "./build/nodes"
node {
name "O=Notary,L=London,C=GB"
notary = [validating : true]
p2pPort 10002
rpcSettings {
address("localhost:10003")
adminAddress("localhost:10043")
}
}
node {
name "O=PartyA,L=London,C=GB"
p2pPort 10005
rpcSettings {
address("localhost:10006")
adminAddress("localhost:10046")
}
rpcUsers = [[ user: "user1", "password": "test", "permissions": ["ALL"]]]
}
node {
name "O=PartyB,L=New York,C=US"
p2pPort 10008
rpcSettings {
address("localhost:10009")
adminAddress("localhost:10049")
}
rpcUsers = [[ user: "user1", "password": "test", "permissions": ["ALL"]]]
}
}
I tried a lot to find out a solution to this problem on the internet but I was unable to do so as I am a newcomer to Corda. Can someone help me to solve this issue? Thank you very much.
If you didn't get anything on the screen, then the flow didn't complete.
Check the logs of your nodes (inside build/nodes/PartyA/logs).
You can also start the node in debug mode (https://docs.corda.net/node-commandline.html#enabling-remote-debugging) and put breakpoints on your code to see where it's failing.
I have created a 3 node Corda network on a Linux instance and can initiate and complete flows between the 3 nodes of the network. However when I added a 4th node to the network on the same Linux Instance, any of the nodes in the existing network are unable to complete flows with the 4th node.
Here is the configuration of an existing node:
myLegalName="O=PartyA,L=Mumbai,C=IN"
p2pAddress="198.136.234.245:10005"
rpcSettings {
address="localhost:10006"
adminAddress="localhost:10046"
}
rpcUsers=[
{
password=test
permissions=[
ALL
]
user=user1
}
]
dataSourceProperties = {
dataSourceClassName = "org.postgresql.ds.PGSimpleDataSource"
"dataSource.url" = "jdbc:postgresql://10.0.0.4:5432/postgres"
"dataSource.user" = test2
"dataSource.password" = test2p
}
database = {
transactionIsolationLevel = READ_COMMITTED
schema = test2
}
jarDirs = ['/home/ubuntu/java/postgres']
webAddress="198.136.234.245:10007"
Here is the configuration of a newly added node:
myLegalName="O=PartyB,L=Delhi,C=IN"
p2pAddress="198.136.234.245:10014"
rpcSettings {
address="localhost:10015"
adminAddress="localhost:10055"
}
rpcUsers=[
{
password=test
permissions=[
ALL
]
user=user1
}
]
dataSourceProperties = {
dataSourceClassName = "org.postgresql.ds.PGSimpleDataSource"
"dataSource.url" = "jdbc:postgresql://10.0.0.4:5432/postgres"
"dataSource.user" = test5
"dataSource.password" = test5p
}
database = {
transactionIsolationLevel = READ_COMMITTED
schema = test5
}
jarDirs = ['/home/ubuntu/java/postgres']
webAddress="198.136.234.245:10016"
Here's the message in PartyA's log file:
[INFO ] 2019-07-05T13:27:02,457Z [Node thread-1] flow.[ae2549c0-9bfd-4226-9625-653bc79322b0].initiateSession - Initiating flow session with party O=PartyB, L=Delhi, C=IN. Session id for tracing purposes is SessionId(toLong=5939067804807479907). {}
[INFO ] 2019-07-05T13:27:14,277Z [nioEventLoopGroup-2-4] netty.AMQPClient.operationComplete - Failed to connect to 198.136.234.245:10014 {}
...
[INFO ] 2019-07-05T13:27:15,278Z [nioEventLoopGroup-2-5] netty.AMQPClient.run - Retry connect to 198.136.234.245:10014 {}
deployNodes bootstraps the network. In short, the generated nodes know about each other and nothing else. Adding a new node to the network without running deployNodes will leave the original nodes communicating with each other but they will not see the new node. The new node will also not see the original nodes.
To resolve this, you can rebuild your network using deployNodes.
Or, you will need a network map which will handle the distribution of identities as nodes join the network. An implementation can be found here.
In Corda 3, using Cash with a mock network throws the following error: Please register the entity <ENTITY_NAME>
Am getting an error while accessing the cash-balance api in Obligation cordapp-newrelease-NEW. Which file have to edit inorder to overcome error shown below.
Please register the entity 'net.corda.finance.schemas.CashSchemaV1'
See https://docs.corda.net/api-persistence.html#custom-schema-registration for more information
you need to add the corda-finance module/CorDapp to you node. If you are using deploy nodes use something like the code below
node {
name "O=PartyA,L=London,C=GB"
p2pPort 10002
rpcSettings {
address("localhost:10006")
adminAddress("localhost:10046")
}
rpcUsers = [[user: "user1", "password": "test", "permissions": ["ALL"]]]
cordapps = [
"$project.group:cordapp-contracts-states:$project.version",
"$project.group:cordapp:$project.version",
"$corda_release_group:corda-finance:$corda_release_version"
]
}
Facing this error when trying to connect Corda v3.3 to SQL server 2017.
Could not find method dataSourceProperties() for arguments [build_b58g7zpxmgi2o4qynsvg23rrl$_run_closure7$_closure18$_closure22#6e5d745d] on object of type
net.corda.plugins.Node.
deployNodes code snippet is
dataSourceProperties {
dataSourceClassName ("com.microsoft.sqlserver.jdbc.SQLServerDataSource")
dataSource.url ("jdbc:sqlserver://localhost:1433;databaseName=testdb")
dataSource.user (testuser)
dataSource.password (123)
}
database {
transactionIsolationLevel (READ_COMMITTED)
}
jarDirs = [".../Microsoft JDBC Driver 6.2 for SQL Server/sqljdbc_6.2/enu/"]
You are confusing the syntax of deployNodes with the syntax of the node.conf node configuration file.
If you want to add additional configuration options in deployNodes that will be copied to the node's node.conf file, you need to use extraConfig, as follows:
task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
directory "./build/nodes"
node {
name "O=PartyA,L=London,C=GB"
p2pPort 10007
rpcSettings {
address("localhost:10008")
adminAddress("localhost:10048")
}
cordapps = ["$corda_release_group:corda-finance:$corda_release_version"]
rpcUsers = [[user: "user1", "password": "test", "permissions": ["ALL"]]]
extraConfig = [
dataSourceProperties: [
dataSourceClassName: 'com.microsoft.sqlserver.jdbc.SQLServerDataSource',
dataSource : [
url : 'jdbc:sqlserver://localhost:1433;databaseName=testdb',
user : 'testuser',
password: '123'
]
],
database : [transactionIsolationLevel: 'READ_COMMITTED'],
jarDirs : ['.../Microsoft JDBC Driver 6.2 for SQL Server/sqljdbc_6.2/enu/']
]
}
}
I have cloned the corda-training-template repo and had wanted to test signature constraints in Corda v4.x. Rather than getting a test key to sign the jar, I would go for the default corda dev key for convenience. However my understanding is that corda dev key is used as default if you don't put in any custom credentials, so that all jars are signed with it. However it keep printing out the error message during build as:
* What went wrong:
Execution failed for task ':kotlin-source:jar'. > Exception while signing kotlin-source-0.1.jar, ensure the 'cordapp.signing.options' entry contains correct keyStore configuration, or disable signing by 'cordapp.signing.enabled false'. Run with --info or --debug option and search for 'ant:signjar' in log output.
The following is the original build.gradle for the kotlin-source with signing enable false removed:
repositories {
mavenLocal()
jcenter()
mavenCentral()
maven { url 'https://dl.bintray.com/kotlin/exposed' }
maven { url 'https://jitpack.io' }
maven { url 'https://ci-artifactory.corda.r3cev.com/artifactory/corda-releases' }
}
apply plugin: 'kotlin'
apply plugin: 'idea'
apply plugin: 'net.corda.plugins.cordapp'
apply plugin: 'net.corda.plugins.publish-utils'
apply plugin: 'net.corda.plugins.cordformation'
apply plugin: 'net.corda.plugins.quasar-utils'
apply plugin: 'maven-publish'
cordapp {
targetPlatformVersion 4
minimumPlatformVersion 3
contract {
name "Corda Training Material"
vendor "R3"
licence "Contact R3 for Kotlin Source Contract License."
versionId 1
}
workflow {
name "Corda Training Material"
vendor "R3"
licence "Contact R3 for Kotlin Source Workflow License."
versionId 1
}
}
sourceSets {
main {
resources {
srcDir "../config/dev"
}
}
test {
resources {
srcDir "../config/test"
}
}
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
testCompile "junit:junit:$junit_version"
// Corda integration dependencies
cordaCompile "$corda_release_distribution:corda-core:$corda_release_version"
cordaCompile "$corda_release_distribution:corda-finance-contracts:$corda_release_version"
cordaCompile "$corda_release_distribution:corda-finance-workflows:$corda_release_version"
cordaCompile "$corda_release_distribution:corda-jackson:$corda_release_version"
cordaCompile "$corda_release_distribution:corda-rpc:$corda_release_version"
cordaCompile "$corda_release_distribution:corda-node-api:$corda_release_version"
cordaCompile "$corda_release_distribution:corda-webserver-impl:$corda_release_version"
cordaRuntime "$corda_release_distribution:corda:$corda_release_version"
cordaRuntime "$corda_release_distribution:corda-webserver:$corda_release_version"
testCompile "$corda_release_distribution:corda-test-utils:$corda_release_version"
testCompile "$corda_release_distribution:corda-node-driver:$corda_release_version"
// GraphStream: For visualisation (required by TemplateClientRPC app)
compile "org.graphstream:gs-core:1.3"
compile("org.graphstream:gs-ui:1.3") {
exclude group: "bouncycastle"
}
// CorDapp dependencies
// Specify your cordapp's dependencies below, including dependent cordapps
cordapp "$corda_release_distribution:corda-finance-contracts:$corda_release_version"
cordapp "$corda_release_distribution:corda-finance-workflows:$corda_release_version"
cordapp "$corda_release_distribution:corda-confidential-identities:$corda_release_version"
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
languageVersion = "1.2"
apiVersion = "1.2"
jvmTarget = "1.8"
javaParameters = true // Useful for reflection.
}
}
task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
delete "./build/nodes"
directory "./build/nodes"
nodeDefaults {
cordapp("$corda_release_distribution:corda-finance-contracts:$corda_release_version")
cordapp("$corda_release_distribution:corda-finance-workflows:$corda_release_version")
cordapp("$corda_release_distribution:corda-confidential-identities:$corda_release_version")
rpcUsers = [[ user: "user1", "password": "password", "permissions": ["ALL"]]]
}
node {
name "O=Notary,L=London,C=GB"
notary = [validating: false]
p2pPort 10002
rpcSettings {
useSsl false
standAloneBroker false
address "0.0.0.0:10003"
adminAddress "0.0.0.0:10103"
}
}
node {
name "O=ParticipantA,L=London,C=GB"
p2pPort 10007
webPort 10009
rpcSettings {
useSsl false
standAloneBroker false
address "0.0.0.0:10008"
adminAddress "0.0.0.0:10108"
}
}
node {
name "O=ParticipantB,L=New York,C=US"
p2pPort 10010
webPort 10012
rpcSettings {
useSsl false
standAloneBroker false
address "0.0.0.0:10011"
adminAddress "0.0.0.0:10111"
}
}
node {
name "O=ParticipantC,L=Paris,C=FR"
p2pPort 10013
webPort 10015
rpcSettings {
useSsl false
standAloneBroker false
address "0.0.0.0:10014"
adminAddress "0.0.0.0:10114"
}
}
}
idea {
module {
downloadJavadoc = true // defaults to false
downloadSources = true
}
}
In response to the error message, i have added the following to the build.gradle under both cordapp (https://docs.corda.net/releases/release-V4.0/cordapp-build-systems.html#signing-the-cordapp-jar) and deployNodes (https://docs.corda.net/releases/release-V4.0/generating-a-node.html#signing-cordapp-jars) task in different permutations but the same error message asking for right keystore configuration keeps showing up:
signing {
enabled true
options {
keystore
alias
storepass
storetype
keyalg
}
}
Without the mentioning about the credentials of the keystore or even specifying signing options, corda should build the jar with the default corda dev keys, but it isn't the case.
For a start the error message is misleading and doesn't say exactly what is happening within the java jarsigner tool (see ant signjar). Instead there is a likelihood that there is a problem with the jar such that jarsigner is unable to sign. SignJar.kt (Line 23 to 24) from the corda core plugin throws a generic error message when it encounters an error, so one would need to run the jar tasks with either --info or --debug mode, followed by scanning the messages for [ant:signjar].
In my encounter following running the jar signing task with --debug mode, showed an error message of the following:
01:00:15.040 [INFO] [org.gradle.api.internal.project.ant.AntLoggingAdapter] [ant:signjar] jarsigner: unable to sign jar: java.util.zip.ZipException: duplicate entry: META-INF/LICENSE.txt
Likely the problem is while trying to fatjar (with other libs), the license files from other jars are causing a conflict. The resolution in my case is to exclude the license file from my build. Add the following to the build.gradle jar task.
jar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
After i have build the jar, I used the jarsigner tool (include in your JDK) to verify if the jar has been signed.
jarsigner -verify <your jar.file name>
If its signed, it will output the following:
jar verified.
Warning:
This jar contains entries whose certificate chain is not validated.
This jar contains entries whose signer certificate will expire within six months.
This jar contains signatures that does not include a timestamp. Without a timestamp, users may not be able to validate this jar after the signer certificate's expiration date (2019-11-26) or after any future revocation date.
Re-run with the -verbose and -certs options for more details.