JBoss Community

Re: TaskServer, persistence file and session

created by Marie MM in jBPM - View the full discussion

Ok, I will try one error now:

 

I changed the example Simple emergency to be able save process info in DB, with ksession = JPAKnowledgeService.newStatefulKnowledgeSession(kbase, config, env );

This is OK, it saves all data as expected.

 

Then I added the task service (based on another HelloProcess example):

 

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

        TaskServiceSession taskSession = taskService.createSession();

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

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

 

 

When I run the test, it stops in taskSession.addUser(new User("Admin")); with

 

A JTA EntityManager cannot use getTransaction()

java.lang.IllegalStateException: A JTA EntityManager cannot use getTransaction()

        at org.hibernate.ejb.AbstractEntityManagerImpl.getTransaction(AbstractEntityManagerImpl.java:324)

        at org.hibernate.ejb.AbstractEntityManagerImpl.getTransaction(AbstractEntityManagerImpl.java:324)

        at org.jbpm.task.service.TaskServiceSession.doOperationInTransaction(TaskServiceSession.java:707)

        at org.jbpm.task.service.TaskServiceSession.persistInTransaction(TaskServiceSession.java:682)

        at org.jbpm.task.service.TaskServiceSession.addUser(TaskServiceSession.java:69)

        at com.wordpress.salaboy.examples.ProcessTaskTest.humanTasksTest(ProcessTaskTest.java:83)

 

 

I tried several different ways to get rid of it, nothing worked. I am using persistence unit with all classes together. See persistence.xml in attachment.

 

Do you have any idea about this exception? Thank you a lot for your time.

Reply to this message by going to Community

Start a new discussion in jBPM at Community