4 Replies Latest reply on Dec 7, 2012 1:45 AM by Maciej Swiderski

    While i try to load the JBPMorm.xml and ProcessInstanceInfo.hbm.xml files in the persistence.xml file,it break out

    星兰 蒋 Newbie

      Caused by: org.hibernate.DuplicateMappingException: Duplicate collection role mapping org.jbpm.persistence.processinstance.ProcessInstanceInfo.eventTypes

      at org.hibernate.cfg.Mappings.addCollection(Mappings.java:147)

      at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2085)

      at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2060)

      at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:381)

      at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:295)

      at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:166)

      at org.hibernate.cfg.Configuration.add(Configuration.java:716)

      at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:531)

      at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:291)

      at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1162)

      at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1226)

      at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:173)

      at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:854)

      at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:425)

      at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:131)

      at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:224)

      at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:291)

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)

      ... 46 more

        • 2. Re: While i try to load the JBPMorm.xml and ProcessInstanceInfo.hbm.xml files in the persistence.xml file,it break out
          Jiri Svitak Novice

          Try to comment out ProcessInstanceInfo.hbm.xml. If it won't help, send here your persistence.xml file and Hibernate version.

          1 of 1 people found this helpful
          • 3. Re: While i try to load the JBPMorm.xml and ProcessInstanceInfo.hbm.xml files in the persistence.xml file,it break out
            星兰 蒋 Newbie

            Hi Jiri,

             

            Thanks for you reply very much.

             

            But it seems the ProcessInstanceInfo.hbm.xml file is a must file!

             

            Because the following Exception is caught while i try to  complete a process.

             

            org.jbpm.workflow.instance.WorkflowRuntimeException: [com.sogou.ka.contract:1 - End:14] -- Named query not found: ProcessInstancesWaitingForEvent
            at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:130)
            at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:205)
            at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:164)
            at org.jbpm.workflow.instance.impl.ExtendedNodeInstanceImpl.triggerCompleted(ExtendedNodeInstanceImpl.java:47)
            at org.jbpm.workflow.instance.node.StateBasedNodeInstance.triggerCompleted(StateBasedNodeInstance.java:162)
            at org.jbpm.workflow.instance.node.StateBasedNodeInstance.triggerCompleted(StateBasedNodeInstance.java:143)
            at org.jbpm.workflow.instance.node.WorkItemNodeInstance.triggerCompleted(WorkItemNodeInstance.java:239)
            at org.jbpm.workflow.instance.node.HumanTaskNodeInstance.triggerCompleted(HumanTaskNodeInstance.java:90)
            at org.jbpm.workflow.instance.node.WorkItemNodeInstance.workItemCompleted(WorkItemNodeInstance.java:301)
            at org.jbpm.workflow.instance.node.WorkItemNodeInstance.signalEvent(WorkItemNodeInstance.java:277)
            at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.signalEvent(WorkflowProcessInstanceImpl.java:326)
            at org.drools.persistence.jpa.processinstance.JPAWorkItemManager.completeWorkItem(JPAWorkItemManager.java:121)
            at org.drools.command.runtime.process.CompleteWorkItemCommand.execute(CompleteWorkItemCommand.java:69)
            at org.drools.command.runtime.process.CompleteWorkItemCommand.execute(CompleteWorkItemCommand.java:32)
            at org.drools.command.impl.DefaultCommandService.execute(DefaultCommandService.java:36)
            at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:367)
            at org.drools.command.impl.CommandBasedStatefulKnowledgeSession$1.completeWorkItem(CommandBasedStatefulKnowledgeSession.java:150)
            at org.jbpm.task.service.hornetq.CommandBasedHornetQWSHumanTaskHandler$GetResultContentResponseHandler.execute(CommandBasedHornetQWSHumanTaskHandler.java:308)
            at org.jbpm.task.service.TaskClientHandler.messageReceived(TaskClientHandler.java:153)
            at org.jbpm.task.service.hornetq.HornetQTaskClientHandler.messageReceived(HornetQTaskClientHandler.java:56)
            at org.jbpm.task.service.hornetq.HornetQTaskClientConnector$1.run(HornetQTaskClientConnector.java:120)
            at java.lang.Thread.run(Unknown Source)
            Caused by: java.lang.IllegalArgumentException: Named query not found: ProcessInstancesWaitingForEvent
            at org.hibernate.ejb.AbstractEntityManagerImpl.createNamedQuery(AbstractEntityManagerImpl.java:108)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
            at java.lang.reflect.Method.invoke(Unknown Source)
            at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:358)
            at $Proxy28.createNamedQuery(Unknown Source)
            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.workflow.instance.impl.WorkflowProcessInstanceImpl.setState(WorkflowProcessInstanceImpl.java:264)
            at org.jbpm.workflow.instance.node.EndNodeInstance.internalTrigger(EndNodeInstance.java:58)
            at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:124)
            ... 21 more
            16   07/12 09:59:24,825[Thread-12] ERROR service.hornetq.HornetQTaskClientConnector.run  - [com.sogou.ka.contract:1 - End:14] -- Named query not found: ProcessInstancesWaitingForEvent

            My persistence.xml file is:

             

            <persistence xmlns="http://java.sun.com/xml/ns/persistence"

                      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                      xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"

                      version="1.0">

                      <persistence-unit name="org.jbpm.persistence.jta"

                                transaction-type="JTA">



                                <provider>org.hibernate.ejb.HibernatePersistence</provider>



                                <!-- <jta-data-source>jdbc/jbpm-ds</jta-data-source> -->



                                <!-- Use this if you are using JPA1 / Hibernate3 -->



                                <!-- <mapping-file>META-INF/JBPMorm.xml</mapping-file>



                                <mapping-file>META-INF/ProcessInstanceInfo.hbm.xml</mapping-file>  -->



                                <!-- Use this if you are using JPA2 / Hibernate4 -->



                                <!--mapping-file>META-INF/JBPMorm-JPA2.xml</mapping-file -->







                                <class>org.drools.persistence.info.SessionInfo</class>



                                <class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>



                                <class>org.drools.persistence.info.WorkItemInfo</class>







                                <class>org.jbpm.process.audit.ProcessInstanceLog</class>



                                <class>org.jbpm.process.audit.NodeInstanceLog</class>



                                <class>org.jbpm.process.audit.VariableInstanceLog</class>







                                <properties>



                                          <property name="hibernate.max_fetch_depth" value="3" />



                                          <property name="hibernate.hbm2ddl.auto" value="create" />



                                          <property name="hibernate.show_sql" value="false" />



                                          <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />



                                          <property name="hibernate.transaction.manager_lookup_class"

                                                    value="org.hibernate.transaction.BTMTransactionManagerLookup" />



                                </properties>

                      </persistence-unit>

            </persistence>

            And i'm using Hibernate 3.

            • 4. Re: While i try to load the JBPMorm.xml and ProcessInstanceInfo.hbm.xml files in the persistence.xml file,it break out
              Maciej Swiderski Master

              remove this from your persistence.xml:

              <class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>

               

              as either specifying mapping or the class should be present, so they are mutually exclusive.

               

              HTH