Corda - postgres 数据库驱动程序 (postgresql-42.2.8.jar) 丢失

tej*_*rab 0 java postgresql postgresql-9.6 corda

我使用corda 4.5gradle插件版本为5.0.10postgres作为我的数据库。当我尝试运行deployNodes任务时,出现以下错误:

[ERROR] 15:51:47+0530 [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]
Run Code Online (Sandbox Code Playgroud)

以下是build.gradle文件中的deployNode任务代码:

    task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
    nodeDefaults {
        projectCordapp {
            deploy = false
        }
        cordapp "$confidential_id_release_group:ci-workflows:$confidential_id_release_version"
        cordapp "$accounts_release_group:accounts-contracts:$accounts_release_version"
        cordapp "$accounts_release_group:accounts-workflows:$accounts_release_version"

        cordapp project(':cordapp-contracts-states')
        cordapp project(':workflows')

        //ext.drivers = ['${rootProject.projectDir}/lib/postgresql-42.2.8.jar']
    }

    //NOTARY NODE

    node {
        name "O=Notary,L=London,C=GB"
        notary = [validating: true]
        p2pAddress("localhost:10002")
        rpcSettings {
            address("localhost:10003")
            adminAddress("localhost:10043")
        }
    }

    // NODEA

    node {
        name "O=NODEA,L=Lucknow,C=IN"

        p2pAddress("localhost:10010")
        rpcSettings {
            address("localhost:10011")
            adminAddress("localhost:10052")
        }
        rpcUsers = [[user: "userA", "password": "user123", "permissions": ["ALL"]]]
        //new DB config
        //DB
        extraConfig = [
                'dataSourceProperties.dataSource.url' : 'jdbc:postgresql://localhost:5432/egdb?currentSchema=nodeA_schema',
                'dataSourceProperties.dataSourceClassName' : 'org.postgresql.ds.PGSimpleDataSource',
                'dataSourceProperties.dataSource.user' : 'postgres',
                'dataSourceProperties.dataSource.password' : 'postgres',
                //'dataSourceProperties.driverClassName' : 'org.postgresql.ds.PGSimpleDataSource'
                //jarDirs = ['${rootProject.projectDir}/lib/postgresql-42.2.8.jar']
                //'drivers' : 'org.postgresql.Driver'
                'jarDirs' : ['${rootProject.projectDir}/lib/jdbc/driver/postgresql-42.2.8.jar']
        ]
        //jarDirs = ['${rootProject.projectDir}/lib/postgresql-42.2.8.jar']
        //drivers = ext.drivers

    }

// NODEB
 node {
        name "O=NODEB,L=Delhi,C=IN"

        p2pAddress("localhost:10010")
        rpcSettings {
            address("localhost:10011")
            adminAddress("localhost:10052")
        }
        rpcUsers = [[user: "userB", "password": "user123", "permissions": ["ALL"]]]
        //new DB config
        //DB
        extraConfig = [
                'dataSourceProperties.dataSource.url' : 'jdbc:postgresql://localhost:5432/egdb?currentSchema=nodeB_schema',
                'dataSourceProperties.dataSourceClassName' : 'org.postgresql.ds.PGSimpleDataSource',
                'dataSourceProperties.dataSource.user' : 'postgres',
                'dataSourceProperties.dataSource.password' : 'postgres',
                //'dataSourceProperties.driverClassName' : 'org.postgresql.ds.PGSimpleDataSource'
                //jarDirs = ['${rootProject.projectDir}/lib/postgresql-42.2.8.jar']
                //'drivers' : 'org.postgresql.Driver'
                'jarDirs' : ['${rootProject.projectDir}/lib/jdbc/driver/postgresql-42.2.8.jar']
        ]
        //jarDirs = ['${rootProject.projectDir}/lib/postgresql-42.2.8.jar']
        //drivers = ext.drivers

    }
}
Run Code Online (Sandbox Code Playgroud)

如何在build.gradle文件中添加postgresql jdbc驱动程序路径?与 corda 4.5 兼容的 postgresql 版本是什么?

tej*_*rab 5

它通过在依赖项build.gradle部分的文件中添加以下行解决了我的问题:

cordaDriver "org.postgresql:postgresql:42.2.8"
Run Code Online (Sandbox Code Playgroud)