0 Replies Latest reply on Jul 11, 2011 3:42 AM by Xiaojun Hou

    java.lang.IllegalArgumentException: attempt to create merge event with null entity

    Xiaojun Hou Newbie

      In my project,i use the code below to configure the persistence:

       

      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();

              }

       

      However,when i start a new processinstance(I have three task in my process) and try to complete the first task,exception happens just like this:

       

      Registered human task listener

      [2011:06:167 10:06:520:debug] Message receieved on client : AddTaskResponse

      [2011:06:167 10:06:520:debug] Arguments : [1]

      [2011:06:167 10:06:324:debug] Message receieved on client : EventTriggerResponse

      [2011:06:167 10:06:324:debug] Arguments : [org.jbpm.task.event.EventPayload@b98a06]

      Task completed 1

      [2011:06:167 10:06:609:debug] Message receieved on client : GetTaskResponse

      [2011:06:167 10:06:609:debug] Arguments : [org.jbpm.task.Task@2a7159ce]

      [2011:06:167 10:06:610:exception] Uncaught exception on client

      java.lang.IllegalArgumentException: attempt to create merge event with null entity

          at org.hibernate.event.MergeEvent.<init>(MergeEvent.java:60)

          at org.hibernate.event.MergeEvent.<init>(MergeEvent.java:43)

          at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:688)

          at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:692)

          at org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:235)

          at org.drools.persistence.jpa.JpaPersistenceContext.merge(JpaPersistenceContext.java:49)

          at org.drools.persistence.jpa.processinstance.JPAWorkItemManager.abortWorkItem(JPAWorkItemManager.java:136)

          at org.jbpm.process.workitem.wsht.WSHumanTaskHandler$GetCompletedTaskResponseHandler.execute(WSHumanTaskHandler.java:249)

          at org.jbpm.task.service.TaskClientHandler.messageReceived(TaskClientHandler.java:81)

          at org.jbpm.task.service.mina.MinaTaskClientHandler.messageReceived(MinaTaskClientHandler.java:47)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

       

       

      After the exception,the task stored in the database has a "completed" status,Can somebody help me to solve the problem?