Announcement Announcement Module
Collapse

Spring Modules forum decommissioned in favor of Spring Extensions

As the Spring Modules project has been replaced by the Spring Extensions (http://www.springsource.org/extensions) project, this forum has been decommissioned in favour of Spring Extensions one at:
http://forum.springsource.org/forumdisplay.php?f=44

Please see the Spring Extensions home page for a complete list of current projects in Java, .NET and ActionScript. You can also propose one if you want.

Cheers,
Costin Leau
SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
http://twitter.com/costinl
See more
See less
jbpm getting started Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • #31
    Redeploy issue!

    Hi Scott,

    I tried to employ your rather useful hack in order to prevent redeployment of process defintions across server restarts. CustomJbpmConfigurationFactoryBean works fine, however, as you mentioned to set the process definition to the Jbpm template manually, i have tried the following:

    Code:
            JbpmTemplate process1Template = (JbpmTemplate) ctx.getBean("jbpmTemplate");
            
            ProcessDefinition def = process1Template.getJbpmConfiguration().createJbpmContext().getGraphSession().findLatestProcessDefinition("process1");
            
            process1Template.setProcessDefinition(def);
    
            ProcessInstance processInstance = process1Template.getProcessDefinition().createProcessInstance();
            processInstance.signal();
            
            process1Template.saveProcessInstance(processInstance);
    which results in...

    Code:
    WARN [main] JDBCExceptionReporter.logExceptions(71) | SQL Error: 2291, SQLState: 23000
    ERROR [main] JDBCExceptionReporter.logExceptions(72) | ORA-02291: integrity constraint (JBPM.FK_PROCIN_ROOTTKN) violated - parent key not found
    
    WARN [main] JDBCExceptionReporter.logExceptions(71) | SQL Error: 2291, SQLState: 23000
    ERROR [main] JDBCExceptionReporter.logExceptions(72) | ORA-02291: integrity constraint (JBPM.FK_PROCIN_ROOTTKN) violated - parent key not found
    
    ERROR [main] AbstractFlushingEventListener.performExecutions(300) | Could not synchronize database state with session
    org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
    	at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
    	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
    	at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:202)
    	at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:91)
    	at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:86)
    	at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:171)
    	at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2048)
    	at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2427)
    	at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:51)
    	at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
    	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:232)
    	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
    	at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:297)
    	at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
    	at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:985)
    	at org.springframework.orm.hibernate3.HibernateAccessor.flushIfNecessary(HibernateAccessor.java:394)
    	at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:367)
    	at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:334)
    	at org.springmodules.workflow.jbpm31.JbpmTemplate.execute(JbpmTemplate.java:81)
    	at org.springmodules.workflow.jbpm31.JbpmTemplate.saveProcessInstance(JbpmTemplate.java:339)
    	at org.blah.blah.jbpm.JbpmTest.main(JbpmTest.java:51)
    Caused by: java.sql.BatchUpdateException: ORA-02291: integrity constraint (JBPM.FK_PROCIN_ROOTTKN) violated - parent key not found
    
    	at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:367)
    	at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:8739)
    	at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:58)
    	at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:195)
    	... 18 more
    and here is my spring context file
    Code:
        <!-- jBPM Configuration -->
        <bean id="jbpmConfig" class="org.blah.blah.jbpm.CustomLocalJbpmConfigurationFactoryBean">
    	<!-- pass in existing sessionFactory -->
    		<property name="sessionFactory" ref="jbpmSessionFactory"/>
    		<property name="configuration" value="org/blah/blah/jbpm/jbpm.cfg.xml"/>
    		<property name="processDefinitions">
    			<list>
    				<ref local="process1"/>
    			</list>
    		</property>
    		<property name="createSchema" value="false"/>
    	</bean>
    
    	<bean id="process1" class="org.springmodules.workflow.jbpm31.definition.ProcessDefinitionFactoryBean">
    		<property name="definitionLocation" value="org/blah/blah/jbpm/process/process1.xml"/>
    	</bean>
    
        
        <!-- jBPM template -->
    	<bean id="jbpmTemplate" class="org.springmodules.workflow.jbpm31.JbpmTemplate">
      		<constructor-arg index="0" ref="jbpmConfig"/>
      		<constructor-arg index="1" ref="process1"/>
    	</bean>
    Any help would be appreciated,

    Thanks

    meeru
    Last edited by meeru; Aug 15th, 2006, 09:37 PM.

    Comment


    • #32
      JbpmCallback

      Hi Meeru,

      I think the problem you are seeing is due to the fact that you are not performing your updates to the process in the same context as it was created in. If you wrap your create/signal/save in a JbpmCallback it should (I think) solve the problem. e.g.

      Code:
      process1Template.execute(new JbpmCallback() {
          
                  public Object doInJbpm(JbpmContext context) {
      
                       ProcessInstance inst = context.newProcessInstanceForUpdate("process");
                       inst.signal();
                       context.save(inst);
                       // dummy return 
                       return null;
                  }
              });
      This is what I've been using in my implementation and wrapping my interactions with the process/task instances into a callback works for me.

      If I'm talking rubbish here then hopefully someone on the forum will correct me.

      Regards,

      Scott

      Comment


      • #33
        Thanks for the immediate reply, I tried the following:
        Code:
                JbpmTemplate template = (JbpmTemplate) ctx.getBean("jbpmTemplate");
                
            	ProcessDefinition def = template.getJbpmConfiguration().createJbpmContext().getGraphSession().findLatestProcessDefinition("process1");
            	template.setProcessDefinition(def);
        
            	template.execute(new JbpmCallback() {
            	    
                    public Object doInJbpm(JbpmContext context) {
        
                         ProcessInstance inst = context.newProcessInstanceForUpdate("process1");
                         inst.signal();
                         context.save(inst);
                         // dummy return 
                         return null;
                    }
                })
        which gives me the following exception:
        Code:
        Exception in thread "main" org.hibernate.SessionException: Session is closed!
        	at org.hibernate.impl.AbstractSessionImpl.errorIfClosed(AbstractSessionImpl.java:49)
        	at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:526)
        	at org.hibernate.impl.SessionImpl.save(SessionImpl.java:518)
        	at org.hibernate.impl.SessionImpl.save(SessionImpl.java:514)
        	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.hibernate3.HibernateTemplate$CloseSuppressingInvocationHandler.invoke(HibernateTemplate.java:1205)
        	at $Proxy4.save(Unknown Source)
        	at org.jbpm.svc.save.HibernateSaveOperation.save(HibernateSaveOperation.java:38)
        	at org.jbpm.svc.Services.save(Services.java:156)
        	at org.jbpm.JbpmContext.save(JbpmContext.java:388)
        	at org.jbpm.JbpmContext.autoSave(JbpmContext.java:586)
        	at org.jbpm.JbpmContext.close(JbpmContext.java:137)
        	at org.springmodules.workflow.jbpm31.JbpmTemplate.releaseContext(JbpmTemplate.java:111)
        	at org.springmodules.workflow.jbpm31.JbpmTemplate.execute(JbpmTemplate.java:100)
        here is my spring config

        Code:
            <bean id="jbpmConfig" class="org.blah.blah.jbpm.CustomLocalJbpmConfigurationFactoryBean">
        	<!-- pass in existing sessionFactory -->
        		<property name="sessionFactory" ref="jbpmSessionFactory"/>
        		<property name="configuration" value="org/blah/blah/jbpm/jbpm.cfg.xml"/>
        	</bean>
        
        	<bean id="jbpmTemplate" class="org.springmodules.workflow.jbpm31.JbpmTemplate">
          		<constructor-arg index="0" ref="jbpmConfig"/>
        	</bean>
        however, this works like a charm for me:
        Code:
                JbpmConfiguration config = (JbpmConfiguration) ctx.getBean("jbpmConfig");
        
                JbpmContext context = config.createJbpmContext();
        
            	ProcessDefinition def = context.getGraphSession().findLatestProcessDefinition("process1");
        
                ProcessInstance in = def.createProcessInstance();
                ContextInstance cn = in.getContextInstance();
                List l = new ArrayList();
                l.add("batman");
                l.add("joker");
                cn.setVariable("list", l);
                in.signal();
                context.save(in);
            	context.close();
        I am bypassing the jbpm template altogether, I can use the above solution for now, although would love to get the jbpm template working.

        Thanks,

        meeru
        Last edited by meeru; Aug 16th, 2006, 01:20 PM.

        Comment


        • #34
          Hello! Is the Spring Modules CVS still the best place to to try and find an example of jBPM 3.1 + Spring configs? Any other suggestions? Just getting stareted and looking for all of the most up to date resources. Thanks!

          d

          Comment


          • #35
            Meeru,

            Funny that I replied to this below when I was just starting to use jbpm plus Spring... Now I am in the same boat that you were in with the JBPMUSER.FK_PROCIN_ROOTTKN violation error. Do you have any more insight into this? I am doing the same thing you were, so I will try the solution recommended to you, and the other solution.

            The big problem is that the error is not consistantly repeatable -- i have to use dht app for a while before it shows up. So... it's hard for me to do quick fixes and testing.

            Anyways, if anyone else working has experienced this and wants to share ideas/suggestions they would be GREATLY appreciated! =D

            d

            [2007-04-23 13:22:00,087] DEBUG org.hibernate.SQL insert into JBPM_PROCESSINSTANCE (VERSION_, START_, END_, ISSUSPENDED_, PROCESSDEFINITION_, ROOTTOKEN_, SUPERPROCESSTOKEN_, ID_) values (?, ?, ?, ?, ?, ?, ?, ?)
            [2007-04-23 13:22:00,103] WARN org.hibernate.util.JDBCExceptionReporter SQL Error: 2291, SQLState: 23000
            [2007-04-23 13:22:00,103] ERROR org.hibernate.util.JDBCExceptionReporter ORA-02291: integrity constraint (JBPMUSER.FK_PROCIN_ROOTTKN) violated - parent key not found
            ------------------ </log snippet> -----------------------------------------


            ps: i've been working with the jBPM support staff at RedHat for weeks trying to track this down. I think it has something to do with the Spring integration which is why they are having trouble solving... which matches the ideas suggested in this thread!!

            Comment


            • #36
              dlevine, you could try using JBpm w/o the Spring integration if you think it affects it though that is not the case. If you take a look at the sources, you'll notice that the 'wrapping' layer doesn't do any logic of itself especially not forcing updated on the database.
              The database integrity is likely caused by an incomplete operation to the database probably done through Hibernate.
              Try turning logging on to see if you could reproduce the problem.. What version of JBPM are you using?

              Comment


              • #37
                The think the possible cause for FK_PROCIN_ROOTTKN violation error is that the token is not inserted into the database before processinstance (ie. insertion is not in order)... - its not related to spring, but with jbpm itself... (im using jbpm without spring)

                The transactionmanager might also be playing a role in this issue i believe...

                I'm still facing this problem(occasionally... yes!!)

                Any idea/approach/solution for this issue will be truly appreciable...
                Last edited by Jasphior; Apr 1st, 2009, 02:03 AM.

                Comment


                • #38
                  Hi

                  ..........

                  Comment


                  • #39
                    Any help?

                    I have the same problem with FK_PROCIN_ROOTTKN.
                    I'm trying to start process via WS and this happens.
                    But when process is started via GUI with a button everything is good.
                    I also will be gratefull 4 any ideas

                    Comment


                    • #40
                      Idea

                      I think that helps adding
                      @TransactionManagement(TransactionManagementType.B EAN)
                      to WS class

                      Comment

                      Working...
                      X