How to set up JBPM console to use PostgreSQL as DB

588 views
Skip to first unread message

Todor Hristov

unread,
Jul 20, 2016, 7:38:29 AM7/20/16
to jBPM Development
Hi,

I am trying to set up the JBPM console app to use PostgreSQL as a DB, running on Tomcat 7.
I had the application running OK on Tomcat using the default H2 DB. 
The problems come when I try using PostgreSQL. I can see that an empty db is populated on PostgreSQL - I can see 41 tables created after the app starts up even though there are numerous exceptions on start up. The sign-in page is shown and I can log in. But I cannot build and deploy the sample "evaluation" app. The exception is "Large Objects may not be used in auto-commit mode". I guess there would be similar errors for other features of the workbench app.
If I set autocommit=false, then I get another error and cannot deploy a project either - "row was updated or deleted by another transaction (or unsaved-value mapping was incorrect)". I am setting autocommit to false in the follwoing way:
1. the data source definition in server.xml : defaultAutoCommit="false"
2. WEB-INF/classes/META-INF/persistence.xml : <property name="hibernate.id.new_generator_mappings" value="false"/>

In both cases with autocommit=true|false I am getting errors and the application cannot be used. 

Here is my configuration:

server.xml :

 <Resource name="jdbc/postgres"
 
global="jdbc/postgres"
 
auth="Container"
 
type="javax.sql.DataSource"
 
driverClassName="org.postgresql.Driver"
 
url="jdbc:postgresql://localhost:5432/jbpm"
 
username="postgres"
 
password="postgres"
 
maxActive="100"
 
maxIdle="20"
 
minIdle="5"
 
maxWait="10000"/>


persistence.xml:

<jta-data-source>java:/comp/env/jdbc/postgres</jta-data-source>

<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>


resources.properties:

resource.ds1.className=org.postgresql.xa.PGXADataSource
resource
.ds1.uniqueName=jdbc/jbpm
resource
.ds1.minPoolSize=10
resource
.ds1.maxPoolSize=20
#resource.ds1.driverProperties.driverClassName=org.postgresql.Driver
resource
.ds1.driverProperties.url=jdbc:postgresql://localhost:5432/jbpm
resource
.ds1.driverProperties.user=postgres
resource
.ds1.driverProperties.password=postgres
resource
.ds1.driverProperties.serverName=localhost
resource
.ds1.driverProperties.portNumber=5432
resource
.ds1.driverProperties.databaseName=jbpm
resource
.ds1.allowLocalTransactions=true

Am I missing something? 
Any help greatly appreciated, thanks.

Todor Hristov

unread,
Jul 20, 2016, 7:44:45 AM7/20/16
to jBPM Development
Please read:

I am setting autocommit to false in the follwoing way:
1. ...
2. WEB-INF/classes/META-INF/persistence.xml : <property name="hibernate.connection.autocommit" value="false" />

Maciej Swiderski

unread,
Jul 20, 2016, 7:47:41 AM7/20/16
to Todor Hristov, jBPM Development
don’t define the resource in server.xml simply rely on bitronix as it comes with connection pooling support as well. And then make sure you align the jndi name for data source

Maciej
--
You received this message because you are subscribed to the Google Groups "jBPM Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jbpm-developme...@googlegroups.com.
To post to this group, send email to jbpm-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jbpm-development/d688fa87-7073-425d-a153-f22ee304dba3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Todor Hristov

unread,
Jul 20, 2016, 9:06:35 AM7/20/16
to jBPM Development, todo...@gmail.com
Thank you very much, Maciej.

I removed the DS definition from server.xml and changed the entry in persistence.xml to be :

<jta-data-source>java:/comp/env/jdbc/jbpm</jta-data-source>

and now it works.
Reply all
Reply to author
Forward
0 new messages