Bug 780005 (SOA-2365)

Summary: jBPM does not work of-the-box with HashtableCacheProvider enabled
Product: [JBoss] JBoss Enterprise SOA Platform 5 Reporter: Jiri Pechanec <jpechane>
Component: JBPM - within SOAAssignee: Julian Coleman <jcoleman>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: urgent Docs Contact:
Priority: urgent    
Version: 5.1.0.ER2CC: alex.guizar, kevin.conner
Target Milestone: ---   
Target Release: 5.1.0 GA, 5.1.0.ER7   
Hardware: Unspecified   
OS: Unspecified   
URL: http://jira.jboss.org/jira/browse/SOA-2365
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-02-11 02:55:39 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
hibernate.cfg.xml.diff
none
hibernate.cfg.xml
none
hibernate.cfg.xml-2010-12-17.patch none

Description Jiri Pechanec 2010-10-01 09:01:49 UTC
project_key: SOA

org.jbpm.jbpm2608.JBPM2608Test.testFindJobsWithOverdueLockTime throws the following error

java.lang.NullPointerException
	at org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge.nextTimestamp(RegionFactoryCacheProviderBridge.java:90)
	at org.hibernate.impl.SessionFactoryImpl.openSession(SessionFactoryImpl.java:573)
	at org.hibernate.impl.SessionFactoryImpl.openSession(SessionFactoryImpl.java:582)
	at org.jbpm.persistence.db.DbPersistenceService.getSession(DbPersistenceService.java:109)
	at org.jbpm.JbpmContext.getSession(JbpmContext.java:587)
	at org.jbpm.db.AbstractDbTestCase.initializeMembers(AbstractDbTestCase.java:326)
	at org.jbpm.db.AbstractDbTestCase.createJbpmContext(AbstractDbTestCase.java:194)
	at org.jbpm.db.AbstractDbTestCase.setUp(AbstractDbTestCase.java:66)
	at org.jbpm.jbpm2608.JBPM2608Test.setUp(JBPM2608Test.java:45)

It seems that the root cause is similar to JBPAPP-4859
hibernate.cfg.xml contains HashtableCacheProvider enabled even in production which does not work for this case

Comment 1 Jiri Pechanec 2010-10-01 09:02:24 UTC
Link: Added: This issue is related to JBPAPP-4859


Comment 2 Alejandro Guizar 2010-10-01 23:24:37 UTC
Link: Added: This issue related SOA-1406


Comment 3 Alejandro Guizar 2010-10-01 23:24:38 UTC
I have spent a while configuring and testing JBoss Cache 1.4 and 2 as second-level cache provider for Hibernate 3.2 and 3.3 respectively, under SOA-1406. JBoss Cache is not enabled in the "standalone" jBPM configuration, only in the "enterprise" configuration, which SOA-P does not currently consume.

We need to work together in order to incorporate the "enterprise" configuration into the platform.

Comment 4 Alejandro Guizar 2010-10-26 23:17:16 UTC
Here is an outline of what needs to be done, based on my experience with JBoss AS. First off, it is worth noting that SOA-P 4.3 ships with Hibernate 3.2/JBC 1.4, whereas SOA-P 5 ships with Hibernate 3.3 and JBC 2. Each Hibernate/JBC combination needs to be configured differently.

1. Configure Hibernate to employ JBoss Cache as its 2nd level cache. Change the cache mode from "nonstrict-read-write" to "transactional"

2. For Hibernate 3.2/JBC 1.4, deploy a TreeCache MBean and add hibernate-jbc-cacheprovider.jar to the server configuration libraries.
In the case of Hibernate 3.3/JBC 2, a multiplexed cache is readily available in SOA-P 5.

3. Set up continuous integration. As a reference, the jbpm3-jbossXXX jobs start JBoss AS in the "all" configuration and specify a group name and multicast address. Afterwards the jobs run the jbpm-enterprise test suite.

Comment 5 Alejandro Guizar 2010-10-26 23:46:19 UTC
Attachment: Added: hibernate.cfg.xml.diff


Comment 6 Alejandro Guizar 2010-10-26 23:46:23 UTC
I am attaching a diff file containing the hibernate.cfg.xml changes required to switch to JBoss Cache, see step 1 above. The differences were generated with respect to SOA-P 5.1.0.ER2.

Comment 7 Kevin Conner 2010-11-26 14:15:36 UTC
I applied these changes to the current 5.1.0 ER and did not see any issues on startup, will get this added for clustered profiles.

Comment 8 Kevin Conner 2010-11-26 14:16:41 UTC
production config after applying the changes

Comment 9 Kevin Conner 2010-11-26 14:16:41 UTC
Attachment: Added: hibernate.cfg.xml


Comment 10 Kevin Conner 2010-11-26 14:54:34 UTC
Assigning to Julian as the platform build modifies this file.

Comment 11 Julian Coleman 2010-11-29 16:42:09 UTC
Resolved with revision 7419 of:

   build-tools/post-patch/add_jbpm_cache.xml
   build-tools/resource/add_jbpm_cache.xsl  

