I dont know the exact way to execute it but I was following the steps given in towards the end of chapter 7 of jBPM docs given in the jboss site.
For your reference I am giving the code below.Kindly look into it and give some suggestions.
Also tell me wheather I can find any autogenerated log file as we find in other tools like savvion to monitor the process.
package sample;
import org.drools.KnowledgeBase;
import org.drools.KnowledgeBaseFactory;
import org.drools.builder.KnowledgeBuilder;
import org.drools.builder.KnowledgeBuilderFactory;
import org.drools.builder.ResourceType;
import org.drools.io.ResourceFactory;
import org.drools.persistence.jpa.JPAKnowledgeService;
import org.drools.runtime.StatefulKnowledgeSession;
import org.jbpm.process.audit.JPAWorkingMemoryDbLogger;
//import org.jbpm.test.JBPMHelper;
public class historyLog {
/**
* @param args
*/
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
//JBPMHelper.startH2Server();
//JBPMHelper.setupDataSource();
//EntityManagerFactory emf =
// Persistence.createEntityManagerFactory( "org.jbpm.persistence.jpa" );
org.drools.runtime.Environment env = KnowledgeBaseFactory.newEnvironment();
KnowledgeBase kbase = readKnowledgeBase();
//StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
//JPAWorkingMemoryDbLogger logger = new JPAWorkingMemoryDbLogger(ksession);
StatefulKnowledgeSession ksession = JPAKnowledgeService.newStatefulKnowledgeSession(kbase, null, env);
JPAWorkingMemoryDbLogger jbpmLogger = new JPAWorkingMemoryDbLogger(ksession);
ksession.startProcess("sample.bpmn.hh");
// do stuff (start processes, etc...)
jbpmLogger.dispose();
//logger.dispose();
}
private static KnowledgeBase readKnowledgeBase() throws Exception {
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newClassPathResource("demo2.bpmn"), ResourceType.BPMN2);
return kbuilder.newKnowledgeBase();
}
}