使用 WSO2 DAS 的错误数据源 Postgres

Error Datasource Postgres with WSO2 DAS

我正在尝试将 WSO2 DAS 数据源从 H2 更改为 postgres。

我已经在 master-datasource.xml、user-mgt.xml 和 registry.xml

中配置了所有数据库更改

创建事件时抛出以下异常Table

Caused by: java.lang.NullPointerException
        at org.wso2.siddhi.extension.eventtable.rdbms.DBHandler.initializeDatabaseExecutionInfo(DBHandler.java:392)
        at org.wso2.siddhi.extension.eventtable.rdbms.DBHandler.<init>(DBHandler.java:73)
        at org.wso2.siddhi.extension.eventtable.RDBMSEventTable.init(RDBMSEventTable.java:112)
        at org.wso2.siddhi.core.util.parser.helper.DefinitionParserHelper.addEventTable(DefinitionParserHelper.java:99)
        at org.wso2.siddhi.core.util.ExecutionPlanRuntimeBuilder.defineTable(ExecutionPlanRuntimeBuilder.java:74)
        at org.wso2.siddhi.core.util.parser.ExecutionPlanParser.defineTableDefinitions(ExecutionPlanParser.java:162)
        at org.wso2.siddhi.core.util.parser.ExecutionPlanParser.parse(ExecutionPlanParser.java:115)
        at org.wso2.siddhi.core.SiddhiManager.validateExecutionPlan(SiddhiManager.java:68)
        at org.wso2.siddhi.core.SiddhiManager.validateExecutionPlan(SiddhiManager.java:74)
        at org.wso2.carbon.event.processor.core.internal.util.helper.EventProcessorHelper.validateExecutionPlan(EventProcessorHelper.java:191)

我试试这个代码:

@From(eventtable='rdbms', jdbc.url='jdbc:postgresql://localhost:5432/pruebabg', username='postgres', password='postgres', driver.name='org.postgresql.Driver', table.name='pharming')
define table pharming (phi_id_pharming_incident long, phi_id_license int, phi_machine_user_id string, phi_date string, phi_machine_user_date string, phi_protected_site string, phi_pharming_glp string, 
                                phi_user_ip string, phi_dsb_version string, phi_os string, phi_os_version string, user_id int);

我也尝试使用此代码:

@From(eventtable='rdbms', datasource.name='WSO2_CARBON_DB', table.name='pharming_incident')
define table pharming_incident (phi_id_pharming_incident long, phi_id_license int, phi_machine_user_id string, phi_date string, phi_machine_user_date string, phi_protected_site string, phi_pharming_glp string, 
                                phi_user_ip string, phi_dsb_version string, phi_os string, phi_os_version string, user_id int);

我该如何解决这个问题?

首先检查以下内容。

  1. 确保您有 运行 相关的数据库脚本位于 /dbscripts/postgresql.sql 针对您的数据库。
  2. 确保相关的数据库驱动放在 /repository/components/lib 个文件夹。

我怀疑是你的master-datasources.xml配置有误。如果您可以在 master-datasources.xml 中共享您的配置,则可以更容易地找到确切的问题。请在 link [1] 中找到有关如何使用 WSO2 DAS 设置 PostgreSQL 数据库的说明(对于 DAS 3.0.0)。希望这些信息对您有所帮助。

[1] https://docs.wso2.com/display/DAS300/Setting+up+PostgreSQL

感谢您的回答。

事件 table 仅在某些数据库中进行了测试:

https://docs.wso2.com/display/DAS301/Siddhi+Query+Language#SiddhiQueryLanguage-RDBMSEventTable

"RDBMS 事件 table 已使用以下数据库进行测试: MySQL 氢气 甲骨文

无论如何,我尝试更新 /repository/components/plugins/siddhi-extension-event-table_3.x.x.jar 中的 rdbms-table-config.xml a per : https://github.com/wso2/siddhi/blob/master/modules/siddhi-extensions/event-table/src/main/resources/rdbms-table-config.xml.

 </mapping>
        <mapping db='postgresql'>
            <elements>
                <element key="bool">SMALLINT</element>
    <element key="integer">INTEGER</element>
            </elements>
        </mapping>