Corda 5 - Developer Preview 2 is shipped!

For developers, Corda 5 is an accessible toolbox with well-defined layers that enables you to create solutions. It does not force complexity or concepts but gives a streamlined iteration for the testing and development loop. It is supported by RESTful APIs

As an operator of a network, Corda 5 places the control in your hands, acknowledging that the rules governing access to a network are best set and managed by you. Deployments can match the scale of the problem and then grow and adapt as it changes. It is cloud-native; behaving as any other modern application, with the tooling to match.

:open_book: Introduction
:star2: Getting started
:computer: Developing
:arrows_clockwise: Deploying and operating
:briefcase: Use cases
:spiral_notepad: Release notes

I have just followed the steps for setting up Corda 5 DP2, here is my feedback particularly around the ease of setting up the environment and make it up and running

  1. After following all the steps, pre requisite installation, corda-cli installation, csde setup
    First thing, when I opened up MyFirstFlow.kt for all corda classes which are being used in first flow it was showing Unresolved reference even after all dev preview classes were there in intellij project external libraries

  2. I did buildCPI task it was showing success, then I did startCorda it was showing success but when I tried to access the swagger it didn’t open up I checked the corda.log in logs folder, found that it was showing connection refused error for postgres and I was assuming the startCorda might spin off postgres container but didn’t see that either in docker desktop

  3. One another thing that I wanted to ask was as part of DP1, we were asked to install corda-node-cli and cordapp-builder however I didn’t see any mention of them in DP2 so I removed them from .corda folder

Regarding points 2 & 3

  1. The startCorda task should start a Postgresql container.
    Some reasons why the postgres container failed to start include
  • the Docker daemon not completing start up
  • not having access the to the docker hub repository.
  1. corda-node-cli and cordapp-builder are not required for Corda 5 DP2
1 Like

To add on point 2: You have to wait a while after the startCorda task shows as complete before the cluster is ready to accept http calls. You can test if the cluster is up and running by clicking the listVNodes task, if it’s running it will complete successfully, but show no nodes. If the cluster is not up yet it will throw an Connection refused (Connection refused) error. Keep poling it every 10 seconds or so and it should come up in around a minute.

If its not working, follow the reseting CSDE instructions shown here: reset-csde and try again.

1 Like

On point 1 - can you try to build using ./gradlew build and post the error messages here.

(Also, make sure you are using Java 11, not 8)

1 Like

I did follow the steps for reset-csde and then executed the startCorda task and found below error in logs. (I was denied file upload being a new user so have to copy the logs here.)

The other thing that I noticed that postgres container didn’t come up, am on windows machine and I have seen couple of threads where postgres docker image does give issue on windows. Tried couple of things to run postgres image in isolation just to see if that container is coming up by defining a volume and then attaching the volume when I am trying to bring up the container. Also, I changed the option to ‘Switch to Linux Containers’ in docker desktop but nothing worked out.

2022-10-05 23:34:48.380 [main] INFO  net.corda.securitymanager.internal.SecurityManagerServiceImpl - Starting restrictive Corda security manager.
2022-10-05 23:34:48.497 [main] INFO  net.corda.securitymanager.internal.SecurityManagerServiceImpl - Applying default security policy (high_security.policy)
2022-10-05 23:34:58.668 [main] INFO  net.corda.securitymanager.internal.SecurityConfigHandlerImpl - SecurityConfigHandler started
2022-10-05 23:35:09.173 [main] WARN  net.corda.osgi.framework.OSGiFrameworkWrap - OSGi bundle bundles/quasar-core-osgi-0.8.8_r3-framework-extension.jar ID = 18 co.paralleluniverse.quasar-core.framework.extension 0.8.8.r3 resolved activation time-out after 0 ms.
2022-10-05 23:35:09.173 [main] WARN  net.corda.osgi.framework.OSGiFrameworkWrap - OSGi bundle bundles/corda-avro-schema-5.0.0.190-DevPreview-2.jar ID = 210 net.corda.avro-schema 5.0.0.190-DevPreview-2 resolved activation time-out after 0 ms.
2022-10-05 23:35:09.173 [main] WARN  net.corda.osgi.framework.OSGiFrameworkWrap - OSGi bundle bundles/org.apache.aries.spifly.dynamic.framework.extension-1.3.5.jar ID = 238 org.apache.aries.spifly.dynamic.framework.extension 1.3.5 resolved activation time-out after 0 ms.
2022-10-05 23:35:09.173 [main] WARN  net.corda.osgi.framework.OSGiFrameworkWrap - OSGi bundle bundles/org.apache.felix.framework.security-2.8.3.jar ID = 245 org.apache.felix.framework.security 2.8.3 resolved activation time-out after 0 ms.
2022-10-05 23:35:09.272 [main] INFO  net.corda.layeredpropertymap.impl.LayeredPropertyMapFactoryImpl - Loaded custom property converters: [net.corda.ledger.consensual.impl.converter.PartyConverter, net.corda.crypto.impl.converter.PublicKeyConverter, net.corda.crypto.impl.converter.PublicKeyHashConverter, net.corda.membership.lib.impl.converter.EndpointInfoConverter]
2022-10-05 23:35:09.809 [main] WARN  net.corda.libs.configuration.SmartConfigFactory - Secrets Provider not found from config: {}

