0 Replies Latest reply on Apr 7, 2014 2:31 AM by Kannan g krishnan

    To add the users and groups

    Kannan g krishnan Newbie

      Hi community

       

      I have a requirement that i want to add my own users and groups to the jBPM and I want to do this dynamically. i tried with something like,

       

                EntityManagerFactory emf = Persistence.createEntityManagerFactory("org.jbpm.task");

               TaskService taskService = new TaskService(emf, SystemEventListenerFactory.getSystemEventListener());

               TaskServiceSession taskSession = taskService.createSession();

               // now register new users and groups

               Group g = new Group();

               taskSession.addUser(new User("userA"));

               taskSession.addGroup(new Group("groupA"));

       

      When i run this code i got some exception,

       

      javax.persistence.PersistenceException: No Persistence provider for EntityManager named org.jbpm.task

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

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

          at com.sample.AddUserHandler.executeWorkItem(AddUserHandler.java:25)

          at org.drools.process.instance.impl.DefaultWorkItemManager.internalExecuteWorkItem(DefaultWorkItemManager.java:70)

          at org.jbpm.workflow.instance.node.WorkItemNodeInstance.internalTrigger(WorkItemNodeInstance.java:107)

          at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:126)

          at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:279)

          at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:238)

          at org.jbpm.workflow.instance.node.StartNodeInstance.triggerCompleted(StartNodeInstance.java:49)

          at org.jbpm.workflow.instance.node.StartNodeInstance.internalTrigger(StartNodeInstance.java:41)

          at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:126)

          at org.jbpm.ruleflow.instance.RuleFlowProcessInstance.internalStart(RuleFlowProcessInstance.java:35)

          at org.jbpm.process.instance.impl.ProcessInstanceImpl.start(ProcessInstanceImpl.java:194)

          at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.start(WorkflowProcessInstanceImpl.java:309)

          at org.jbpm.process.instance.ProcessRuntimeImpl.startProcessInstance(ProcessRuntimeImpl.java:170)

          at org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:140)

          at org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:132)

          at org.drools.common.AbstractWorkingMemory.startProcess(AbstractWorkingMemory.java:1093)

          at org.drools.impl.StatefulKnowledgeSessionImpl.startProcess(StatefulKnowledgeSessionImpl.java:315)

          at com.sample.ProcessMain.main(ProcessMain.java:26)

       

      How can i solve this???

      Is there any other methos there to add the users and groups dynamically.

       

      Regards

      Kannan