Changing JBoss BRMS DataSource to use PostgreSQL JDBC driver

783 views Asked by At

I am working to change the default H2 Datasource of JBoss BRMS 6.4 to use PostgreSQL JDBC driver. I am using JBoss EAP 6.4 as container for JBoss BRMS 6.4. The name of my postgresql driver is : postgresql-9.4-1202.jdbc42.jar For the new database, I installed Postgresql and created a role and a database that I name jbpm. I then downloaded the jboss-brms-bpmsuite-6.4-supplementary-tools/ddl-scripts for importing the postgresql-jbpm-schema.sql.

The following are the way I try to make it work.

1- I add some new lines in the standalone.xml file to make JBoss use PostgresSQL as datasource :

<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- This is the content of my module.xml that i creat in this path /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- For registering the Business-central, I also configure the persistence.xml by adding the following lines :

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

4 - But when I execute the ./standalone.sh script I receive this Error :

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"]

Thank you for your time and helping me, and specialy for your time.

1

There are 1 answers

0
zhrist On

The procedure is explained in this question in details: jBPM 7.3.0 persistence with Postgres 9.6

I know it is different version but it still is applicable in your case.

So the proper steps are:

  • SET wildfly-10.1.0.Final\modules\org\postgresql\main\module.xml
  • Change standalone-full.xml
  • Run the ddl scripts on a jbpm database, with jbpm schema and user(if needed)
  • Start the server with proper switches, most important new ones

Dorg.kie.server.persistence.ds=java:jboss/datasources/jbpmDS Dorg.kie.server.persistence.dialect=org.hibernate.dialect.PostgreSQL94Dialect