Joaquim Oliveira
Joaquim Oliveira

Reputation: 1218

How to configure JDBC drivers dir in Corda Network Bootstrapper?

I'm using Corda Network Bootstrapper to setup a local Corda network using Docker, and trying to configure PostgreSQL as the database.

devMode=true
myLegalName="O=PartyA,L=Paris,C=FR"
p2pAddress="partya:10200"
rpcSettings {
  address="0.0.0.0:10201"
  adminAddress="0.0.0.0:10202"
}
dataSourceProperties = {
    dataSourceClassName = "org.postgresql.ds.PGSimpleDataSource"
    dataSource.url = "jdbc:postgresql://pg_partya:5432/db_partya"
    dataSource.user = "pg_user"
    dataSource.password = "pg_secret"
}
database = {
    transactionIsolationLevel = READ_COMMITTED
}
jarDirs=["shared/drivers"]
security {
  authService {
    dataSource {
      type=INMEMORY
      users=[
        {
          password=test
          permissions=[
            ALL
          ]
          user=user1
        }
      ]
    }
  }
}
sshd {
  port = 2222
}

I get the following error:

[ERROR] 15:51:24-0300 [main] internal.NodeStartupLogging. - Could not find the database driver class. Please add it to the drivers directory. [Error Code: database-missing-driver For further information, please go to https://docs.corda.net/docs/corda-os/4.5/error-codes.html] - Could not find the database driver class. Please add it to the 'drivers' folder. [errorCode=1oswgkz, moreInformationAt=https://errors.corda.net/OS/4.5/1oswgkz]
... still waiting. If this is taking longer than usual, check the node logs.

[EDIT] The JDBC driver is mapped as a volume in docker-compose:

    volumes:
      - ./partya_node.conf:/etc/corda/node.conf
      - ./partya/certificates:/opt/corda/certificates
      - ./partya/persistence:/opt/corda/persistence
      - ./partya/logs:/opt/corda/logs
      - ./shared/cordapps:/opt/corda/cordapps
      - ./shared/node-infos:/opt/corda/additional-node-infos
      - ./shared/network-parameters:/opt/corda/network-parameters
      - ./shared/drivers/postgresql-42.2.14.jar:/opt/corda/drivers/postgresql-42.2.14.jar

Is it possible to configure Corda Network Bootstrapper to point to a driver's dir?

Upvotes: 0

Views: 320

Answers (1)

Ashutosh Meher
Ashutosh Meher

Reputation: 1841

I believe you haven't mounted the driver directory properly to the docker container, which may be the reason why the node is unable to find the driver.

You could mount the driver to /opt/corda/drivers directory on the Corda docker container, and point to it in the node.conf file using jarDirs=["opt/corda/drivers"].

The shared directory you are referring to I guess is the directory on your host machine which the docker container can't access till its mounted to a certain location in the docker container.

Update Based On Comment:

You need to update the driver directory path. The node.conf file gets copied to the individual node folder and the copied file is referred while running the bootstrapper. So you just need to update the jarDirs in node.conf to jarDirs=["../shared/drivers"], assuming the shared directory is in the same directory as the bootstrapper jar and the initial node.conf files.

Upvotes: 2

Related Questions