Xiaojun Hou [
http://community.jboss.org/people/houxiaojun] created the discussion
"Re: 0 With jBPM5,the process can not continue successful"
To view the discussion, visit:
http://community.jboss.org/message/607673#607673
--------------------------------------------------------------
I finished the persistence configurations according to the user guide of jbpm5.And my
database has the sessioninfo,processinstanceinfo tables ,etc.Below is my test code:
public static void main(String[] args){
try {
PoolingDataSource ds = new PoolingDataSource();
ds.setUniqueName("jdbc/testDS");
ds.setClassName("com.mysql.jdbc.jdbc2.optional.MysqlXADataSource");
ds.setMaxPoolSize(3);
ds.setAllowLocalTransactions(true);
ds.getDriverProperties().put("user", "root");
ds.getDriverProperties().put("password", "root");
ds.getDriverProperties().put("URL",
"jdbc:mysql://localhost:3306/jbpm5");
ds.init();
// load up the knowledge base
KnowledgeBase kbase = readKnowledgeBase();
// start a new process instance
EntityManagerFactory emf = Persistence
.createEntityManagerFactory("org.jbpm.persistence.jpa");
Environment env = KnowledgeBaseFactory.newEnvironment();
env.set(EnvironmentName.ENTITY_MANAGER_FACTORY,
emf);
env.set(EnvironmentName.TRANSACTION_MANAGER,
TransactionManagerServices.getTransactionManager());
// create a new knowledge session that uses JPA to store the runtime
// state
StatefulKnowledgeSession ksession=null;
ksession= JPAKnowledgeService.newStatefulKnowledgeSession(
kbase,
null,
env);
JPAWorkingMemoryDbLogger logger = new JPAWorkingMemoryDbLogger(ksession);
ksession.getWorkItemManager().registerWorkItemHandler("Human Task",
new WSHumanTaskHandler());
// start a new process instance
Map<String, Object> params = new HashMap<String, Object>();
params.put("employee", "krisv");
ksession.startProcess("com.sample.evaluation", params);
logger.dispose();
} catch (Throwable t) {
t.printStackTrace();
}
}
private static KnowledgeBase readKnowledgeBase() throws Exception {
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory
.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newClassPathResource("Evaluation.bpmn"),
ResourceType.BPMN2);
return kbuilder.newKnowledgeBase();
}
The first time i run the code,the processinstance and the tasks are created
successfully.But when i run it second time ,exception was occured just like this:
javax.persistence.PersistenceException: [PersistenceUnit: org.jbpm.persistence.jpa] Unable
to build EntityManagerFactory
at
org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:677)
at
org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:126)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:60)
at com.sample.ProcessTest.main(ProcessTest.java:67)
Caused by: org.hibernate.HibernateException: Could not obtain BTM transaction manager
instance
at
org.hibernate.transaction.BTMTransactionManagerLookup.getTransactionManager(BTMTransactionManagerLookup.java:50)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:357)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)
at
org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
at
org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
... 4 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.hibernate.transaction.BTMTransactionManagerLookup.getTransactionManager(BTMTransactionManagerLookup.java:47)
... 8 more
Caused by: bitronix.tm.utils.InitializationException: cannot open disk journal
at
bitronix.tm.BitronixTransactionManager.<init>(BitronixTransactionManager.java:59)
at
bitronix.tm.TransactionManagerServices.getTransactionManager(TransactionManagerServices.java:43)
... 13 more
Caused by: java.io.IOException:The process cannot access the file because another process
has locked a portion of the file
at java.io.RandomAccessFile.read(Native Method)
at java.io.RandomAccessFile.readInt(RandomAccessFile.java:720)
at
bitronix.tm.journal.TransactionLogHeader.<init>(TransactionLogHeader.java:77)
at
bitronix.tm.journal.TransactionLogAppender.<init>(TransactionLogAppender.java:50)
at bitronix.tm.journal.DiskJournal.open(DiskJournal.java:132)
at
bitronix.tm.BitronixTransactionManager.<init>(BitronixTransactionManager.java:46)
... 14 more
I do not know what happened above,can you help me out?Waiting for your response,thank
you!!
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/607673#607673]
Start a new discussion in jBPM at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]