新的 corda 节点失败:用户“sa”的密码验证失败

新的 corda 节点失败:用户“sa”的密码验证失败

我使用 Docker Compose 配置了一个小型本地网络,其中包含一个公证节点和两个工作节点。当我为第三个节点复制完全相同的配置时,该节点的 Corda 进程将崩溃,如下所示:

atcorda    | [ERROR] 13:45:22+0000 [main] postgresql.Driver.connect - Connection error:
atcorda    |  org.postgresql.util.PSQLException: FATAL: password authentication failed for user "sa"
atcorda    |     at org.postgresql.Driver$ConnectThread.getResult(Driver.java:401) ~[postgresql-42.1.4.jar:42.1.4]
atcorda    |     at org.postgresql.Driver.connect(Driver.java:259) [postgresql-42.1.4.jar:42.1.4]
atcorda    |     at java.sql.DriverManager.getConnection(DriverManager.java:664) [?:1.8.0_181]
atcorda    |     at java.sql.DriverManager.getConnection(DriverManager.java:247) [?:1.8.0_181]
atcorda    |     at org.postgresql.ds.common.BaseDataSource.getConnection(BaseDataSource.java:94) [postgresql-42.1.4.jar:42.1.4]
atcorda    |     at org.postgresql.ds.common.BaseDataSource.getConnection(BaseDataSource.java:79) [postgresql-42.1.4.jar:42.1.4]
atcorda    |     at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:341) [HikariCP-2.5.1.jar:?]
atcorda    |     at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:506) [HikariCP-2.5.1.jar:?]
atcorda    |     at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:105) [HikariCP-2.5.1.jar:?]
atcorda    |     at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:71) [HikariCP-2.5.1.jar:?]
atcorda    |     at net.corda.node.internal.DataSourceFactory.createDataSource(DataSourceFactory.kt:38) [corda-node-3.3-corda.jar:?]
atcorda    |     at net.corda.node.internal.DataSourceFactory.createDataSource$default(DataSourceFactory.kt:35) [corda-node-3.3-corda.jar:?]
atcorda    |     at net.corda.node.internal.AbstractNodeKt.configureDatabase(AbstractNode.kt:927) [corda-node-3.3-corda.jar:?]
atcorda    |     at net.corda.node.internal.AbstractNode.initialiseDatabasePersistence(AbstractNode.kt:695) [corda-node-3.3-corda.jar:?]
atcorda    |     at net.corda.node.internal.Node.initialiseDatabasePersistence(Node.kt:347) [corda-node-3.3-corda.jar:?]
atcorda    |     at net.corda.node.internal.AbstractNode.start(AbstractNode.kt:207) [corda-node-3.3-corda.jar:?]
atcorda    |     at net.corda.node.internal.Node.start(Node.kt:361) [corda-node-3.3-corda.jar:?]
atcorda    |     at net.corda.node.internal.NodeStartup.startNode(NodeStartup.kt:203) [corda-node-3.3-corda.jar:?]
atcorda    |     at net.corda.node.internal.NodeStartup.run(NodeStartup.kt:126) [corda-node-3.3-corda.jar:?]
atcorda    |     at net.corda.node.Corda.main(Corda.kt:13) [corda-node-3.3-corda.jar:?]
atcorda    | [ERROR] 13:45:23+0000 [main] common.BaseDataSource.getConnection - Failed to create a Non-Pooling DataSource from PostgreSQL JDBC Driver 42.1.4 for sa at jdbc:postgresql://db:5432/atcorda?prepareThreshold=5&preparedStatementCacheQueries=256&preparedStatementCacheSizeMiB=5&databaseMetadataCacheFields=65536&databaseMetadataCacheFieldsMiB=5&defaultRowFetchSize=0&binaryTransfer=true&readOnly=false&binaryTransferEnable=&binaryTransferDisable=&unknownLength=2147483647&logUnclosedConnections=false&disableColumnSanitiser=false&tcpKeepAlive=false&loginTimeout=30&connectTimeout=10&socketTimeout=0&cancelSignalTimeout=10&receiveBufferSize=-1&sendBufferSize=-1&ApplicationName=PostgreSQL JDBC Driver&useSpnego=false&gsslib=auto&sspiServiceClass=POSTGRES&allowEncodingChanges=false&targetServerType=any&loadBalanceHosts=false&hostRecheckSeconds=10&preferQueryMode=extended&autosave=never&reWriteBatchedInserts=false: org.postgresql.util.PSQLException: FATAL: password authentication failed for user "sa"
atcorda    | [ERROR] 13:45:23+0000 [main] internal.Node.run - Exception during node startup
atcorda    |  com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: FATAL: password authentication failed for user "sa"
atcorda    |     at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:512) ~[HikariCP-2.5.1.jar:?]
atcorda    |     at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:105) ~[HikariCP-2.5.1.jar:?]
atcorda    |     at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:71) ~[HikariCP-2.5.1.jar:?]
atcorda    |     at net.corda.node.internal.DataSourceFactory.createDataSource(DataSourceFactory.kt:38) ~[corda-node-3.3-corda.jar:?]
atcorda    |     at net.corda.node.internal.DataSourceFactory.createDataSource$default(DataSourceFactory.kt:35) ~[corda-node-3.3-corda.jar:?]
atcorda    |     at net.corda.node.internal.AbstractNodeKt.configureDatabase(AbstractNode.kt:927) ~[corda-node-3.3-corda.jar:?]
atcorda    |     at net.corda.node.internal.AbstractNode.initialiseDatabasePersistence(AbstractNode.kt:695) ~[corda-node-3.3-corda.jar:?]
atcorda    |     at net.corda.node.internal.Node.initialiseDatabasePersistence(Node.kt:347) ~[corda-node-3.3-corda.jar:?]
atcorda    |     at net.corda.node.internal.AbstractNode.start(AbstractNode.kt:207) ~[corda-node-3.3-corda.jar:?]
atcorda    |     at net.corda.node.internal.Node.start(Node.kt:361) ~[corda-node-3.3-corda.jar:?]
atcorda    |     at net.corda.node.internal.NodeStartup.startNode(NodeStartup.kt:203) ~[corda-node-3.3-corda.jar:?]
atcorda    |     at net.corda.node.internal.NodeStartup.run(NodeStartup.kt:126) [corda-node-3.3-corda.jar:?]
atcorda    |     at net.corda.node.Corda.main(Corda.kt:13) [corda-node-3.3-corda.jar:?]
atcorda    | Caused by: org.postgresql.util.PSQLException: FATAL: password authentication failed for user "sa"
atcorda    |     at org.postgresql.Driver$ConnectThread.getResult(Driver.java:401) ~[postgresql-42.1.4.jar:42.1.4]
atcorda    |     at org.postgresql.Driver.connect(Driver.java:259) ~[postgresql-42.1.4.jar:42.1.4]
atcorda    |     at java.sql.DriverManager.getConnection(DriverManager.java:664) ~[?:1.8.0_181]
atcorda    |     at java.sql.DriverManager.getConnection(DriverManager.java:247) ~[?:1.8.0_181]
atcorda    |     at org.postgresql.ds.common.BaseDataSource.getConnection(BaseDataSource.java:94) ~[postgresql-42.1.4.jar:42.1.4]
atcorda    |     at org.postgresql.ds.common.BaseDataSource.getConnection(BaseDataSource.java:79) ~[postgresql-42.1.4.jar:42.1.4]
atcorda    |     at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:341) ~[HikariCP-2.5.1.jar:?]
atcorda    |     at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:506) ~[HikariCP-2.5.1.jar:?]
atcorda    |     ... 12 more

节点配置(由 Dockerform gradle 任务创建)如下(这是启动正常的工作节点的直接副本):

detectPublicIp=false
myLegalName="O=Atcorda,L=Wien,C=AT"
p2pAddress="atcorda:10301"
rpcSettings {
    address="atcorda:10302"
    adminAddress="atcorda:10303"
}
rpcUsers=[
    {
        password=test
        permissions=[
            ALL
        ]
        user=user1
    }
]

dataSourceProperties.dataSourceClassName=org.postgresql.ds.PGSimpleDataSource
dataSourceProperties.dataSource.url="jdbc:postgresql://db:5432/atcorda"
dataSourceProperties.dataSource.user=postgres
dataSourceProperties.dataSource.password=test

答案1

添加双引号

dataSourceProperties = {
  dataSourceClassName = "org.postgresql.ds.PGSimpleDataSource"
  dataSource.url = "jdbc:postgresql://localhost:5432/postgres"
  "dataSource.user" = postgres
  "dataSource.password" = admin
}

相关内容