无法使用 Wso2sp 连接到 postgres
Unable to connect to postgres using Wso2sp
我正在尝试使用 Wso2Sp 连接到 Postgres Db。
我已尝试对 SP_Home/conf/worker/ 中的 deployment.yaml 文件进行更改。
如 documentation 中所述,这是我添加到 wso2.datasources 部分的部分。
# Postgres
- name: WSO2_TEST_DB
description: The datasource used for test database
jndiConfig:
name: jdbc/WSO2_TEST_DB
definition:
type: RDBMS
configuration:
jdbcUrl: jdbc:postgresql://<host>:<port>/<db>
username: <user>
password: <password>
driverClassName: org.postgresql.Driver
maxPoolSize: 10
idleTimeout: 60000
connectionTestQuery: SELECT 1
validationTimeout: 30000
isAutoCommit: false
当我重新启动我的工作容器并检查日志时,这就是我得到的结果。
JAVA_HOME environment variable is set to /opt/java/openjdk
CARBON_HOME environment variable is set to /home/wso2carbon/wso2sp-4.4.0
RUNTIME_HOME environment variable is set to /home/wso2carbon/wso2sp-4.4.0/wso2/worker
osgi> [2019-08-20 12:31:20,714] INFO {org.wso2.msf4j.internal.websocket.WebSocketServerSC} - All required capabilities are available of WebSocket service component is available.
[2019-08-20 12:31:20,757] INFO {org.wso2.carbon.metrics.core.config.model.JmxReporterConfig} - Creating JMX reporter for Metrics with domain 'org.wso2.carbon.metrics'
[2019-08-20 12:31:20,780] INFO {org.wso2.msf4j.analytics.metrics.MetricsComponent} - Metrics Component is activated
[2019-08-20 12:31:20,787] INFO {org.wso2.carbon.databridge.agent.internal.DataAgentDS} - Successfully deployed Agent Server
[2019-08-20 12:31:24,617] ERROR {org.wso2.carbon.kernel.internal.startupresolver.StartupComponentManager} - Runtime Exception occurred while calling onAllRequiredCapabilitiesAvailable of component carbon-datasource-service java.lang.RuntimeException: Unable to get driver instance for jdbcUrl=jdbc:postgresql://<host>:<port>/<db>
at com.zaxxer.hikari.util.DriverDataSource.<init>(DriverDataSource.java:88)
at com.zaxxer.hikari.pool.PoolElf.initializeDataSource(PoolElf.java:157)
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:113)
at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:73)
at org.wso2.carbon.datasource.rdbms.hikari.HikariRDBMSDataSource.getDataSource(HikariRDBMSDataSource.java:56)
at org.wso2.carbon.datasource.rdbms.hikari.HikariDataSourceReader.createDataSource(HikariDataSourceReader.java:74)
at org.wso2.carbon.datasource.core.DataSourceBuilder.buildDataSourceObject(DataSourceBuilder.java:79)
at org.wso2.carbon.datasource.core.DataSourceBuilder.buildDataSourceObject(DataSourceBuilder.java:60)
at org.wso2.carbon.datasource.core.DataSourceBuilder.buildCarbonDataSource(DataSourceBuilder.java:44)
at org.wso2.carbon.datasource.core.DataSourceManager.initDataSources(DataSourceManager.java:153)
at org.wso2.carbon.datasource.core.internal.DataSourceListenerComponent.onAllRequiredCapabilitiesAvailable(DataSourceListenerComponent.java:125)
at org.wso2.carbon.kernel.internal.startupresolver.StartupComponentManager.lambda$notifySatisfiableComponents(StartupComponentManager.java:266)
at java.util.ArrayList.forEach(ArrayList.java:1257)
at org.wso2.carbon.kernel.internal.startupresolver.StartupComponentManager.notifySatisfiableComponents(StartupComponentManager.java:252)
at org.wso2.carbon.kernel.internal.startupresolver.StartupOrderResolver.run(StartupOrderResolver.java:204)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
Caused by: java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getDriver(DriverManager.java:315)
at com.zaxxer.hikari.util.DriverDataSource.<init>(DriverDataSource.java:81)
... 16 more
[2019-08-20 12:32:20,489] WARN {org.wso2.carbon.kernel.internal.startupresolver.StartupOrderResolver} - Startup component carbon-deployment-service from bundle(org.wso2.carbon.deployment.engine:5.2.0) is in the pending state until Capability org.wso2.carbon.deployment.engine.Deployer from bundle(org.wso2.carbon.event.simulator.core:2.1.22) is available as an OSGi service. Refer the Startup Order Resolver documentation for information.
我在这里错过了什么?
您必须将 OSGi 兼容的 postgresql 连接器添加到 {SP_HOME}/lib 文件夹。
详情请见https://docs.wso2.com/display/SP4xx/Adding+Third+Party+Non+OSGi+Libraries
我正在尝试使用 Wso2Sp 连接到 Postgres Db。
我已尝试对 SP_Home/conf/worker/ 中的 deployment.yaml 文件进行更改。
如 documentation 中所述,这是我添加到 wso2.datasources 部分的部分。
# Postgres
- name: WSO2_TEST_DB
description: The datasource used for test database
jndiConfig:
name: jdbc/WSO2_TEST_DB
definition:
type: RDBMS
configuration:
jdbcUrl: jdbc:postgresql://<host>:<port>/<db>
username: <user>
password: <password>
driverClassName: org.postgresql.Driver
maxPoolSize: 10
idleTimeout: 60000
connectionTestQuery: SELECT 1
validationTimeout: 30000
isAutoCommit: false
当我重新启动我的工作容器并检查日志时,这就是我得到的结果。
JAVA_HOME environment variable is set to /opt/java/openjdk
CARBON_HOME environment variable is set to /home/wso2carbon/wso2sp-4.4.0
RUNTIME_HOME environment variable is set to /home/wso2carbon/wso2sp-4.4.0/wso2/worker
osgi> [2019-08-20 12:31:20,714] INFO {org.wso2.msf4j.internal.websocket.WebSocketServerSC} - All required capabilities are available of WebSocket service component is available.
[2019-08-20 12:31:20,757] INFO {org.wso2.carbon.metrics.core.config.model.JmxReporterConfig} - Creating JMX reporter for Metrics with domain 'org.wso2.carbon.metrics'
[2019-08-20 12:31:20,780] INFO {org.wso2.msf4j.analytics.metrics.MetricsComponent} - Metrics Component is activated
[2019-08-20 12:31:20,787] INFO {org.wso2.carbon.databridge.agent.internal.DataAgentDS} - Successfully deployed Agent Server
[2019-08-20 12:31:24,617] ERROR {org.wso2.carbon.kernel.internal.startupresolver.StartupComponentManager} - Runtime Exception occurred while calling onAllRequiredCapabilitiesAvailable of component carbon-datasource-service java.lang.RuntimeException: Unable to get driver instance for jdbcUrl=jdbc:postgresql://<host>:<port>/<db>
at com.zaxxer.hikari.util.DriverDataSource.<init>(DriverDataSource.java:88)
at com.zaxxer.hikari.pool.PoolElf.initializeDataSource(PoolElf.java:157)
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:113)
at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:73)
at org.wso2.carbon.datasource.rdbms.hikari.HikariRDBMSDataSource.getDataSource(HikariRDBMSDataSource.java:56)
at org.wso2.carbon.datasource.rdbms.hikari.HikariDataSourceReader.createDataSource(HikariDataSourceReader.java:74)
at org.wso2.carbon.datasource.core.DataSourceBuilder.buildDataSourceObject(DataSourceBuilder.java:79)
at org.wso2.carbon.datasource.core.DataSourceBuilder.buildDataSourceObject(DataSourceBuilder.java:60)
at org.wso2.carbon.datasource.core.DataSourceBuilder.buildCarbonDataSource(DataSourceBuilder.java:44)
at org.wso2.carbon.datasource.core.DataSourceManager.initDataSources(DataSourceManager.java:153)
at org.wso2.carbon.datasource.core.internal.DataSourceListenerComponent.onAllRequiredCapabilitiesAvailable(DataSourceListenerComponent.java:125)
at org.wso2.carbon.kernel.internal.startupresolver.StartupComponentManager.lambda$notifySatisfiableComponents(StartupComponentManager.java:266)
at java.util.ArrayList.forEach(ArrayList.java:1257)
at org.wso2.carbon.kernel.internal.startupresolver.StartupComponentManager.notifySatisfiableComponents(StartupComponentManager.java:252)
at org.wso2.carbon.kernel.internal.startupresolver.StartupOrderResolver.run(StartupOrderResolver.java:204)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
Caused by: java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getDriver(DriverManager.java:315)
at com.zaxxer.hikari.util.DriverDataSource.<init>(DriverDataSource.java:81)
... 16 more
[2019-08-20 12:32:20,489] WARN {org.wso2.carbon.kernel.internal.startupresolver.StartupOrderResolver} - Startup component carbon-deployment-service from bundle(org.wso2.carbon.deployment.engine:5.2.0) is in the pending state until Capability org.wso2.carbon.deployment.engine.Deployer from bundle(org.wso2.carbon.event.simulator.core:2.1.22) is available as an OSGi service. Refer the Startup Order Resolver documentation for information.
我在这里错过了什么?
您必须将 OSGi 兼容的 postgresql 连接器添加到 {SP_HOME}/lib 文件夹。
详情请见https://docs.wso2.com/display/SP4xx/Adding+Third+Party+Non+OSGi+Libraries