Hide Forgot
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.
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>
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.
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+).
Please verify the issue on 5.3 ER4.
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