Version 1

    A few days ago I tried to get JBPM 5.3 installed into JBoss AS 5.1 using PostgreSQL (without Eclipse) 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 trial and error.

     

    I figured this all out, then wrote it down, and did it again to verify which things needed to be done. Hopefully I successfully captured all the steps here. I used headings and fonts to try to make this easy to follow. I tried to proof this post real quick as well, but I am thin on time, so I apologies for any mistakes I made. With a bit more time, I suspect these steps could be trimmed down to only the necessary steps, as I may have changed which had no effect on the installation.

     

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

     

    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

     

     

    Preparation

    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.

    Save some download time:

    If you are like me, you probably already have 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

    Prepare the JBoss installation directory:

    You will need to setup a JBoss installation directory 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

    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/

    Create the JBPM schema:

    You will need to create the jbpm schema/database for JBPM to use. I use jbpm5 in this post.

     

     

     


    Configuration

    Update build.properties:

    Next you will need to edit ~/Downloads/jbpm-installer/build.properties

    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 AS 5.1, and instead you should use 5.3.1.Final. So change the following properties:

     

    # (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

    Designer version:

    Update the properties 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 redirected so that part 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/

    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

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

    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.

    Edit db/persistence.xml:

    First edit ~/Downloads/jbpm-installer/db/persistence.xml

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

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

     

    Whole file:

    This is what my final file looked like:

    <?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>

     

    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

    Update task-service META-INF/persistence.xml:

    Somewhere in the documentation, I read that task-service/resources/META-INF/persistence.xml 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>

    ...

     

    Update task-service war/persistence.xml:

    When things were not working because of problems talking to the DB, I found another persistence.xml file which I also updated. I changed the dialect, added the default_schema, and commented in the correct transaction.manager_lookup_class for AS5. Again, I'm not sure if it was actually picked up and used.


    Now edit ~/Downloads/jbpm-installer/task-service/resources/war/persistence.xml

     

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

          <property name="hibernate.hbm2ddl.auto" value="create" />

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

    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>

     

     

     

    Installation

    Okay, this part was easy. From inside the jbpm-installer/ directory just run:

       ant install.demo.noeclipse

     

     

     

    Tweaking

    Once everything was installed, I had a lot of errors when trying to start JBoss, so I had to tweak some of the stuff post install.

     

    Remove the form builder:

    For whatever reason, the form builder would not deploy and gave me this error:

     

    [org.jboss.kernel.plugins.dependency.AbstractKernelController] (main) Error installing to Real: name=vfszip:/path-to-jboss/jboss-5.1.0.GA/server /default/deploy/jbpm-form-builder.war/ state=PreReal mode=Manual requiredState=Real

    org.jboss.deployers.spi.DeploymentException: Error deploying: vfszip:/path-to-jboss/jboss-5.1.0.GA/server/default/deploy/jbpm-form-builder.war/

     

    Since I'm probably not going to use the form builder, I just removed it. I thought maybe the war got corrupted, but I tried the install multiple times with the same error. If you have found a way to make this work, please add to this thread so others can get it working.

     

    rm path-to-jboss/jboss-5.1.GA/server/default/deploy/jbpm-form-builder.war

     

    Fix JBPM console:

    Out of the box, I got this error when trying to start JBoss:

     

    [org.jboss.kernel.plugins.dependency.AbstractKernelController] (main) Error installing to Start: name=persistence.unit:unitName=#org.jbpm.persistence.jpa state=Create

    org.hibernate.DuplicateMappingException: Duplicate collection role mapping org.jbpm.persistence.processinstance.ProcessInstanceInfo.eventTypes


    Following this thread: https://community.jboss.org/message/739278 I was able to fix the problem by renaming ProcessInstanceInfo.hbm.xml.

     

    I exploded the war, and made the necessary updates:

     

    cd path-to-jboss/jboss-5.1.GA/server/default/deploy/

    # Because you can't have a dir with the same name as a file, I do the following 4 steps.

    mkdir tmp

    mv jbpm-gwt-console-server.war tmp

    mv tmp jbpm-gwt-console-server.war

    cd tmp jbpm-gwt-console-server.war

    unzip jbpm-gwt-console-server.war # Expload the war

    mv jbpm-gwt-console-server.war jbpm-gwt-console-server.orig # You could delete the original instead...

    cd WEB-INF/classes/META-INF/

    mv ProcessInstanceInfo.hbm.xml ProcessInstanceInfo.orig # You could removed this file instead...

     

    Fix human task war:

    I also had errors from the human-task war when starting JBoss:

     

    Error 1:

    [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/jbpm-human-task-war]] (main) StandardWrapper.Throwable

    javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query

     

    Error 2:

    [org.jboss.kernel.plugins.dependency.AbstractKernelController] (main) Error installing to Start: name=persistence.unit:unitName=#org.jbpm.task state=Create

    java.lang.RuntimeException: Specification violation [EJB3 JPA 6.2.1.2] - You have not defined a jta-data-source for a JTA enabled persistence context named: org.jbpm.task

     

    Error 3:

    [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/jbpm-human-task-war]] (main) StandardWrapper.Throwable

    java.lang.ClassCastException: org.jboss.tm.usertx.client.ServerVMClientUserTransaction cannot be cast to javax.transaction.UserTransaction

     

    Error #1 and #2 are due to a persistence.xml which is not setup for my configuration. Error #3 is because of conflicting classes in jta-1.1.jar which is inside the war.

     

    So I exploded the war and made the changes:

    cd path-to-jboss/jboss-5.1.GA/server/default/deploy/

    mkdir tmp

    mv jbpm-human-task-war.war tmp

    mv tmp jbpm-human-task-war.war

    cd jbpm-human-task-war.war

    unzip jbpm-human-task-war.war

    mv jbpm-human-task-war.war jbpm-human-task-war.orig

    cp ~/Downloads/jbpm-installer/task-service/resources/META-INF/persistence.xml WEB-INF/classes/META-INF/ # Fixes 1 and 2

    rm WEB-INF/lib/jta-1.1.jar # Fix 3

     

     

     

    Start JBoss

    After all this, I started JBoss with the ant task. (You could probably just start it from the bin dir.)

     

    cd ~/Downloads/jbpm-installer/

    ant start.demo.noeclipse

     

     

    When all was said and done, I was able to start jboss, user the jbpm-console, guvnor, and designer.