doboss [https://community.jboss.org/people/doboss] created the discussion

"Installing JBPM 5.3 on JBoss AS 5.1 and changing DB"

To view the discussion, visit: https://community.jboss.org/message/741521#741521

--------------------------------------------------------------
A few days ago I tried to get JBPM 5.3 installed into JBoss AS 5.1 using 
PostgreSQL via the jbpm-installer. I had some trouble, but after some 
customizations, I have been able to get it installed and running. Some of the 
information came right out of the documentation, some came from community 
posts, and some I figured out through tiral and error.

Hopefully this post will help others at least get to this point.  :) 

h2. My configuration:
Ubuntu 12.04
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.1) (6b24-1.11.1-4ubuntu3)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
JBoss 5.1.0GA
PostgreSQL 9.1.4 on x86_64

h2. Preparation
h3. Get the installer:
The first thing I did was download the jbpm-installer and unzip it into 
~/Downloads/jbpm-installer/ and this is the directory/path I will use for the 
rest of this post.
h3. Save some download time:
If you are like me, you probably already had a copy of the JBoss distribution 
sititng around, and rather than having the installation script download it 
again, I copied it into the installer's lib folder and made a soft link with 
the name the installer was expecting.  (This step is not critical, just a way 
to save a bit of time.)

 cd ~/Downloads/jbpm-installer/
 cp ~/Downloads/jboss-5.1.0.GA.zip lib/
 ln -s jboss-5.1.0.GA.zip jboss-as-5.1.0.GA.zip # This makes a link with a name 
of what the installer is expecting
h3. Prepare the JBoss installtion directory:
You will need to setup a JBoss installation folder for the installer to install 
into. For the rest of the post, I use "path-to-jboss" as this location.

 cd /path-to-jboss/
 unzip ~/Downloads/jbpm-installer/lib/jboss-5.1.0.GA.zip
h3. Copy DB drivers into installer:
If you are going to use a DB other than the default H2 db, you will need to 
place the drivers where the installer can find them. 

 cp ~/Downloads/postgresql-9.1-901.jdbc4.jar ~/Downloads/jbpm-installer/lib/
h2. Configuration
h3. Update build.properties:
Next you will need to edit ~/Downloads/jbpm-installer/build.properties

h4. Drools Guvnor version:
>From what I read and remember experiencing, the version of Drools Govnor which 
>is setup to be used by the installer will not work with JBoss 5.1, and instead 
>you should use 5.3.1.Final. So change the following properties in  
>build.properties as follows:

# (Drools guvnor which works with JBoss AS 5.1)
drools.guvnor.version=5.3.1.Final
drools.guvnor.url=https://repository.jboss.org/nexus/content/repositories/releases/org/drools/guvnor-distribution-wars/5.3.1.Final/guvnor-distribution-wars-5.3.1.Final-jboss-as-5.1.war
h4. Designer version:
Update to use the correct version of the designer for AS 5. I changed the URL 
to a specific server because it looked like the installer got stuck when 
redirecter, this may not be necessary.

designer.version=2.2.Final-jboss 
#designer.url=http://sourceforge.net/projects/jbpm/files/designer/designer-2.2/
designer.url=http://iweb.dl.sourceforge.net/project/jbpm/designer/designer-2.2/
h4. JBoss Home and version:
Uncomment/update the jboss.xxxx properties:


jboss.server.version=${jboss.server.version.5}
jboss.home=<path-to-jboss>/jboss-5.1.0.GA
jboss.download.url=http://downloads.sourceforge.net/jboss/jboss-${jboss.server.version}.zip
jboss.server.configuration=default
jboss.server.deploy.dir=${jboss.home}/server/${jboss.server.configuration}/deploy
jboss.server.data.dir=${jboss.home}/server/${jboss.server.configuration}/data/
jboss.clean.repository=true
h3. Update build.xml
Edit ~/Downloads/jbpm-installer/build.xml to reflect the correct DB driver:

Change <property name="db.driver.jar.name" value="mysql-connector-java.jar"/> 
to <property name="db.driver.jar.name" value="postgresql-9.1-901.jdbc4.jar"/>
h3. Database specific files:
There are several files which need to be updated for JBoss AS 5 as well as for 
your specific DB dialect and configurations. 

h4. Edit db/persistence.xml:
First edit ~/Downloads/jbpm-installer/db/persistence.xml
h5. Change the dialect and set DB specific configurations:
I updated/added the follwing to the <properties> section:
 <property name="hibernate.dialect" 
value="org.hibernate.dialect.PostgreSQLDialect"/>
 <property name="hibernate.default_schema" value="jbpm5"/>
