Show Table of Contents
2.5. Configuring a Datasource for JBoss Enterprise Web Server
The default configurations use embedded databases that are not suitable or supported for production environments. Before deploying into a production environment, this configuration must be changed to a supported database. JBoss Enterprise Web Server users must configure
jbpm-human-task.war and business-central-server.war.
The following example uses a MySQL database.
Procedure 2.3. Configuring a datasource for JBoss Enterprise Web Server
- Copy the MySQL driver to
tomcat6/lib/ - Configure the datasource resources in
tomcat6/conf/context.xml:<Resource name="jdbc/jbpmDS" auth="Container" type="javax.sql.DataSource" factory="bitronix.tm.resource.ResourceObjectFactory" uniqueName="jdbc/jbpmDS"/> <Resource name="jdbc/jbpmTasksDS" auth="Container" type="javax.sql.DataSource" factory="bitronix.tm.resource.ResourceObjectFactory" uniqueName="jdbc/jbpmTasksDS"/>
- Edit the
tomcat6/webapps/business-central-server.war/WEB-INF/Classes/META-INF/persistence.xmlfile to include the unique name fromcontext.xml:<jta-data-source>java:/comp/env/jdbc/jbpmDS</jta-data-source> ... <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/> <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.BTMTransactionManagerLookup" />
- Edit the
tomcat6/webapps/jbpm-human-task.war/WEB-INF/classes/META-INF/persistence.xmlfile to include the unique name fromcontext.xml:<jta-data-source>java:/comp/env/jdbc/jbpmTasksDS</jta-data-source> ... <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/> <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.BTMTransactionManagerLookup" />
- JBoss Enterprise Web Server does not include a transaction manager. The following example shows the configuration for Bitronix, and it is provided for evaluation purposes only. Bitronix can be downloaded from http://docs.codehaus.org/display/BTM/Home.
#file resources.properties resource.ds1.className=com.mysql.jdbc.jdbc2.optional.MysqlXADataSource resource.ds1.uniqueName=jdbc/jbpmDS resource.ds1.minPoolSize=0 resource.ds1.maxPoolSize=10 resource.ds1.driverProperties.user=guest resource.ds1.driverProperties.password=guest resource.ds1.driverProperties.URL=jdbc:mysql://localhost:3306/jbpmprocess resource.ds1.allowLocalTransactions=true resource.ds2.className=com.mysql.jdbc.jdbc2.optional.MysqlXADataSource resource.ds2.uniqueName=jdbc/jbpmTasksDS resource.ds2.minPoolSize=0 resource.ds2.maxPoolSize=10 resource.ds2.driverProperties.user=guest resource.ds2.driverProperties.password=guest resource.ds2.driverProperties.URL=jdbc:mysql://localhost:3306/jbpmtasks resource.ds2.allowLocalTransactions=true
- To configure the Bitronix transaction manager, create a
tomcat6/conf/btm-config.propertiesfile:bitronix.tm.serverId=tomcat-btm-node0 bitronix.tm.journal.disk.logPart1Filename=${btm.root}/work/btm1.tlog bitronix.tm.journal.disk.logPart2Filename=${btm.root}/work/btm2.tlog bitronix.tm.resource.configuration=${btm.root}/conf/resources.propertiesAdd the following line totomcat6/conf/context.xml:<Transaction factory="bitronix.tm.BitronixUserTransactionObjectFactory"/>
Add the following line totomcat6/conf/server.xml<Listener className="bitronix.tm.integration.tomcat55.BTMLifecycleListener"/>
Create a configuration properties file. On unix based systems the file should betomcat6/setenv.sh, and on Windows systems the file should betomcat6/setenv.bat.CATALINA_OPTS="-Dbtm.root=$CATALINA_HOME -Dbitronix.tm.configuration=$CATALINA_HOME/conf/btm-config.properties"

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.