11 Replies Latest reply on Jun 9, 2013 8:51 AM by Vinay N

    jBPM5.1 : Setting Process Variable from code(Using API)

    Sandeep Sapra Newbie

      Description :

      I am trying to create a business process having two tasks :

      a) Enter Comments Task to be entered by author and

      b) Verify comments Task : To approve or reject comments entered by author.

      If the comments are approved the process will end and if it is rejected , control will flow back to user task to enter comments by author.

       

      Approve is set in BPMN by setting a process variable : approvalStatus as 1 and for reject it i set to 0.

      Eg:

      <conditionExpression xsi:type="tFormalExpression" language="http://www.java.com/java" >

      return approvalStatus.equals("1");

      </conditionExpression>

       

      Problem:

       

      While starting the process, approvalStatus is set to 0 intially as :

                  Map<String, Object> params = new HashMap<String, Object>();

                  params.put("approvalStatus", "0");         

               // start a new process instance

                  pi = ksession.startProcess("com.sample.bpmn.comments",params);

       

       

      I am then trying to set the process variable as 1 or 0 (depending on approve or reject) inside the code , but the same is not happening.

      Can anyone please tell if I am missing something or is there any other way to do so?

       

      Code Snippet:

       

      //Some Code here.....................

         String approvalStatusValue="0";

         if(isCommentsApproved)

                    approvalStatusValue="1";

        else

            approvalStatusValue="0";

                  

                      Map<String, Object> results = new HashMap<String, Object>();

                      results.put("approvalStatus", approvalStatusValue);

                      ContentData contentData = new ContentData();

                      contentData = new ContentData();

                      contentData.setAccessType(AccessType.Inline);

                      ByteArrayOutputStream bos = new ByteArrayOutputStream();

                      ObjectOutputStream out;

                      try {

                          out = new ObjectOutputStream(bos);

                          out.writeObject(results);

                          out.close();

                          contentData = new ContentData();

                          contentData.setContent(bos.toByteArray());

                          contentData.setAccessType(AccessType.Inline);

                      } catch (IOException e) {

                          e.printStackTrace();

                      }

                     

                     

                      taskClient.complete(task1.getId(), "mary", contentData, taskOperationHandler);

       

      Thanks and Regards,

      Sandeep

        • 1. Re: jBPM5.1 : Setting Process Variable from code(Using API)
          Maciej Swiderski Master

          What work item handler do you use for Human Task? Handler should be responsible for transferring content data into output definition of the user task.

          • 2. Re: jBPM5.1 : Setting Process Variable from code(Using API)
            Esteban Aliverti Master

            Are you mapping the result of the Human Task Node to the process variable you want to change?

            • 3. Re: jBPM5.1 : Setting Process Variable from code(Using API)
              Sandeep Sapra Newbie

              Thanks Maciej Swiderski  and Esteban Aliverti for responding to my problem. I have solved the problem by setting

              Result Mapping for the user task ( {Result=approvalStatus} ) , along with defining the process variable, for which I was not aware of earlier.

               

              But now I have an another query, where in I am trying to execute my bpmn in a web application and I have followed the steps give in the following articles.

              Article 1: http://community.jboss.org/people/bpmn2user/blog/2011/09/21/jbpm5-web-example

              Article 2: http://community.jboss.org/people/bpmn2user/blog/2011/04/03/jbpm5-human-task-api-usage-example

               

              Desc: I have multiple user tasks in my bpmn , and after completing one user task it should go to the other user task and so on.

               

              Problem : Once I run the code ( using all the configuration told in the article), the human task view shows the user task to first user as reserved,but after starting and completing it , the workflow ends  and hence searching for tasks to other users shows nothing.

               

              I tried the same using APIs also but the same problem comes.

              Could you please suggest where I am wrong?

               

              Regards,

              Sandeep

              • 5. Re: jBPM5.1 : Setting Process Variable from code(Using API)
                Sandeep Sapra Newbie

                Hi Esteban,

                I am using the BPMN2.

                Also while running the example given in the article(http://community.jboss.org/people/bpmn2user/blog/2011/09/21/jbpm5-web-example) and running in tomcat 6.0 with eclipse , I am getting following error( stacktrace below).

                I have done all the configurations stated in the example.

                 

                Could you help me for the same?

                 

                Regards

                Sandeep

                 

                StackTrace:

                2532 [main] INFO bitronix.tm.Configuration - JVM unique ID: <172.21.232.59>
                Nov 16, 2011 4:32:52 PM org.apache.naming.NamingContext lookup
                WARNING: Unexpected exception resolving reference
                bitronix.tm.utils.InitializationException: cannot open disk journal
                at bitronix.tm.BitronixTransactionManager.<init>(BitronixTransactionManager.java:61)
                at bitronix.tm.TransactionManagerServices.getTransactionManager(TransactionManagerServices.java:43)
                at bitronix.tm.BitronixTransactionManagerObjectFactory.getObjectInstance(BitronixTransactionManagerObjectFactory.java:29)
                at org.apache.naming.factory.TransactionFactory.getObjectInstance(TransactionFactory.java:110)
                at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
                at org.apache.naming.NamingContext.lookup(NamingContext.java:793)
                at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
                at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
                at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
                at org.apache.naming.SelectorContext.lookup(SelectorContext.java:152)
                at javax.naming.InitialContext.lookup(InitialContext.java:392)
                at com.sample.processserver.TaskProcessServlet.init(TaskProcessServlet.java:67)
                at javax.servlet.GenericServlet.init(GenericServlet.java:212)
                at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173)
                at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
                at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4420)
                at org.apache.catalina.core.StandardContext.start(StandardContext.java:4733)
                at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
                at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
                at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
                at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
                at org.apache.catalina.core.StandardService.start(StandardService.java:525)
                at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
                at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
                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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
                at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
                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:49)
                at bitronix.tm.journal.DiskJournal.open(DiskJournal.java:131)
                at bitronix.tm.BitronixTransactionManager.<init>(BitronixTransactionManager.java:47)
                ... 29 more
                2011-11-16 16:32:52,391 (TaskProcessServlet.java:82) ERROR com.sample.processserver.TaskProcessServlet - cannot open disk journal
                Nov 16, 2011 4:32:52 PM org.apache.catalina.core.ApplicationContext log
                SEVERE: StandardWrapper.Throwable
                java.lang.RuntimeException: error while creating session
                at com.sample.processserver.TaskProcessServlet.init(TaskProcessServlet.java:83)
                at javax.servlet.GenericServlet.init(GenericServlet.java:212)
                at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173)
                at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
                at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4420)
                at org.apache.catalina.core.StandardContext.start(StandardContext.java:4733)
                at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
                at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
                at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
                at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
                at org.apache.catalina.core.StandardService.start(StandardService.java:525)
                at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
                at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
                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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
                at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
                Caused by: javax.naming.NamingException: cannot open disk journal
                at org.apache.naming.NamingContext.lookup(NamingContext.java:805)
                at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
                at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
                at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
                at org.apache.naming.SelectorContext.lookup(SelectorContext.java:152)
                at javax.naming.InitialContext.lookup(InitialContext.java:392)
                at com.sample.processserver.TaskProcessServlet.init(TaskProcessServlet.java:67)
                ... 18 more
                Nov 16, 2011 4:32:52 PM org.apache.catalina.core.StandardContext loadOnStartup
                SEVERE: Servlet /jbpm5webexample threw load() exception
                javax.naming.NamingException: cannot open disk journal
                at org.apache.naming.NamingContext.lookup(NamingContext.java:805)
                at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
                at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
                at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
                at org.apache.naming.SelectorContext.lookup(SelectorContext.java:152)
                at javax.naming.InitialContext.lookup(InitialContext.java:392)
                at com.sample.processserver.TaskProcessServlet.init(TaskProcessServlet.java:67)
                at javax.servlet.GenericServlet.init(GenericServlet.java:212)
                at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173)
                at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
                at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4420)
                at org.apache.catalina.core.StandardContext.start(StandardContext.java:4733)
                at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
                at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
                at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
                at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
                at org.apache.catalina.core.StandardService.start(StandardService.java:525)
                at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
                at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
                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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
                at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
                Nov 16, 2011 4:32:52 PM org.apache.coyote.http11.Http11Protocol start
                INFO: Starting Coyote HTTP/1.1 on http-8080

                 

                 

                 

                • 6. Re: jBPM5.1 : Setting Process Variable from code(Using API)
                  Maciej Swiderski Master

                  The exception seems to be caused by another process that is keeping lock on the bitronix log file...

                   

                  The best way for us to help you is if you provide a test case that will give us opportunity to quickly reproduce the problem, so could do so?

                  • 7. Re: jBPM5.1 : Setting Process Variable from code(Using API)
                    Jack Q tao Newbie

                    You should delete jta.jar and btm.jar  in your application to solve [cannot open disk journal]

                     

                    Or delete btm's datasources or Transaction in spring

                    • 8. Re: jBPM5.1 : Setting Process Variable from code(Using API)
                      Sandeep Sapra Newbie

                      Thanks Jack

                      I solved the problem and later I checked your response. Along with jta.jar and btm.jar,sl4j jar has to removed and should be present in tomcat lib.

                       

                      1.) I am trying to run my example in JBoss AS (5.0.0 GA) now but I am not sure how to do configurations in JBoss.

                      Could anyone give some reference?

                       

                      2.) When I tried doing an error occured saying :

                      java.lang.RuntimeException: Specification violation [EJB3 JPA 6.2.1.2] - You have not defined a jta-data-source for a JTA enabled persistence context named: org.jbpm.task
                      at org.jboss.jpa.deployment.PersistenceUnitInfoImpl.<init>(PersistenceUnitInfoImpl.java:115)
                      at org.jboss.jpa.deployment.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:285)

                       

                      I changed following in persistence.xml  as

                      Before

                      ......

                       

                       

                       

                       

                       

                      <persistence-unit name="org.jbpm.task">

                       

                      <provider>org.hibernate.ejb.HibernatePersistence</provider>

                       

                      <jta-data-source>java:jdbc/testDS1</jta-data-source>

                       

                      <class>org.jbpm.task.Attachment</class>

                       

                      <class>org.jbpm.task.Content</class>

                       

                      ..........

                       

                      After changes :

                      ......

                       

                       

                       

                       

                       

                      <persistence-unit name="org.jbpm.task">

                       

                      <provider>org.hibernate.ejb.HibernatePersistence</provider>

                       

                      <jta-data-source>java:jdbc/testDS1</jta-data-source>

                       

                      <class>org.jbpm.task.Attachment</class>

                       

                      <class>org.jbpm.task.Content</class>

                      ..........

                       

                      But now error is coming as

                      java.lang.ClassCastException

                       

                      : org.hibernate.ejb.HibernatePersistence cannot be cast to javax.persistence.spi.PersistenceProvider

                      at org.jboss.jpa.deployment.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:310)
                      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.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:59)
                      at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:150)

                      Could anyone suggest what went wrong and how to solve it?

                       

                      PS:  I am using the example in article : http://community.jboss.org/people/bpmn2user/blog/2011/09/21/jbpm5-web-example but doing the same configuration Jboss 5.0.0 GA now

                       

                      Thanks and Regards,

                      Sandeep

                      • 9. Re: jBPM5.1 : Setting Process Variable from code(Using API)
                        Sandeep Sapra Newbie

                        Problem resolved.

                        1.) Class Loader should be set in way that libraries are picked from WEB-INF/lib first.

                        2.) jboss-classloading.xml is required

                         

                        Thanks and Regards,

                        Sandeep Sapra

                        • 11. Re: jBPM5.1 : Setting Process Variable from code(Using API)
                          Vinay N Newbie

                          Hi All ,

                           

                          I am getting this error....

                          SLF4J: Class path contains multiple SLF4J bindings.

                          SLF4J: Found binding in [jar:file:/C:/Program%20Files%20(x86)/Apache%20Software%20Foundation/Tomcat%207.0/lib/slf4j-jdk14-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class]

                          SLF4J: Found binding in [jar:file:/F:/IPMS_Workspace_New/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/jbpmWebExm/WEB-INF/lib/slf4j-jdk14-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class]

                          SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.

                          9 Jun, 2013 6:11:15 PM bitronix.tm.BitronixTransactionManager logVersion

                          INFO: Bitronix Transaction Manager version 2.1.3

                          9 Jun, 2013 6:11:15 PM bitronix.tm.Configuration buildServerIdArray

                          WARNING: cannot get this JVM unique ID. Make sure it is configured and you only use ASCII characters. Will use IP address instead (unsafe for production usage!).

                          9 Jun, 2013 6:11:15 PM bitronix.tm.Configuration buildServerIdArray

                          INFO: JVM unique ID: <172.16.6.139>

                          2013-06-09 18:11:15,774 (TaskProcessServlet.java:56) ERROR com.sample.processserver.TaskProcessServlet - [PersistenceUnit: org.jbpm.persistence.jpa] Unable to build EntityManagerFactory

                          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:325)

                                    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1300)

                                    at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:859)

                                    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)

                                    at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:126)

                                    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:52)

                                    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:34)

                                    at com.sample.processserver.JbpmAPIUtil.createSession(JbpmAPIUtil.java:262)

                                    at com.sample.processserver.JbpmAPIUtil.getSession(JbpmAPIUtil.java:242)

                                    at com.sample.processserver.TaskProcessServlet.init(TaskProcessServlet.java:44)

                                    at javax.servlet.GenericServlet.init(GenericServlet.java:160)

                                    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1266)

                                    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1185)

                                    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1080)

                                    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5001)

                                    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5289)

                                    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)

                                    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1525)

                                    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1515)

                                    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)

                                    at java.util.concurrent.FutureTask.run(FutureTask.java:138)

                                    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

                                    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

                                    at java.lang.Thread.run(Thread.java:662)

                          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)

                                    ... 24 more

                          Caused by: bitronix.tm.utils.InitializationException: cannot open disk journal

                                    at bitronix.tm.BitronixTransactionManager.<init>(BitronixTransactionManager.java:98)

                                    at bitronix.tm.TransactionManagerServices.getTransactionManager(TransactionManagerServices.java:75)

                                    ... 29 more

                          Caused by: java.io.IOException: The process cannot access the file because another process has locked a portion of the file

                                    at sun.nio.ch.FileDispatcher.read0(Native Method)

                                    at sun.nio.ch.FileDispatcher.read(FileDispatcher.java:28)

                                    at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:198)

                                    at sun.nio.ch.IOUtil.read(IOUtil.java:171)

                                    at sun.nio.ch.FileChannelImpl.read(FileChannelImpl.java:144)

                                    at bitronix.tm.journal.TransactionLogHeader.<init>(TransactionLogHeader.java:101)

                                    at bitronix.tm.journal.TransactionLogAppender.<init>(TransactionLogAppender.java:70)

                                    at bitronix.tm.journal.DiskJournal.open(DiskJournal.java:157)

                                    at bitronix.tm.BitronixTransactionManager.<init>(BitronixTransactionManager.java:85)

                                    ... 30 more

                          9 Jun, 2013 6:11:15 PM org.apache.catalina.core.ApplicationContext log

                          SEVERE: StandardWrapper.Throwable

                          java.lang.RuntimeException: error while creating session

                                    at com.sample.processserver.TaskProcessServlet.init(TaskProcessServlet.java:57)

                                    at javax.servlet.GenericServlet.init(GenericServlet.java:160)

                                    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1266)

                                    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1185)

                                    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1080)

                                    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5001)

                                    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5289)

                                    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)

                                    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1525)

                                    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1515)

                                    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)

                                    at java.util.concurrent.FutureTask.run(FutureTask.java:138)

                                    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

                                    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

                                    at java.lang.Thread.run(Thread.java:662)

                          Caused by: 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:52)

                                    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:34)

                                    at com.sample.processserver.JbpmAPIUtil.createSession(JbpmAPIUtil.java:262)

                                    at com.sample.processserver.JbpmAPIUtil.getSession(JbpmAPIUtil.java:242)

                                    at com.sample.processserver.TaskProcessServlet.init(TaskProcessServlet.java:44)

                                    ... 14 more

                          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:325)

                                    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1300)

                                    at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:859)

                                    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)

                                    ... 20 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)

                                    ... 24 more

                          Caused by: bitronix.tm.utils.InitializationException: cannot open disk journal

                                    at bitronix.tm.BitronixTransactionManager.<init>(BitronixTransactionManager.java:98)

                                    at bitronix.tm.TransactionManagerServices.getTransactionManager(TransactionManagerServices.java:75)

                                    ... 29 more

                          Caused by: java.io.IOException: The process cannot access the file because another process has locked a portion of the file

                                    at sun.nio.ch.FileDispatcher.read0(Native Method)

                                    at sun.nio.ch.FileDispatcher.read(FileDispatcher.java:28)

                                    at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:198)

                                    at sun.nio.ch.IOUtil.read(IOUtil.java:171)

                                    at sun.nio.ch.FileChannelImpl.read(FileChannelImpl.java:144)

                                    at bitronix.tm.journal.TransactionLogHeader.<init>(TransactionLogHeader.java:101)

                                    at bitronix.tm.journal.TransactionLogAppender.<init>(TransactionLogAppender.java:70)

                                    at bitronix.tm.journal.DiskJournal.open(DiskJournal.java:157)

                                    at bitronix.tm.BitronixTransactionManager.<init>(BitronixTransactionManager.java:85)

                                    ... 30 more

                          9 Jun, 2013 6:11:15 PM org.apache.catalina.core.StandardContext loadOnStartup

                          SEVERE: Servlet /jbpmWebExm threw load() exception

                          java.io.IOException: The process cannot access the file because another process has locked a portion of the file

                                    at sun.nio.ch.FileDispatcher.read0(Native Method)

                                    at sun.nio.ch.FileDispatcher.read(FileDispatcher.java:28)

                                    at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:198)

                                    at sun.nio.ch.IOUtil.read(IOUtil.java:171)

                                    at sun.nio.ch.FileChannelImpl.read(FileChannelImpl.java:144)

                                    at bitronix.tm.journal.TransactionLogHeader.<init>(TransactionLogHeader.java:101)

                                    at bitronix.tm.journal.TransactionLogAppender.<init>(TransactionLogAppender.java:70)

                                    at bitronix.tm.journal.DiskJournal.open(DiskJournal.java:157)

                                    at bitronix.tm.BitronixTransactionManager.<init>(BitronixTransactionManager.java:85)

                                    at bitronix.tm.TransactionManagerServices.getTransactionManager(TransactionManagerServices.java:75)

                                    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)

                                    at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:325)

                                    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1300)

                                    at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:859)

                                    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)

                                    at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:126)

                                    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:52)

                                    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:34)

                                    at com.sample.processserver.JbpmAPIUtil.createSession(JbpmAPIUtil.java:262)

                                    at com.sample.processserver.JbpmAPIUtil.getSession(JbpmAPIUtil.java:242)

                                    at com.sample.processserver.TaskProcessServlet.init(TaskProcessServlet.java:44)

                                    at javax.servlet.GenericServlet.init(GenericServlet.java:160)

                                    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1266)

                                    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1185)

                                    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1080)

                                    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5001)

                                    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5289)

                                    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)

                                    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1525)

                                    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1515)

                                    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)

                                    at java.util.concurrent.FutureTask.run(FutureTask.java:138)

                                    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

                                    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

                                    at java.lang.Thread.run(Thread.java:662)

                          9 Jun, 2013 6:11:15 PM org.apache.coyote.AbstractProtocol start

                          INFO: Starting ProtocolHandler ["http-bio-8080"]

                          9 Jun, 2013 6:11:15 PM org.apache.coyote.AbstractProtocol start

                          INFO: Starting ProtocolHandler ["ajp-bio-8009"]

                          9 Jun, 2013 6:11:15 PM org.apache.catalina.startup.Catalina start

                          INFO: Server startup in 3438 ms

                          9 Jun, 2013 6:11:16 PM org.apache.catalina.core.StandardWrapperValve invoke

                          SEVERE: Servlet.service() for servlet [jsp] in context with path [/jbpmWebExm] threw exception [java.lang.LinkageError: loader constraint violation: when resolving interface method "javax.servlet.jsp.JspApplicationContext.getExpressionFactory()Ljavax/el/ExpressionFactory;" the class loader (instance of org/apache/jasper/servlet/JasperLoader) of the current class, org/apache/jsp/index_jsp, and the class loader (instance of org/apache/catalina/loader/StandardClassLoader) for resolved class, javax/servlet/jsp/JspApplicationContext, have different Class objects for the type javax/el/ExpressionFactory used in the signature] with root cause

                          java.lang.LinkageError: loader constraint violation: when resolving interface method "javax.servlet.jsp.JspApplicationContext.getExpressionFactory()Ljavax/el/ExpressionFactory;" the class loader (instance of org/apache/jasper/servlet/JasperLoader) of the current class, org/apache/jsp/index_jsp, and the class loader (instance of org/apache/catalina/loader/StandardClassLoader) for resolved class, javax/servlet/jsp/JspApplicationContext, have different Class objects for the type javax/el/ExpressionFactory used in the signature

                                    at org.apache.jsp.index_jsp._jspInit(index_jsp.java:31)

                                    at org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:49)

                                    at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:180)

                                    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)

                                    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)

                                    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)

                                    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

                                    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)

                                    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

                                    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)

                                    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)

                                    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)

                                    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)

                                    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)

                                    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:928)

                                    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)

                                    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)

                                    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)

                                    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:539)

                                    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:298)

                                    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

                                    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

                                    at java.lang.Thread.run(Thread.java:662)

                           

                           

                          my persistant.xml file :

                          <persistence-unit name="org.jbpm.persistence.jpa" transaction-type="JTA">

                                  <provider>org.hibernate.ejb.HibernatePersistence</provider>

                                  <jta-data-source>java:comp/env/jdbc/jbpm-ds</jta-data-source>

                            

                                  <!-- <mapping-file>META-INF/orm.xml</mapping-file> -->

                                  <class>org.drools.persistence.info.SessionInfo</class>

                                  <class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>

                                  <class>org.jbpm.persistence.processinstance.ProcessInstanceEventInfo</class>

                                  <class>org.drools.persistence.info.WorkItemInfo</class>

                                  <class>org.jbpm.process.audit.ProcessInstanceLog</class>

                                  <class>org.jbpm.process.audit.NodeInstanceLog</class>

                                  <class>org.jbpm.process.audit.VariableInstanceLog</class>      

                                 

                                  <class>org.jbpm.task.Task</class>

                                              <class>org.jbpm.task.Comment</class>

                                              <class>org.jbpm.task.Attachment</class>

                                              <class>org.jbpm.task.I18NText</class>

                                              <class>org.jbpm.task.SubTasksStrategy</class>

                                              <class>org.jbpm.task.Deadline</class>

                                              <class>org.jbpm.task.Escalation</class>

                                              <class>org.jbpm.task.Reassignment</class>

                                              <class>org.jbpm.task.Notification</class>

                                              <class>org.jbpm.task.BooleanExpression</class>

                                              <class>org.jbpm.task.User</class>

                                              <class>org.jbpm.task.PeopleAssignments</class>

                                  <properties>

                                     

                                    

                                      

                                      <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>

                                      

                                 

                                      <!--

                                      <property name="hibernate.connection.autocommit" value="false"/>

                                      -->

                                      <property name="hibernate.connection.autocommit" value="false"/>

                                      <property name="hibernate.max_fetch_depth" value="3"/>

                                      <property name="hibernate.hbm2ddl.auto" value="update" />

                                      <property name="hibernate.show_sql" value="false" />

                                      <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.BTMTransactionManagerLookup"/>

                                     

                                  </properties>

                                         </persistence-unit>