更改JBoss BRMS DataSource以使用PostgreSQL JDBC驱动程序

时间:2017-05-26 01:45:35

标签: java postgresql jdbc jboss redhat-brms

我正在努力将JBoss BRMS 6.4的默认H2数据源更改为使用PostgreSQL JDBC驱动程序。我使用JBoss EAP 6.4作为JBoss BRMS 6.4的容器。我的postgresql驱动程序的名称是: postgresql-9.4-1202.jdbc42.jar 对于新数据库,我安装了Postgresql并创建了一个角色和一个我命名为jbpm的数据库。然后我下载了用于导入 postgresql-jbpm-schema.sql 的jboss-brms-bpmsuite-6.4-supplement-tools / ddl-scripts。

以下是我尝试使其工作的方式。

1-我在standalone.xml文件中添加了一些新行,以使JBoss将PostgresSQL用作数据源:

<system-properties>
        <property name="org.kie.example" value="true"/>
        <property name="org.jbpm.designer.perspective" value="ruleflow"/>
        <property name="designerdataobjects" value="false"/>
        <property name="org.jbpm.server.ext.disabled" value="true"/>
        <property name="org.jbpm.ui.server.ext.disabled" value="true"/>
        <property name="org.uberfire.nio.git.daemon.host" value="0.0.0.0"/>
        <property name="org.uberfire.nio.git.ssh.host" value="0.0.0.0"/>
        <property name="org.kie.server.location" value="http://orc-brms3:8080/kie-server/services/rest/server"/>
        <property name="org.kie.server.controller" value="http://orc-brms3:8080/business-central/rest/controller"/>
        <property name="org.kie.server.controller.user" value="brms"/>
        <property name="org.kie.server.controller.pwd" value="P@ssw0rd"/>
        <property name="org.kie.server.user" value="brms"/>
        <property name="org.kie.server.pwd" value="P@ssw0rd"/>
        <property name="org.kie.server.id" value="default-kieserver"/>
        <property name="jboss.as.management.blocking.timeout" value="700"/>
        <property name="org.kie.server.persistence.ds" value="java:jboss/datasources/PostgresqlDS"/>
        <property name="org.kie.server.persistence.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
    </system-properties>

<subsystem xmlns="urn:jboss:domain:datasources:1.2">
<datasources>
    <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="false" use-java-context="true">
       <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
       <driver>h2</driver>
          <security>
          <user-name>sa</user-name>
          <password>sa</password>
          </security>
          </datasource>
          <datasource jndi-name="java:jboss/datasources/PostgresqlDS" pool-name="PostgresqlDS" enabled="true">
               <connection-url>jdbc:postgresql://192.168.56.16:5432/jbpm</connection-url>
               <driver>postgresql-9.4-1202.jdbc42.jar</driver>
                   <security>
                        <user-name>jbpm</user-name>
                        <password>jbpm</password>
                    </security>
          </datasource>
                <drivers>
                    <driver name="h2" module="com.h2database.h2">
                        <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
                    </driver>
                     <driver name="postgres" module="org.postgres">
                       <driver-class>org.postgresql.Driver</driver-class>
                    </driver>
                </drivers>
            </datasources>

2-这是我在此路径中创建的module.xml的内容 /EAP_HOME/modules/org/postgres/main/module.xml

<?xml version="1.0" ?>
    <module xmlns="urn:jboss:module:1.1" name="org.postgres">
      <resources>
          <resource-root path="postgresql-9.4-1202.jdbc42.jar"/>
      </resources>
      <dependencies>
         <module name="javax.api"/>
         <module name="javax.transaction.api"/>
      </dependencies>
    </module>

3-为了注册Business-central,我还通过添加以下行来配置persistence.xml:

<jta-data-source>java:jboss/datasources/PostgresqlDS</jta-
data-source>
<property name="hibernate.dialect"
value="org.hibernate.dialect.PostgreSQLDialect" />

4 - 但是当我执行./standalone.sh脚本时,我收到此错误:

00:28:36,709 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS014612: Operation ("add") failed - address: ([
    ("subsystem" => "datasources"),
    ("data-source" => "PostgresqlDS")
]) - failure description: {"JBAS014771: Services with missing/unavailable dependencies" => [
    "jboss.data-source.java:jboss/datasources/PostgresqlDS is missing [jboss.jdbc-driver.postgresql-9_4-1202_jdbc42_jar]",
    "jboss.driver-demander.java:jboss/datasources/PostgresqlDS is missing [jboss.jdbc-driver.postgresql-9_4-1202_jdbc42_jar]"
]}
00:28:36,711 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS014612: Operation ("enable") failed - address: ([
    ("subsystem" => "datasources"),
    ("data-source" => "PostgresqlDS")
]) - failure description: {"JBAS014879: One or more services were unable to start due to one or more indirect dependencies not being available." => {
    "Services that were unable to start:" => [
        "jboss.data-source.reference-factory.PostgresqlDS",
        "jboss.naming.context.java.jboss.datasources.PostgresqlDS"
    ],
    "Services that may be the cause:" => ["jboss.jdbc-driver.postgresql-9_4-1202_jdbc42_jar"]

感谢您的时间和帮助我,特别是您的时间。

1 个答案:

答案 0 :(得分:0)

此问题中详细解释了该过程: jBPM 7.3.0 persistence with Postgres 9.6

我知道它是不同的版本,但仍适用于您的情况。