Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 745721

Summary: Missing named query when persisting process
Product: [JBoss] JBoss Enterprise BRMS Platform 5 Reporter: Tomas Schlosser <tschloss>
Component: jBPM 5Assignee: Kris Verlaenen <kverlaen>
Status: CLOSED UPSTREAM QA Contact:
Severity: urgent Docs Contact:
Priority: unspecified    
Version: BRMS 5.3.0.GACC: kverlaen
Target Milestone: ---   
Target Release: BRMS 5.3.0.GA   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-02-10 03:14:18 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:
Embargoed:
Attachments:
Description Flags
Simple reproducer none

Description Tomas Schlosser 2011-10-13 08:12:32 UTC
Created attachment 527882 [details]
Simple reproducer

Description of problem:
When I try to persist RuleFlow process I get exception indicating named query 'ProcessInstancesWaitingForEvent' is undefined.

Version-Release number of selected component (if applicable):
BRMS-5.2.0.CR1

How reproducible:
Every time.

Steps to Reproduce:
1. create persisted knowledge session containing process definition
2. start the process
3. call fireAllRules()
  
Actual results:
Exception in thread "main" org.drools.RuntimeDroolsException: Unexpected exception executing action org.drools.common.RuleFlowGroupImpl$DeactivateCallback@2a7d2796
	at org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:1005)
	at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:734)
	at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:701)
	at org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:218)
	at org.drools.command.runtime.rule.FireAllRulesCommand.execute(FireAllRulesCommand.java:106)
	at org.drools.command.runtime.rule.FireAllRulesCommand.execute(FireAllRulesCommand.java:32)
	at org.drools.command.impl.DefaultCommandService.execute(DefaultCommandService.java:36)
	at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:331)
	at org.drools.command.impl.CommandBasedStatefulKnowledgeSession.fireAllRules(CommandBasedStatefulKnowledgeSession.java:244)
	at org.jboss.qa.brms.processpersistence.ProcessPersistenceTest.main(ProcessPersistenceTest.java:33)
Caused by: java.lang.IllegalArgumentException: Named query not found: ProcessInstancesWaitingForEvent
	at org.hibernate.ejb.AbstractEntityManagerImpl.createNamedQuery(AbstractEntityManagerImpl.java:455)
	at org.jbpm.persistence.JpaProcessPersistenceContext.getProcessInstancesWaitingForEvent(JpaProcessPersistenceContext.java:35)
	at org.jbpm.persistence.processinstance.JPASignalManager.getProcessInstancesForEvent(JPASignalManager.java:40)
	at org.jbpm.persistence.processinstance.JPASignalManager.signalEvent(JPASignalManager.java:23)
	at org.jbpm.process.instance.ProcessRuntimeImpl$3.afterRuleFlowGroupDeactivated(ProcessRuntimeImpl.java:350)
	at org.drools.event.AgendaEventSupport.fireAfterRuleFlowGroupDeactivated(AgendaEventSupport.java:168)
	at org.drools.common.RuleFlowGroupImpl.setActive(RuleFlowGroupImpl.java:148)
	at org.drools.common.RuleFlowGroupImpl$DeactivateCallback.execute(RuleFlowGroupImpl.java:312)
	at org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:1003)
	... 9 more

Expected results:
All relevant rules are fired

Additional info:
The given query is defined in jbpm-persistence-jpa.jar/META-INF/orm.xml, but is not loaded.

Comment 1 Tomas Schlosser 2011-10-20 11:27:23 UTC
It is possible to make it work by adding mapping file [1] efinition. However if you add all jBPM libraries to classpath, you get a conflict with orm.xml located in jbpm-human-task.jar/META-INF/orm.xml


[1] <mapping-file>META-INF/orm.xml</mapping-file>

Comment 4 Kris Verlaenen 2012-01-02 18:39:53 UTC
This has been improved in the jBPM 5.2 release (and will be available in the next build), where the orm.xml is renamed to a JBPMorm.xml and is references directly in the persistence.xml as a mapping-file.

Comment 6 Kris Verlaenen 2012-01-25 13:19:07 UTC
The persistence.xml should now always reference
<mapping-file>META-INF/JBPMorm.xml</mapping-file>
which is available in the jbpm-persistence jar.

This avoids any conflict with other mapping files and should work with the latest build (ER2+).

Comment 8 Ryan Zhang 2012-02-15 09:12:28 UTC
Please verify the issue on 5.3 ER4.

Comment 9 Tomas Schlosser 2012-02-22 11:17:03 UTC
The file was renamed and works now. However automatic loading of it does not happen. Please add to documentation, that user have to add that line to his persistence.xml

Comment 13 Red Hat Bugzilla 2025-02-10 03:14:18 UTC
This product has been discontinued or is no longer tracked in Red Hat Bugzilla.