2 Replies Latest reply on Jun 6, 2006 7:43 PM by Imran Naqvi

    Exception suspending a process

    Imran Naqvi Newbie


      I have the following process definition:

      <process-definition>
       <start-state>
       <transition to='CreateWOHandler'/>
       </start-state>
       <node name='CreateWOHandler'>
       <action class='DTVProcess.CreateWOHandler' />
      
       <transition to='XPort'/>
       </node>
       <node name='XPort'>
       <action class='XPortHandler' />
       <transition to='VTPS'/>
       </node>
       <node name='VTPS'>
       <action class='VTPSHandler' />
       <transition to='BFRename'/>
       </node>
       <node name='BFRename'>
       <action class='BFRenameHandler' />
       <transition to='end'/>
       </node>
       <end-state name='end' />
      </process-definition>
      
      




      I save this provess defintion and then run an insatnce of it:


      
      processDefinition2.setName("CustomNodeTest");
       JbpmConfiguration config = JbpmConfiguration.getInstance();
       JbpmContext context = config.createJbpmContext();
       context.getGraphSession().saveProcessDefinition(processDefinition2);
      
       ProcessInstance loadedProcessInstance = new ProcessInstance(processDefinition2);
       context.save(loadedProcessInstance);
       loadedProcessInstance.signal();
      
      


      No I am susoending the process in one of the Action handlers ('XPortHandler'), as soon as I do this I get an exception thrown from the MessagingSession.SuspendMessages(Token token)



      
      10:45:44,162 [main] ERROR JDBCExceptionReporter : [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Invalid column name 'token'.
       at org.jbpm.graph.exe.Token.signal(Token.java:123)
       at org.jbpm.graph.exe.ProcessInstance.signal(ProcessInstance.java:217)
       at DTVProcess.WorkorderProcess.testNodeActions(WorkorderProcess.java:120)
       at DTVProcess.WorkorderProcess.main(WorkorderProcess.java:172)
      Caused by: org.jbpm.graph.def.DelegationException
       at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:349)
       at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:343)
       at org.jbpm.graph.def.Node.execute(Node.java:332)
       at org.jbpm.graph.def.Node.enter(Node.java:316)
       at org.jbpm.graph.def.Transition.take(Transition.java:119)
       at org.jbpm.graph.def.Node.leave(Node.java:382)
       at org.jbpm.graph.def.Node.leave(Node.java:346)
       at org.jbpm.graph.exe.ExecutionContext.leaveNode(ExecutionContext.java:120)
       at DTVProcess.CreateWOHandler.execute(CreateWOHandler.java:28)
       at org.jbpm.graph.def.Action.execute(Action.java:123)
       at org.jbpm.graph.def.Node.execute(Node.java:328)
       ... 9 more
      Caused by: org.hibernate.exception.SQLGrammarException: could not execute update query
       at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:65)
       at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
       at org.hibernate.hql.ast.exec.BasicExecutor.execute(BasicExecutor.java:84)
       at org.hibernate.hql.ast.QueryTranslatorImpl.executeUpdate(QueryTranslatorImpl.java:326)
       at org.hibernate.engine.query.HQLQueryPlan.performExecuteUpdate(HQLQueryPlan.java:202)
       at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:1111)
       at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:94)
       at org.jbpm.db.MessagingSession.suspendMessages(MessagingSession.java:125)
       at org.jbpm.msg.db.DbMessageService.suspendMessages(DbMessageService.java:63)
       at org.jbpm.graph.exe.Token.suspendMessages(Token.java:507)
       at org.jbpm.graph.exe.Token.suspend(Token.java:482)
       at org.jbpm.graph.exe.ProcessInstance.suspend(ProcessInstance.java:287)
       at DTVProcess.XPortHandler.execute(XPortHandler.java:20)
       at org.jbpm.graph.def.Action.execute(Action.java:123)
       at org.jbpm.graph.def.Node.execute(Node.java:328)
       ... 17 more
      Caused by: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Invalid column name 'token'.
       at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
       at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
       at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source)
       at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source)
       at com.microsoft.jdbc.sqlserver.tds.TDSRPCRequest.processReplyToken(Unknown Source)
       at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source)
       at com.microsoft.jdbc.sqlserver.SQLServerImplStatement.getNextResultType(Unknown Source)
       at com.microsoft.jdbc.base.BaseStatement.commonTransitionToState(Unknown Source)
       at com.microsoft.jdbc.base.BaseStatement.postImplExecute(Unknown Source)
       at com.microsoft.jdbc.base.BasePreparedStatement.postImplExecute(Unknown Source)
       at com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown Source)
       at com.microsoft.jdbc.base.BaseStatement.executeUpdateInternal(Unknown Source)
       at com.microsoft.jdbc.base.BasePreparedStatement.executeUpdate(Unknown Source)
       at org.hibernate.hql.ast.exec.BasicExecutor.execute(BasicExecutor.java:75)
       ... 29 more
      
      



      If I dont save the process definition at the begining, it goes through fine. Please let me know if you see a problem.
      Imran

        • 1. Re: Exception suspending a process
          Imran Naqvi Newbie

          I ran it again this time with the ShowSql property of hibernate set to true and here is the Sql which causes the error:

          update JBPM_MESSAGE set ISSUSPENDED_=1 where token=?
          



          now there is no column named token in the JBPM_Message table, the column name is token_. I have checked the hibernate mapping files for Message and Token and both appear to be fine, I havent changed them. Could there be any other reason the query isnt being generated correctly?

          • 2. Re: Exception suspending a process
            Imran Naqvi Newbie

            I'm not sure if this would help but I thought I would post the code where I am suspending the process:

            public void execute(ExecutionContext executionContext) throws Exception {
             System.out.print("XPort processing...");
             executionContext.getProcessInstance().suspend();
             executionContext.leaveNode();
            }