<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
Error while starting the process
</h3>
<span style="margin-bottom: 10px;">
created by <a href="https://community.jboss.org/people/svinothmca">VinothKumar Srinivasan</a> in <i>jBPM</i> - <a href="https://community.jboss.org/message/784815#784815">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>I am facing the following errors when i start the process </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Exception in thread "main" javax.persistence.PersistenceException: [PersistenceUnit: org.jbpm.persistence.jpa] Unable to build EntityManagerFactory</p><p>          at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:677)</p><p>          at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:126)</p><p>          at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:52)</p><p>          at org.jbpm.test.JBPMHelper.loadStatefulKnowledgeSession(JBPMHelper.java:147)</p><p>          at org.jbpm.test.JBPMHelper.newStatefulKnowledgeSession(JBPMHelper.java:136)</p><p>          at com.sample.ProcessMain.main(ProcessMain.java:20)</p><p>Caused by: org.hibernate.HibernateException: Could not obtain BTM transaction manager instance</p><p>          at org.hibernate.transaction.BTMTransactionManagerLookup.getTransactionManager(BTMTransactionManagerLookup.java:50)</p><p>          at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:367)</p><p>          at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1341)</p><p>          at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)</p><p>          at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)</p><p>          ... 5 more</p><p>Caused by: java.lang.reflect.InvocationTargetException</p><p>          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)</p><p>          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)</p><p>          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)</p><p>          at java.lang.reflect.Method.invoke(Method.java:597)</p><p>          at org.hibernate.transaction.BTMTransactionManagerLookup.getTransactionManager(BTMTransactionManagerLookup.java:47)</p><p>          ... 9 more</p><p>Caused by: bitronix.tm.utils.InitializationException: cannot open disk journal</p><p>          at bitronix.tm.BitronixTransactionManager.<init>(BitronixTransactionManager.java:75)</p><p>          at bitronix.tm.TransactionManagerServices.getTransactionManager(TransactionManagerServices.java:62)</p><p>          ... 14 more</p><p>Caused by: java.io.IOException: The process cannot access the file because another process has locked a portion of the file</p><p>          at java.io.RandomAccessFile.read(Native Method)</p><p>          at java.io.RandomAccessFile.readInt(RandomAccessFile.java:720)</p><p>          at bitronix.tm.journal.TransactionLogHeader.<init>(TransactionLogHeader.java:96)</p><p>          at bitronix.tm.journal.TransactionLogAppender.<init>(TransactionLogAppender.java:69)</p><p>          at bitronix.tm.journal.DiskJournal.open(DiskJournal.java:151)</p><p>          at bitronix.tm.BitronixTransactionManager.<init>(BitronixTransactionManager.java:62)</p><p>          ... 15 more</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>The source code for this process is </p><p><strong>Processmain.java --- </strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>package com.sample;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>import org.drools.KnowledgeBase;</p><p>import org.drools.builder.KnowledgeBuilder;</p><p>import org.drools.builder.KnowledgeBuilderFactory;</p><p>import org.drools.builder.ResourceType;</p><p>import org.drools.io.ResourceFactory;</p><p>import org.drools.runtime.StatefulKnowledgeSession;</p><p>import org.jbpm.test.JBPMHelper;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>/**</p><p> * This is a sample file to launch a process.</p><p> */</p><p>public class ProcessMain {</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>          public static final void main(String[] args) throws Exception {</p><p>                    startUp();</p><p>                    // load up the knowledge base</p><p>                    KnowledgeBase kbase = readKnowledgeBase();</p><p>                    StatefulKnowledgeSession ksession = JBPMHelper.newStatefulKnowledgeSession(kbase);</p><p>                    // start a new process instance</p><p>                    ksession.startProcess("com.sample.bpmn.hello");</p><p>                    System.out.println("Process started ...");</p><p>          }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>          private static KnowledgeBase readKnowledgeBase() throws Exception {</p><p>                    KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();</p><p>                    kbuilder.add(ResourceFactory.newClassPathResource("sample.bpmn"), ResourceType.BPMN2);</p><p>                    return kbuilder.newKnowledgeBase();</p><p>          }</p><p>  </p><p>          private static void startUp() {</p><p>                    JBPMHelper.startH2Server();</p><p>                    JBPMHelper.setupDataSource();</p><p>                    // please comment this line if you already have the task service running,</p><p>                    // for example when running the jbpm-installer</p><p>                    //JBPMHelper.startTaskService();</p><p>          }</p><p>  </p><p>}</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><strong>ProcessTest.java -------</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>package com.sample;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>import java.util.List;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>import org.drools.runtime.StatefulKnowledgeSession;</p><p>import org.drools.runtime.process.ProcessInstance;</p><p>import org.jbpm.task.TaskService;</p><p>import org.jbpm.task.query.TaskSummary;</p><p>import org.jbpm.test.JbpmJUnitTestCase;</p><p>import org.junit.Test;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>/**</p><p> * This is a sample file to launch a process.</p><p> */</p><p>public class ProcessTest extends JbpmJUnitTestCase {</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>          public ProcessTest() {</p><p>                    super(true);</p><p>                    setPersistence(true);</p><p>          }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>          @Test</p><p>          public void testProcess() {</p><p>                    StatefulKnowledgeSession ksession = createKnowledgeSession("sample.bpmn");</p><p>                    TaskService taskService = getTaskService(ksession);</p><p>  </p><p>                    ProcessInstance processInstance = ksession.startProcess("com.sample.bpmn.hello");</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>                    assertProcessInstanceActive(processInstance.getId(), ksession);</p><p>                    assertNodeTriggered(processInstance.getId(), "Start", "Task 1");</p><p>  </p><p>                    // let john execute Task 1</p><p>                    List<TaskSummary> list = taskService.getTasksAssignedAsPotentialOwner("john", "en-UK");</p><p>                    TaskSummary task = list.get(0);</p><p>                    System.out.println("John is executing task " + task.getName());</p><p>                    taskService.start(task.getId(), "john");</p><p>                    taskService.complete(task.getId(), "john", null);</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>                    assertNodeTriggered(processInstance.getId(), "Task 2");</p><p>  </p><p>                    // let mary execute Task 2</p><p>                    list = taskService.getTasksAssignedAsPotentialOwner("mary", "en-UK");</p><p>                    task = list.get(0);</p><p>                    System.out.println("Mary is executing task " + task.getName());</p><p>                    taskService.start(task.getId(), "mary");</p><p>                    taskService.complete(task.getId(), "mary", null);</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>                    assertNodeTriggered(processInstance.getId(), "End");</p><p>                    assertProcessInstanceCompleted(processInstance.getId(), ksession);</p><p>  </p><p>                    ksession.dispose();</p><p>          }</p><p>  </p><p>}</p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/784815#784815">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in jBPM at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>