h5. Use AS5 transaction manager:

You will need to comment out the AS7 section and comment in the AS5 section:
   <!-- for AS7 -->
   <!-- <property name="hibernate.transaction.manager_lookup_class" 
value="org.jbpm.integration.console.JBPMTransactionManager" /> -->
   <!-- for AS5 -->
   <property name="hibernate.transaction.manager_lookup_class" 
value="org.hibernate.transaction.JBossTransactionManagerLookup" />

h5. Whole file:
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <persistence version="1.0"
             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
                                 
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd
                                 http://java.sun.com/xml/ns/persistence/orm 
                                 
http://java.sun.com/xml/ns/persistence/orm_1_0.xsd";
             xmlns:orm="http://java.sun.com/xml/ns/persistence/orm";
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
             xmlns="http://java.sun.com/xml/ns/persistence";>

  <persistence-unit name="org.jbpm.persistence.jpa" transaction-type="JTA">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <jta-data-source>java:jboss/datasources/jbpmDS</jta-data-source>
    <mapping-file>META-INF/JBPMorm.xml</mapping-file>
    <mapping-file>META-INF/ProcessInstanceInfo.hbm.xml</mapping-file>

    <class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>
    <class>org.drools.persistence.info.SessionInfo</class>
    <class>org.drools.persistence.info.WorkItemInfo</class>

    <class>org.jbpm.process.audit.ProcessInstanceLog</class>
    <class>org.jbpm.process.audit.NodeInstanceLog</class>
    <class>org.jbpm.process.audit.VariableInstanceLog</class>

    <properties>
      <property name="hibernate.dialect" 
value="org.hibernate.dialect.PostgreSQLDialect"/>
      <property name="hibernate.default_schema" value="jbpm5"/>
      <property name="hibernate.max_fetch_depth" value="3"/>
      <!-- hbm2ddl.auto MUST BE update! The console will otherwise overwrite 
the schema with each new thread -->
      <property name="hibernate.hbm2ddl.auto" value="update" />
      <property name="hibernate.show_sql" value="false" />

      <!-- for AS7 -->
      <!-- <property name="hibernate.transaction.manager_lookup_class" 
value="org.jbpm.integration.console.JBPMTransactionManager" /> -->
      <!-- for AS5 -->
      <property name="hibernate.transaction.manager_lookup_class" 
value="org.hibernate.transaction.JBossTransactionManagerLookup" />
    </properties>
  </persistence-unit>
 </persistence>

h4. Update db/persistence-as5.xml:
Most of my problems came from things related to the DB, and it was unclear to 
me which files were being used/ignored, so for simplicity, I just copied 
persistence.xml on top of persistence-as5.xml.

cp ~/Downloads/jbpm-installer/db/persistence.xml  
~/Downloads/jbpm-installer/db/persistence-as5.xml 

h4. Update task-service:
Somewhere in the documentation, I read that this file must be updated. Even 
though I updated it, I don't think it was used for the installation, and I had 
to manually copy the file into the deploy directory (covered later in the 
post.) But go ahead and edit it here, this way you have it somewhere outside of 
the JBoss install in case you need it again.


First edit 
~/Downloads/jbpm-installer/task-service/resources/META-INF/persistence.xml

You will need to add the <jta-data-source> section as well as configure the 
<properties> section:
...
 <persistence-unit name="org.jbpm.task">
  <provider>org.hibernate.ejb.HibernatePersistence</provider>
*  <jta-data-source>java:jboss/datasources/jbpmDS</jta-data-source>*
  <mapping-file>META-INF/Taskorm.xml</mapping-file>
...
 <properties>
  <property name="hibernate.dialect" 
value="org.hibernate.dialect.*PostgreSQLDialect*"/>
*  <property name="hibernate.default_schema" value="jbpm5"/>*
*  <property name="hibernate.connection.driver_class" 
value="org.postgresql.Driver"/>*
*  <property name="hibernate.transaction.manager_lookup_class" 
value="org.hibernate.transaction.JBossTransactionManagerLookup" />*
  <property name="hibernate.connection.username" value="*some_username*"/>
  <property name="hibernate.connection.password" value="*some_password*"/>
 </properties>
...



h3. Update the datasource:
Update ~/Downloads/jbpm-installer/db/jBPM-ds.xml as needed. (Remember to change 
the driver)


  <connection-url>jdbc:postgresql://some_host:5432/some_db_name</connection-url>
  <driver-class>org.postgresql.Driver</driver-class>
  <user-name>some_username</user-name>
  <password>some_password</password>
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/741521#741521]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to