1 Reply Latest reply on Jun 7, 2006 1:56 AM by cityofdestiny

    iam getting the roll back exception while closing the taskin

    mohan514

      hi,
      i am using the following code to close the task instance while writing the custom client for the BPM system.
      the code iam using is :
      jbpmContext = jbpmConfiguration.createJbpmContext();
      Connection conn=jbpmContext.getConnection();
      //conn.setAutoCommit(true);
      Transaction transaction = jbpmContext.getSession().beginTransaction();
      GraphSession graphSession = jbpmContext.getGraphSession();
      ProcessDefinition processDefinition = graphSession.loadProcessDefinition(processDefinitionId);
      System.out.println("the process definition is "+processDefinition);
      //ProcessInstance processInstance = processDefinition.createProcessInstance();
      ProcessInstance processInstance = jbpmContext.newProcessInstance(processDefinition.getName());
      System.out.println("the process instance is "+processInstance+"id is "+processInstance.getId());

      //processInstance.signal();

      //ProcessInstance processInstance =jbpmContext.newProcessInstance(processDefinition.getName());//new ProcessInstance(processDefinition);
      //processInstance = jbpmContext.loadProcessInstanceForUpdate(processInstance.getId());
      TaskInstance taskInstance = processInstance.getTaskMgmtInstance().createStartTaskInstance();
      System.out.println("the task instance is "+taskInstance);

      System.out.println("the task instance is "+taskInstance.getName());
      //this.initialize(taskInstance,taskFormParams);
      taskInstance.start();
      System.out.println(taskInstance.getId());
      //taskInstance.end();
      System.out.println("this is the date and tiem of creation fo the task instance"+taskInstance.getStart());
      try{
      taskInstance.end();
      }
      catch(Exception e)
      {
      System.out.println("this is the excetion comes at the end of the task instance"+e.fillInStackTrace());
      }
      jbpmContext.save(taskInstance);
      //jbpmContext.save(processInstance);
      //jbpmContext.getSession().flush();
      //jbpmContext.getSession().clear();
      transaction.commit();
      //processInstance.end();
      //conn.setAutoCommit(false);
      jbpmContext.close();


      tehn iam getting the following exception :
      it is eating all my time and resources.please help me to get out of thsi situation.


      StatefulPersi W org.hibernate.engine.StatefulPersistenceContext Narrowing proxy to class org.jbpm.graph.node.TaskNode - this operation breaks ==
      [6/2/06 12:11:16:047 IST] 711d6ced DbPersistence E org.jbpm.persistence.db.DbPersistenceService problem rolling back after failed commit
      [6/2/06 12:11:16:047 IST] 711d6ced DbPersistence E org.jbpm.persistence.db.DbPersistenceService TRAS0014I: The following exception was logged org.hibernate.TransactionException: Transaction not successfully started
      at org.hibernate.transaction.JTATransaction.rollback(JTATransaction.java:171)
      at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:165)
      at org.jbpm.svc.Services.close(Services.java:211)
      at org.jbpm.JbpmContext.close(JbpmContext.java:138)
      at com.yash.jbpm.client.Configuration.startProcessInstance(Configuration.java:195)
      at com.yash.jbpm.client.ProcessStarter.doPost(ProcessStarter.java:47)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
      at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
      at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
      at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
      at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
      at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
      at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
      at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:983)
      at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:564)
      at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:200)
      at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:119)
      at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:276)
      at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
      at com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:116)
      at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:186)
      at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
      at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
      at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:618)
      at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:439)
      at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:672


      "ANY HELP REGARDING THIS WILL BE APPRICIATED"
      Regards,
      mohan chokkakula.

        • 1. Re: iam getting the roll back exception while closing the ta
          cityofdestiny

          hi mohan,
          iam a new bie and iam also facing the same problem when iam trying to close teh task iam getting the warning and the transaction is rolling back .
          if u got the solution please let me know.

          GraphSession graphSession = jbpmContext.getGraphSession();
          ProcessDefinition processDefinition = graphSession.loadProcessDefinition(processDefinitionId);
          ProcessInstance processInstance = jbpmContext.newProcessInstance(processDefinition.getName());
          TaskInstance startTaskInstance = processInstance.getTaskMgmtInstance().createStartTaskInstance();
          List transitions = startTaskInstance.getAvailableTransitions();
          int size1 = transitions.size();
          String name ="";
          for(int i=0;i<size1;i++)
          {
          Transition transition = (Transition)transitions.get(i);
          name = transition.getName();
          }
          startTaskInstance.end(name);
          processInstance.signal();

          the excetion and the warnings that iam getting with this code is :

          W org.hibernate.engine.StatefulPersistenceContext Narrowing proxy to class org.jbpm.graph.node.TaskNode - this operation breaks ==
          [6/7/06 11:16:46:273 IST] a106acb StatefulPersi W org.hibernate.engine.StatefulPersistenceContext Narrowing proxy to class org.jbpm.graph.node.TaskNode - this operation breaks ==
          [6/7/06 11:16:46:352 IST] a106acb StatefulPersi W org.hibernate.engine.StatefulPersistenceContext Narrowing proxy to class org.jbpm.graph.node.TaskNode - this operation breaks ==
          [6/7/06 11:16:46:430 IST] a106acb SystemOut O this isafter the signal
          [6/7/06 11:16:46:602 IST] a106acb DbPersistence E org.jbpm.persistence.db.DbPersistenceService problem rolling back after failed commit
          [6/7/06 11:16:46:633 IST] a106acb DbPersistence E org.jbpm.persistence.db.DbPersistenceService TRAS0014I: The following exception was logged org.hibernate.TransactionException: Transaction not successfully started