Bug 745721 - Missing named query when persisting process
Summary: Missing named query when persisting process
Keywords:
Status: VERIFIED
Alias: None
Product: JBoss Enterprise BRMS Platform 5
Classification: JBoss
Component: jBPM 5
Version: BRMS 5.3.0.GA
Hardware: Unspecified
OS: Unspecified
unspecified
urgent
Target Milestone: ---
: BRMS 5.3.0.GA
Assignee: Kris Verlaenen
QA Contact: Radovan Synek
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-10-13 08:12 UTC by Tomas Schlosser
Modified: 2022-05-31 22:28 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug


Attachments (Terms of Use)
Simple reproducer (3.28 KB, application/x-zip-compressed)
2011-10-13 08:12 UTC, Tomas Schlosser
no flags Details

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


Note You need to log in before you can comment on or make changes to this bug.