Commit message:

  SOA-2365 
  Use the clustered cache configuration for the clustered profiles (`all' and
  `production').


Comment 12 Julian Coleman 2010-11-29 16:42:09 UTC
Labels: Added: rn-dlesage


Comment 13 Julian Coleman 2010-11-29 16:47:59 UTC
The release notes entry should be something like:

  Use the clustered cache hibernate configuration for jBPM in the clustered profiles (`all' and 'production'),
  avoiding problems with the memory cache and clustering.  The memory cache remains configured for
  the non-clustered profile (`default').



Comment 14 Kevin Conner 2010-12-16 12:43:38 UTC
Link: Added: This issue related SOA-2652


Comment 15 Kevin Conner 2010-12-16 12:56:33 UTC
Unfortunately this issue is not complete.

The hibernate configuration uses default stack values for the jgroups configuration, conflicting with other deployments.  We need to have an explicit configuration which doesn't use those defaults and entries in the service bindings to allow them to be overridden.

Comment 16 Laura Bailey 2010-12-17 00:34:27 UTC
Writer: Added: dlesage


Comment 17 Laura Bailey 2010-12-17 00:38:31 UTC
Release Notes Docs Status: Added: Not Yet Documented


Comment 18 Alejandro Guizar 2010-12-17 21:56:30 UTC
The "Best Practices" section in the "Using JBoss Cache 2 with Hibernate" guide recommends "set[ting] hibernate.cache.region_prefix in your configuration. It makes it simple to ensure the different session factories don't step on each other if they share a JBoss Cache instance".

The hibernate.cfg.xml.diff file I attached earlier does not contain the hibernate.cache.region_prefix property. It should also employ JndiMultiplexedJBossCacheRegionFactory which "instead of instantiating its own CacheManager, looks for an existing one in JNDI [allowing for] sharing the various JBoss Cache instances across multiple Hibernate session factories".

I will work on a new patch file containing the above changes.

Comment 19 Alejandro Guizar 2010-12-17 22:36:19 UTC
WorklogId: Removed: 12423609 


Comment 20 Alejandro Guizar 2010-12-17 22:41:25 UTC
Attachment: Added: hibernate.cfg.xml-2010-12-17.patch


Comment 21 Alejandro Guizar 2010-12-17 22:41:26 UTC
Attaching patch to:
* Switch to JNDI multiplexed JBoss Cache region factory
* Provide an explicit cache region prefix.

Comment 22 Kevin Conner 2010-12-18 06:40:34 UTC
We need to have an explicit jgroups configuration, specified through the hibernate.cfg.xml, so that the contents can be modified as appropriate.  Part of this modification will be driven through the service bindings (see server/default/conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml for current examples)

Comment 23 Kevin Conner 2010-12-18 07:01:00 UTC
Sorry, missed the JndiMultiplexedJBossCacheRegionFactory change.  Ignore my last.

Comment 24 Julian Coleman 2010-12-22 16:35:04 UTC
Release Notes Text: Added: Resolved with revision 7713 of:
  build-tools/post-patch/add_jbpm_cache.xml
  build-tools/resource/add_jbpm_cache_2.xsl	(added)

Commit message: 
  SOA-2365
  Apply changes in "hibernate.cfg.xml-2010-12-17.patch" to hibernate.cfg.xml
  in all and production profiles.



Comment 26 Jiri Pechanec 2011-01-06 08:37:42 UTC
Verified in ER6 - configuration is in place

Comment 27 Julian Coleman 2011-01-13 11:56:33 UTC
Re-opening, as the clustered cache settings have been applied in revision 6874:

  http://anonsvn.jboss.org/repos/jbpm/jbpm3/branches/jbpm-3.2-soa/core/src/main/resources/hibernate.common.xml

and we need to account for this in the platform patches.

Comment 28 Julian Coleman 2011-01-13 12:13:16 UTC
Resolved with revision 7916 of:

  build-tools/post-patch/add_jbpm_cache.xml
  build-tools/resource/add_jbpm_cache_2.xsl		(removed)

Commit message:

  SOA-2365
  The clustered cache settings have been applied in revision 6874 of:

    http://anonsvn.jboss.org/repos/jbpm/jbpm3/branches/jbpm-3.2-soa/core/src/main/resources/hibernate.common.xml

  Remove these changes from the platform patch.


Comment 29 Julian Coleman 2011-01-13 12:13:16 UTC
Release Notes Text: Removed: Resolved with revision 7713 of:
  build-tools/post-patch/add_jbpm_cache.xml
  build-tools/resource/add_jbpm_cache_2.xsl	(added)

Commit message: 
  SOA-2365
  Apply changes in "hibernate.cfg.xml-2010-12-17.patch" to hibernate.cfg.xml
  in all and production profiles.
 Added: Use the clustered cache hibernate configuration for jBPM in the clustered
profiles (`all' and 'production'), avoiding problems with the memory cache
and clustering.  The jgroups configuration for the clustered cache has also
been enhanced to enable it to co-exist with other jgroups users.

Note, that the memory cache remains configured for the non-clustered
profile (`default').


Comment 30 Jiri Pechanec 2011-01-25 13:17:34 UTC
Verified in ER7

Comment 31 David Le Sage 2011-02-11 02:40:58 UTC
Temporarily reopening to update release note info.

Comment 32 David Le Sage 2011-02-11 02:54:21 UTC
Release Notes Docs Status: Removed: Not Yet Documented Added: Documented as Known Issue
Release Notes Text: Removed: Use the clustered cache hibernate configuration for jBPM in the clustered
profiles (`all' and 'production'), avoiding problems with the memory cache
and clustering.  The jgroups configuration for the clustered cache has also
been enhanced to enable it to co-exist with other jgroups users.

Note, that the memory cache remains configured for the non-clustered
profile (`default'). Added: https://issues.jboss.org/browse/SOA-2365

jBPM would not working if the HashtableCacheProvider was enabled. An exception would result.  Use the clustered cache hibernate configuration for jBPM in the clustered profiles (`all' and 'production') to avoiding problems with the memory cache
and clustering.  (The jgroups configuration for the clustered cache has also been enhanced to enable it to co-exist with other jgroups users.)

Note, that the memory cache remains configured for the non-clustered profile (`default').