2022-10-05 23:35:09.809 [main] WARN  net.corda.libs.configuration.SmartConfigFactory - Falling back on MaskedSecretsLookupService. This means secrets configuration will not be supported and all configurationvalues that are marked as "configSecret" will return "*****" when resolved.
2022-10-05 23:35:10.824 [main] INFO  net.corda.applications.workers.combined.CombinedWorker - Combined worker starting.
2022-10-05 23:35:10.824 [main] INFO  net.corda.applications.workers.combined.CombinedWorker - Quasar's instrumentation verification is enabled
2022-10-05 23:35:11.174 [main] INFO  net.corda.libs.configuration.validation.impl.ConfigurationValidatorImpl - Configuration to validate: {"crypto":{"hsmId":"SOFT"},"db":{"params":{"database":{"jdbc":{"directory":"C:\\Users\\ashwani.kumar02/.corda/corda5/jdbcDrivers","url":"jdbc:postgresql://localhost:5432/cordacluster"},"pass":"password","user":"user"}}},"dir":{"tmp":"C:\\Users\\ASHWAN~1.KUM\\AppData\\Local\\Temp\\/corda/tmp","workspace":"C:\\Users\\ASHWAN~1.KUM\\AppData\\Local\\Temp\\/corda/workspace"},"instanceId":0,"kafka":{"common":{"bus":{"busType":"DATABASE"}}},"topicPrefix":""}
2022-10-05 23:35:11.288 [main] INFO  net.corda.libs.configuration.validation.impl.ConfigurationValidatorImpl - Schema to validate against: "#" : {"$schema":"http://json-schema.org/draft-07/schema#","$id":"https://corda.r3.com/net/corda/schema/configuration/boot/1.0/corda.boot.json","title":"Corda Boot Configuration Schema","description":"Configuration schema for the boot config. This configures stores the values the worker is bootstrapped with.","type":"object","properties":{"instanceId":{"description":"Unique ID for this worker.","type":"integer","minimum":0},"topicPrefix":{"description":"Topic prefix to apply when connecting to topics.","type":"string","default":""},"kafka":{"description":"Configuration options specific to kafka backend.","properties":{"common":{"description":"Kafka properties that are common between consumers and producers, e.g. connection details, security settings.","type":"object"}}},"crypto":{"description":"Configuration options specific to crypto worker.","type":"object","properties":{}},"db":{"description":"Configuration options related to database.","properties":{"params":{"description":"Additional db params the worker is bootstrapped with.","type":"object"},"jdbcUrl":{"description":"The JDBC database URL","type":["string","null"]},"user":{"description":"Cluster admin username to connect to the database with.","type":["string","null"]},"pass":{"description":"Cluster admin password to connect to the database with.","type":["string","null"]}},"additionalProperties":false},"dir":{"description":"Configuration for file system directories.","properties":{"workspace":{"description":"Local workspace directory","type":["string"]},"tmp":{"description":"Tmp directory","type":["string"]},"pass":{"description":"Cluster admin password to connect to the database with.","type":["string"]}},"additionalProperties":false}},"additionalProperties":false}
2022-10-05 23:35:13.608 [main] INFO  net.corda.applications.workers.combined.CombinedWorker - Combined worker stopping.
2022-10-05 23:35:13.608 [main] INFO  net.corda.processors.crypto.internal.CryptoProcessorImpl - Crypto processor stopping.
2022-10-05 23:35:13.608 [main] INFO  net.corda.processors.uniqueness.internal.UniquenessProcessorImpl - Uniqueness processor stopping.
2022-10-05 23:35:13.608 [main] INFO  net.corda.processors.db.internal.DBProcessorImpl - DB processor stopping.
2022-10-05 23:35:13.608 [main] INFO  net.corda.processors.flow.internal.FlowProcessorImpl - Flow processor stopping.
2022-10-05 23:35:13.608 [main] INFO  net.corda.processors.rpc.internal.RPCProcessorImpl - RPC processor stopping.
2022-10-05 23:35:13.608 [main] INFO  net.corda.processors.p2p.linkmanager.internal.LinkManagerProcessorImpl - Link manager processor stopping.
2022-10-05 23:35:13.608 [main] INFO  net.corda.processors.p2p.gateway.internal.GatewayProcessorImpl - Gateway processor stopping.
2022-10-05 23:35:13.608 [main] ERROR net.corda.osgi.framework.OSGiFrameworkMain - Error: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
org.postgresql.util.PSQLException: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
	at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:319) ~[?:?]
	at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49) ~[?:?]
	at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:247) ~[?:?]
	at org.postgresql.Driver.makeConnection(Driver.java:434) ~[?:?]
	at org.postgresql.Driver.connect(Driver.java:291) ~[?:?]
	at java.sql.DriverManager.getConnection(DriverManager.java:677) ~[java.sql:?]
	at java.sql.DriverManager.getConnection(DriverManager.java:228) ~[java.sql:?]
	at org.postgresql.ds.common.BaseDataSource.getConnection(BaseDataSource.java:103) ~[?:?]
	at org.postgresql.ds.common.BaseDataSource.getConnection(BaseDataSource.java:87) ~[?:?]
	at net.corda.application.dbsetup.PostgresDbSetup.superUserConnection(PostgresDbSetup.kt:80) ~[?:?]
	at net.corda.application.dbsetup.PostgresDbSetup.dbInitialised(PostgresDbSetup.kt:86) ~[?:?]
	at net.corda.application.dbsetup.PostgresDbSetup.run(PostgresDbSetup.kt:65) ~[?:?]
	at net.corda.applications.workers.combined.CombinedWorker.startup(CombinedWorker.kt:111) ~[?:?]
	at net.corda.osgi.framework.OSGiFrameworkWrap.startApplication(OSGiFrameworkWrap.java:592) ~[corda-combined-worker-5.0.0.0-DevPreview-2.jar:?]
	at net.corda.osgi.framework.OSGiFrameworkMain.main(OSGiFrameworkMain.java:174) ~[corda-combined-worker-5.0.0.0-DevPreview-2.jar:?]
