0 Replies Latest reply on Sep 23, 2008 5:25 PM by Ben M

    Constraint Violation

    Ben M Newbie

      I'm trying to develop a simple example using jBPM and Spring. I keep getting Constraint Violations when inserting into the database - i've got the following configuration:


      jbpm.cfg:

       <jbpm-context>
       <service name="persistence">
       <factory>
       <bean class="org.jbpm.persistence.db.DbPersistenceServiceFactory">
       <field name="isTransactionEnabled"><false/></field>
       </bean>
       </factory>
       </service>
       <service name="tx" factory="org.jbpm.tx.TxServiceFactory" />
       <!-- <service name="message" factory="org.jbpm.msg.db.DbMessageServiceFactory" />-->
       <service name="scheduler" factory="org.jbpm.scheduler.db.DbSchedulerServiceFactory" />
       <service name="logging" factory="org.jbpm.logging.db.DbLoggingServiceFactory" />
       <!-- <service name="authentication" factory="org.jbpm.security.authentication.DefaultAuthenticationServiceFactory" />-->
       </jbpm-context>


      context:
       <bean id="jbpmConfiguration" class="org.springmodules.workflow.jbpm31.LocalJbpmConfigurationFactoryBean">
       <property name="configuration" value="classpath:jbpm.cfg.xml" />
       <property name="sessionFactory"><util:property-path path="entityManagerFactory.sessionFactory" /></property>
       <property name="createSchema" value="false" />
       <!-- <property name="processDefinitionsResources" value="classpath:approvalWorkflow.xml" />-->
       </bean>
      
       <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
       <property name="sessionFactory"><util:property-path path="entityManagerFactory.sessionFactory" /></property>
       <property name="exposeNativeSession" value="false"/>
       </bean>
      
       <!-- jBPM template -->
       <bean id="jbpmTemplate"
       class="org.springmodules.workflow.jbpm31.JbpmTemplate">
       <constructor-arg index="0" ref="jbpmConfiguration" />
       <constructor-arg index="1" ref="approvalProcessDefinition" />
       <property name="hibernateTemplate" ref="hibernateTemplate"/>
       </bean>
      


      Application Code:

       public void deployProcessDefinition() {
       jbpmTemplate.execute(new JbpmCallback() {
       public Object doInJbpm(JbpmContext context) {
       context.deployProcessDefinition(getApprovalProcessDefinition());
       return null;
       }
       });
       System.out.println("Completed deploying Process Definition");
       }
      




      I'm getting the following error when I call this method to deploy the process (I realize i shoudl really be deploying once, but as I said this is just a POC).

      Note: I am using HSQLDB running in Tomcat

      27375 WARN [http-8080-Processor23] util.JDBCExceptionReporter - SQL Error: -177, SQLState: 23000 - 127.0.0.1|
      27375 ERROR [http-8080-Processor23] util.JDBCExceptionReporter - Integrity constraint violation - no parent FK_NODE_PROCDEF table: JBPM_PROCESSDEFINITION in statement [insert into JBPM_NODE (ID_, NAME_, DESCRIPTION_, PROCESSDEFINITION_, ISASYNC_, ISASYNCEXCL_, ACTION_, SUPERSTATE_, CLASS_) values (null, ?, ?, ?, ?, ?, ?, ?, 'R')] - 127.0.0.1|
      27391 ERROR [http-8080-Processor23] [/test-webapp].[springDemo] - Servlet.service() for servlet springDemo threw exception - 127.0.0.1|
      java.sql.SQLException: Integrity constraint violation - no parent FK_NODE_PROCDEF table: JBPM_PROCESSDEFINITION in statement [insert into JBPM_NODE (ID_, NAME_, DESCRIPTION_, PROCESSDEFINITION_, ISASYNC_, ISASYNCEXCL_, ACTION_, SUPERSTATE_, CLASS_) values (null, ?, ?, ?, ?, ?, ?, ?, 'R')]
       at org.hsqldb.jdbc.Util.throwError(Unknown Source)
       at org.hsqldb.jdbc.jdbcPreparedStatement.executeUpdate(Unknown Source)
       at org.hibernate.id.insert.AbstractSelectingDelegate.performInsert(AbstractSelectingDelegate.java:33)
       at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2163)
       at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2643)
       at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:51)
       at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
       at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:298)
       at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:181)
       at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:107)
       at org.hibernate.ejb.event.EJB3SaveOrUpdateEventListener.saveWithGeneratedId(EJB3SaveOrUpdateEventListener.java:43)
       at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:187)
       at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:172)
       at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:94)
       at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
       at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:507)
       at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:499)
       at org.hibernate.engine.CascadingAction$5.cascade(CascadingAction.java:218)
       at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268)
       at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:216)
       at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
       at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:296)
       at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:242)
       at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:219)
       at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
       at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
       at org.hibernate.event.def.AbstractSaveEventListener.cascadeAfterSave(AbstractSaveEventListener.java:456)
       at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:334)
       at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:181)
       at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:107)
       at org.hibernate.ejb.event.EJB3SaveEventListener.saveWithGeneratedId(EJB3SaveEventListener.java:43)
       at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:187)
       at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
       at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:172)
       at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
       at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
       at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:535)
       at org.hibernate.impl.SessionImpl.save(SessionImpl.java:523)
       at org.hibernate.impl.SessionImpl.save(SessionImpl.java:519)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.springframework.orm.hibernate3.HibernateTemplate$CloseSuppressingInvocationHandler.invoke(HibernateTemplate.java:1219)
       at $Proxy42.save(Unknown Source)
       at org.jbpm.db.GraphSession.deployProcessDefinition(GraphSession.java:77)
       at org.jbpm.JbpmContext.deployProcessDefinition(JbpmContext.java:173)
       at com.test.service.impl.ApprovalWorkFlowServiceImpl$1.doInJbpm(ApprovalWorkFlowServiceImpl.java:45)
       at org.springmodules.workflow.jbpm31.JbpmTemplate$1.doInHibernate(JbpmTemplate.java:86)
       at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:373)
       at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:338)
       at org.springmodules.workflow.jbpm31.JbpmTemplate.execute(JbpmTemplate.java:79)
       at com.test.service.impl.ApprovalWorkFlowServiceImpl.deployProcessDefinition(ApprovalWorkFlowServiceImpl.java:43)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:301)
       at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
       at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
       at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
       at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
       at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
       at $Proxy41.deployProcessDefinition(Unknown Source)
       at com.test.presentation.WorkflowDemoController.handleRequest(WorkflowDemoController.java:44)
       at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
       at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:874)
       at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:808)
       at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:476)
       at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:431)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
       at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:119)
       at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:55)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
       at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
       at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
       at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
       at java.lang.Thread.run(Thread.java:595)


      Any suggestions of what i've got configured improperly that is leading to these Constraint Violations would be very much appreciated