gpt4 book ai didi

java - Drools 流持久性 - 未找到命名查询 : ProcessInstancesWaitingForEvent

转载 作者:行者123 更新时间:2023-12-02 08:19:54 29 4
gpt4 key购买 nike

我在 drools 流持久性 (MySQL) 方面遇到问题,出现以下异常:

2011-04-15 14:38:27,244 INFO  [STDOUT] (http-0.0.0.0-8000-5) Hibernate: insert into ProcessInstanceInfo (externalVariables, lastModificationDate, lastReadDate, processId, processInstanceByteArray, startDate, state, OPTLOCK) values (?, ?, ?, ?, ?, ?, ?, ?)

2011-04-15 14:38:27,244 INFO [STDOUT] (http-0.0.0.0-8000-5) Hello World

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) java.lang.RuntimeException: Could not commit session

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.drools.persistence.session.SingleSessionCommandService.execute(SingleSessionCommandService.java:292)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.drools.command.impl.CommandBasedStatefulKnowledgeSession.startProcess(CommandBasedStatefulKnowledgeSession.java:193)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.drools.command.impl.CommandBasedStatefulKnowledgeSession.startProcess(CommandBasedStatefulKnowledgeSession.java:184)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at com.servlet.Servlet.doGet(Servlet.java:101)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at javax.servlet.http.HttpServlet.service(HttpServlet.java:734)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:324)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:181)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.event(CatalinaContext.java:285)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.invoke(CatalinaContext.java:261)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:88)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:100)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:53)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:654)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at java.lang.Thread.run(Thread.java:619)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) Caused by: java.lang.IllegalArgumentException: Named query not found: ProcessInstancesWaitingForEvent

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.hibernate.ejb.AbstractEntityManagerImpl.createNamedQuery(AbstractEntityManagerImpl.java:455)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.drools.persistence.processinstance.JPASignalManager.getProcessInstancesForEvent(JPASignalManager.java:32)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.drools.persistence.processinstance.JPASignalManager.signalEvent(JPASignalManager.java:21)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.drools.workflow.instance.impl.WorkflowProcessInstanceImpl.setState(WorkflowProcessInstanceImpl.java:270)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.drools.workflow.instance.impl.WorkflowProcessInstanceImpl.nodeInstanceCompleted(WorkflowProcessInstanceImpl.java:421)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.drools.workflow.instance.node.EndNodeInstance.internalTrigger(EndNodeInstance.java:62)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.drools.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:117)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.drools.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:178)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.drools.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:144)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.drools.workflow.instance.node.ActionNodeInstance.triggerCompleted(ActionNodeInstance.java:62)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.drools.workflow.instance.node.ActionNodeInstance.internalTrigger(ActionNodeInstance.java:58)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.drools.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:117)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.drools.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:178)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.drools.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:144)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.drools.workflow.instance.node.StartNodeInstance.triggerCompleted(StartNodeInstance.java:49)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.drools.workflow.instance.node.StartNodeInstance.internalTrigger(StartNodeInstance.java:41)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.drools.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:117)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.drools.ruleflow.instance.RuleFlowProcessInstance.internalStart(RuleFlowProcessInstance.java:32)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.drools.process.instance.impl.ProcessInstanceImpl.start(ProcessInstanceImpl.java:192)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.drools.workflow.instance.impl.WorkflowProcessInstanceImpl.start(WorkflowProcessInstanceImpl.java:309)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.drools.common.AbstractWorkingMemory.startProcess(AbstractWorkingMemory.java:1644)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.drools.impl.StatefulKnowledgeSessionImpl.startProcess(StatefulKnowledgeSessionImpl.java:306)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.drools.command.runtime.process.StartProcessCommand.execute(StartProcessCommand.java:99)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.drools.command.runtime.process.StartProcessCommand.execute(StartProcessCommand.java:38)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) at org.drools.persistence.session.SingleSessionCommandService.execute(SingleSessionCommandService.java:279)

2011-04-15 14:38:27,244 ERROR [STDERR] (http-0.0.0.0-8000-5) ... 24 more

我到处都读到必须将 orm.xml 文件放置在我的 META-INF 文件夹中(我已经这样做了),其中包含以下内容:

<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_1_0.xsd"
version="1.0">
<named-query name="ProcessInstancesWaitingForEvent">
<query>
select
processInstanceInfo.processInstanceId
from
ProcessInstanceInfo processInstanceInfo
where
:type in elements(processInstanceInfo.eventTypes)
</query>
</named-query>
</entity-mappings>

但它仍然抛出异常,你可以看看我昨天问的上一个问题中的配置文件,HERE

这让我发疯,感谢任何帮助或想法。

最佳答案

当您部署到应用程序服务器时,默认情况下它可能并不总是能够获取 META-INF 目录中的 orm.xml。解决这个问题的最佳方法通常是创建一个自定义 orm 文件(在本例中是 META-INF 目录中的 JBPMorm.xml)并将映射直接添加到 persistence.xml:

<persistence-unit name="org.jbpm.persistence.jpa" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:jdbc/testDS1</jta-data-source>
<mapping-file>META-INF/JBPMorm.xml</mapping-file>
...

关于java - Drools 流持久性 - 未找到命名查询 : ProcessInstancesWaitingForEvent,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5676940/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com