0

我有一个流口水持久性(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>

但它仍然会抛出该异常,您可以在我昨天问的上一个问题中查看我的配置文件,这里

这让我发疯,任何帮助或想法表示赞赏。

4

1 回答 1

2

当您部署到应用程序服务器时,默认情况下它可能无法始终获取 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>
    ...

克里斯

于 2011-04-15T20:15:17.753 回答