4 Replies Latest reply on May 9, 2011 10:10 AM by rkvsraman

    Exception when running with more than 1 variable

    rkvsraman

      Hello,

       

      I am trying to run the sample project packaged with the installer.

       

      I have introduced 2 new variables #{hr} and #{pm} and created the values in the map.

       

      When i run it i get the following exception.

       

       

           [java] javax.persistence.RollbackException: Error while commiting the transaction

           [java]     at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:71)

           [java]     at org.jbpm.task.service.TaskServiceSession.doOperationInTransaction(TaskServiceSession.java:716)

           [java]     at org.jbpm.task.service.TaskServiceSession.addTask(TaskServiceSession.java:134)

           [java]     at org.jbpm.task.service.TaskServerHandler.messageReceived(TaskServerHandler.java:108)

           [java]     at org.jbpm.task.service.mina.MinaTaskServerHandler.messageReceived(MinaTaskServerHandler.java:41)

           [java]     at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:713)

           [java]     at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)

           [java]     at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:46)

           [java]     at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:793)

           [java]     at org.apache.mina.filter.codec.ProtocolCodecFilter$ProtocolDecoderOutputImpl.flush(ProtocolCodecFilter.java:375)

           [java]     at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:229)

           [java]     at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)

           [java]     at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:46)

           [java]     at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:793)

           [java]     at org.apache.mina.filter.logging.LoggingFilter.messageReceived(LoggingFilter.java:176)

           [java]     at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)

           [java]     at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:46)

           [java]     at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:793)

           [java]     at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:119)

           [java]     at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)

           [java]     at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:426)

           [java]     at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:638)

           [java]     at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:598)

           [java]     at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:587)

           [java]     at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$400(AbstractPollingIoProcessor.java:61)

           [java]     at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:969)

           [java]     at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)

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

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

           [java]     at java.lang.Thread.run(Thread.java:619)

           [java] Caused by: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update

           [java]     at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:94)

           [java]     at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)

           [java]     at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)

           [java]     at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266)

           [java]     at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:168)

           [java]     at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)

           [java]     at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)

           [java]     at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1027)

           [java]     at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:365)

           [java]     at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:137)

           [java]     at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:54)

           [java]     ... 29 more

           [java] Caused by: org.h2.jdbc.JdbcBatchUpdateException: Referential integrity constraint violation: "FK27A9A59E619A0: PUBLIC.TASK FOREIGN KEY(CREATEDBY_ID) REFERENCES PUBLIC.ORGANIZATIONALENTITY(ID)"; SQL statement:

           [java] update Task set allowedToDelegate=?, taskInitiator_id=?, priority=?, activationTime=?, actualOwner_id=?, createdBy_id=?, createdOn=?, documentAccessType=?, documentContentId=?, documentType=?, expirationTime=?, faultAccessType=?, faultContentId=?, faultName=?, faultType=?, outputAccessType=?, outputContentId=?, outputType=?, parentId=?, previousStatus=?, processInstanceId=?, skipable=?, status=?, workItemId=? where id=? [23002-124]

           [java]     at org.h2.jdbc.JdbcPreparedStatement.executeBatch(JdbcPreparedStatement.java:1082)

           [java]     at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)

           [java]     at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)

           [java]     ... 37 more

       

       

       

      Please help. I have attached the files.

        • 1. Exception when running with more than 1 variable
          melc

          Hello,

          You get an exception because of a referential integrity constraint between the task table and the organizationalentity table, since you place the two unset variables to the ActorId of the usertasks. In order to use them this way you'll have to set values to the variables before you reach the point of each task ( HR Evaluation, PM Evaluation ) in your process.

          1 of 1 people found this helpful
          • 2. Exception when running with more than 1 variable
            rkvsraman

            How do I do that?

             

            Code example would help.

            • 3. Exception when running with more than 1 variable
              melc

              Generally when a process starts the first form that is displayed is the ftl file having name the same as the process id i.e.

              the evaluation process which is a sample process bundled with the jbpm installation has id = com.sample.evaluation

              therefore the com.sample.evaluation.ftl file is the first form displayed with title "Start Performance Evaluation",

              asking for username "Please fill in your username: " etc....

               

              The com.sample.evaluation.ftl is located in jbpm-gwt-form.jar in libraries jbpm-gwt-console-server.war (also mentioned in this thread, http://community.jboss.org/message/603284)

               

               

              Inside this ftl u'll notice that there is an input with the name employee and that is one way of populating a process variable.

              (To see other ways of playing around with variables etc, take a look at the following threads,

              http://community.jboss.org/thread/166412

              http://community.jboss.org/message/603579

              )

              This is the reason why #{employee} works when placed in the ActorId of the first task "Self Evaluation".

               

              So one way of setting values to your variables would be to enter two more fields inside the form of the com.sample.evaluation.ftl file, having names equal to the names of your variables.

              i.e.

              <form action="complete" method="POST" enctype="multipart/form-data">

              Please fill in your username: <input type="text" name="employee" /></BR>

              Please fill in hr username: <input type="text" name="hr" /></BR>

              Please fill in pm username or something: <input type="text" name="pm" /></BR>

              Reason:<BR/>

              <textarea cols="50" rows="5" name="reason"></textarea></BR>

              <input type="submit" value="Complete">

              </form>

               

              Another would be similarly to set fields inside the ftl file corresponding to the "Self Evaluation" task (Performance Evaluation.ftl). Other approach could be to place logic on the On Entry Action or/and On Exit Action and Parameter Mapping (as used in the "Self Evaluation" task of the Evaluation.bpmn).

              1 of 1 people found this helpful
              • 4. Exception when running with more than 1 variable
                rkvsraman

                Thanks!!

                 

                Will look into it.