Version 6

    Configuring JBossCache in jBPM 3.1.x


    In order to replace EhCache with JBossCache as the second level cache provider for Hibernate in jBPM - eg. for clustering reasons - the following steps are necessary.


    1. in jbpm.sar/jbpm.sar.cfg.jar/hibernate.cfg.xml declare the use of JBossCache by adding


       <property name="hibernate.cache.provider_class">org.hibernate.cache.TreeCacheProvider</property>


    if you want to use PESSIMISTIC locking OR




       <property name="hibernate.cache.provider_class">org.hibernate.cache.OptimisticTreeCacheProvider</property>


       if you want to use OPTIMISTIC locking.


    2. remove jbpm.sar/jbpm.sar.cfg.jar/ehcache.xml


    3. search for all Hibernate mapping files in jbpm.sar/jbpm-3.1.2.jar//.hbm.xml with cache usage declaration.


    change it from


    <cache usage="nonstrict-read-write"/>




    <cache usage="transactional"/>



    4. add jboss-cache.jar, jgroups.jar to server/<config-name>/lib (if not already there)


    5. add your JBossCache configuration as jbpm.sar/jbpm.sar.cfg.jar/treecache.xml


    Recommendation on JBossCache configuration


    Since caching is only used for the process definition information, which should rarely change at runtime, we recommend an optimistic cache usage strategy for performance reasons. Set treecache.xml to:


    <attribute name="NodeLockingScheme">OPTIMISTIC</attribute> <attribute name="CacheMode">REPL_ASYNC</attribute>




    Additional links








    Configuring jBPM with JTA transactions


    This is not a complete description.  It's just some email correspondence that i didn't want to keep from you.


    Had a few issues testing with Oracle. I could not create-drop the schema via Hibernate; I kept getting the message "You cannot set auto-commit during a managed transaction" when trying to create the tables. I have seen this before, and don't remember how to get around it. It is caused by create-drop, but I have other examples in 3.1.2 using Oracle and JTA where I create-drop without problem. So I tried to generate the oracle scripts and load them, but they are missing the ; at the end of each line, which Oracle requires. So I added these by hand, and finally got my test case to run successfully. Interesting that I did not need to configure oracle-ds with an XA datasource, and am not seeing any message about trying to enlist a non-XA resource in a global transaction. It's been a while since I did this, but it seems like I use to see this without an XA data source configured. Nice thing about a persistent externally accessible database is you can see the messages in the JMS_MESSAGES table. The message created in the node b action actually is put into the table. This is because (if I understand how Luc explained it) this operation is not part of the JTA transaction. Later, when the transaction rolls back, JBOSSMQ removed the message from the table. You an also see the node b notification message wind up on the DLQ for a few seconds, before the test class consumes it. Jeff


    And more in this thread.


    For testing with different databases (e.g., Oracle), the following configuration changes must be made: oracle-ds copied into server/jbpm/deploy ojdbc14.jar copied into server/jbpm/lib oracle-jdbc2-service.xml copied into server/jbpm/deploy/jms oracle-jdbc2-state-service.xml copied into server/jbpm/deploy/jms hsqldb-jdbc2-service.xml removed from server/jbpm/deploy/jms hsqldb-jdbc2-state-service.xml removed from server/jbpm/deploy/jms in jdpl/jar/src/main/config (or some other location) edited with oracle-specific properties Jeff