Caused by: java.net.ConnectException: Connection refused: connect
	at java.net.PlainSocketImpl.waitForConnect(Native Method) ~[?:?]
	at java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:107) ~[?:?]
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:412) ~[?:?]
	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:255) ~[?:?]
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:237) ~[?:?]
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[?:?]
	at java.net.Socket.connect(Socket.java:608) ~[?:?]
	at org.postgresql.core.PGStream.createSocket(PGStream.java:241) ~[?:?]
	at org.postgresql.core.PGStream.<init>(PGStream.java:98) ~[?:?]
	at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:109) ~[?:?]
	at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:235) ~[?:?]
	... 14 more
2022-10-05 23:35:13.623 [shutdown] INFO  net.corda.applications.workers.combined.CombinedWorker - Combined worker stopping.
2022-10-05 23:35:13.623 [shutdown] INFO  net.corda.processors.crypto.internal.CryptoProcessorImpl - Crypto processor stopping.
2022-10-05 23:35:13.623 [shutdown] INFO  net.corda.processors.uniqueness.internal.UniquenessProcessorImpl - Uniqueness processor stopping.
2022-10-05 23:35:13.623 [shutdown] INFO  net.corda.processors.db.internal.DBProcessorImpl - DB processor stopping.
2022-10-05 23:35:13.623 [shutdown] INFO  net.corda.processors.flow.internal.FlowProcessorImpl - Flow processor stopping.
2022-10-05 23:35:13.623 [shutdown] INFO  net.corda.processors.rpc.internal.RPCProcessorImpl - RPC processor stopping.
2022-10-05 23:35:13.623 [shutdown] INFO  net.corda.processors.p2p.linkmanager.internal.LinkManagerProcessorImpl - Link manager processor stopping.
2022-10-05 23:35:13.623 [shutdown] INFO  net.corda.processors.p2p.gateway.internal.GatewayProcessorImpl - Gateway processor stopping.

I do have a docker hub account and I noticed that I haven’t signed in so just to avoid any confusion, I did sign in as well.

Thanks for confirming on Point 3, I have removed those folders as part of DP2 setup

Yes, I am using Java 11 (OpenJDK Version 11.0.13) and following is the output

PS C:\Projects\R3\Corda 5\cordapps\CSDE-cordapp-template-kotlin> ./gradlew build

BUILD SUCCESSFUL in 21s

I think your database user name and password are not corrrect. looking at this log line:

2022-10-05 23:35:11.174 [main] INFO net.corda.libs.configuration.validation.impl.ConfigurationValidatorImpl - Configuration to validate: {“crypto”:{“hsmId”:“SOFT”},“db”:{“params”:{“database”:{“jdbc”:{“directory”:“C:\Users\ashwani.kumar02/.corda/corda5/jdbcDrivers”,“url”:“jdbc:postgresql://localhost:5432/cordacluster”},“pass”:“password”,“user”:“user”}}},“dir”:{“tmp”:“C:\Users\ASHWAN~1.KUM\AppData\Local\Temp\/corda/tmp”,“workspace”:“C:\Users\ASHWAN~1.KUM\AppData\Local\Temp\/corda/workspace”},“instanceId”:0,“kafka”:{“common”:{“bus”:{“busType”:“DATABASE”}}},“topicPrefix”:“”}

This is the line we use to start the postgres container in startCorda gradle helper

        new ProcessBuilder(
                "docker",
                "run", "-d", "--rm",
                "-p", "5432:5432",
                "--name", dbContainerName,
                "-e", "POSTGRES_DB=cordacluster",
                "-e", "POSTGRES_USER=postgres",
                "-e", "POSTGRES_PASSWORD=password",
                "postgres:latest").start();

Try changing your configuration to use the above user name and password.

Could you post the command you used to start your postgres instance.