3 Replies Latest reply on Jun 3, 2013 1:02 PM by amizzo

    Error "Timeout trying to lock table 'PROCESSINSTANCELOG'"

    dimmordino

      I tried to deploy a simple process that just has 1 script task that prints something out, sleeps for a while and then prints something out again. I uploaded the bpmn to guvnor and built the package. I can see the process in the jbpm-console, but when i try to start an instance, and click refresh so that i can see the running instance, it gives me the following error in the logs:

       

      ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http--127.0.0.1-8080-2) Timeout trying to lock table "PROCESSINSTANCELOG";

       

      Is there a step i'm missing? maybe a persistence configuration change somewhere? I am using whatever configuration comes with the demo install.

       

      thanks,

         Dave

        • 1. Re: Error "Timeout trying to lock table 'PROCESSINSTANCELOG'"
          amizzo

          I am having the same problem!

          I think, too, that the Script Task cannot be persistent. I can see

           

          jbpm.console.task.service.strategy=HornetQ

           

          in the default.jbpm.console.properties file in the jBPM console server war, but I don't know what to put here to disable the task persistence

           

           

          • 2. Re: Error "Timeout trying to lock table 'PROCESSINSTANCELOG'"
            dimmordino

            Unfortunately i did not resolve this issue. I have moved on to using another BPM product.

            • 3. Re: Error "Timeout trying to lock table 'PROCESSINSTANCELOG'"
              amizzo

              Finally I understood why we receive this error.

              The script task should not sleep. If you need to process some time consuming task, you should register your own workitemhandler (through the session.template file).

               

              Something like the following:

               

               

               

              public class MizzoTaskHandler  implements WorkItemHandler {

                private WorkItemManager workItemManager;

                private WorkItem workItem;

                private long workItemId;

                private Map results;

                private StatefulKnowledgeSession ksession;

               

               

                public MizzoTaskHandler(StatefulKnowledgeSession ksession){

                  this.ksession = ksession;

                }

               

                public void executeWorkItem(WorkItem workItem, WorkItemManager workItemManager) {

                  this.workItemId = workItem.getId();

                  this.workItemManager = workItemManager;

                  this.workItem = workItem;

                  System.out.println("exec:" + workItemId);

                  results = new HashMap();

                  Thread th=new Thread(){

                    public void run(){

                      results.put("testWH",testleggiQ());

                      ksession.getWorkItemManager().completeWorkItem(workItemId,results);

                    }

                  };

                  th.start();

                }

               

               

                public void abortWorkItem(WorkItem workItem, WorkItemManager workItemManager) {

               

               

                }

               

               

                public void completeWorkItem() {

                  workItemManager.completeWorkItem(workItemId, results);

                }

                public static String testleggiQ() {

                  QueueConnection jmsConnection = null;

                  QueueSession jmsSession = null;

                  MessageConsumer receiver = null;

                  try {

                    Hashtable env = new Hashtable();

                    env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");

               

               

                    env.put(Context.PROVIDER_URL, "jnp://127.0.0.1:1099");

               

               

                    InitialContext iniCtx = new InitialContext(env);

                    Object tmp = iniCtx.lookup("ConnectionFactory");

                    QueueConnectionFactory tcf = (QueueConnectionFactory)tmp;

                    jmsConnection = tcf.createQueueConnection();

               

               

                    // jmsConnection.setClientID((String)contextResources.get("JMS_CLIENT_ID"));

                    Queue qu = (Queue)iniCtx.lookup("queue/testQIn");

                    jmsSession = jmsConnection.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);

                    receiver = jmsSession.createConsumer(qu);

                    jmsConnection.start();

                    TextMessage msg = (TextMessage)receiver.receive();

               

               

                    return msg.getText();

                  }

                  catch (Exception ex) {

                    ex.printStackTrace();

                  }

                  finally {

                    try {

                      if (receiver != null)

                        receiver.close();

                      if (jmsSession != null)

                        jmsSession.close();

                      if (jmsConnection != null)

                        jmsConnection.close();

                    }

                    catch (Exception ex2) {

                      ex2.printStackTrace();

                    }

                  }

                  return "";

                }

              }