-
1. Re: Error "Timeout trying to lock table 'PROCESSINSTANCELOG'"
amizzo May 31, 2013 6:22 AM (in response to dimmordino)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 May 31, 2013 10:04 AM (in response to amizzo)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 Jun 3, 2013 1:02 PM (in response to dimmordino)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 "";
}
}