AnsweredAssumed Answered

'No JTA UserTransaction available' after timerEvent

Question asked by bardioc on Oct 7, 2011
Hello,

I'm trying to evaluate Activiti as replacement for jBPM 4 in our projects under WebSphere Application Server 8.0. Various process models are triggered by EJB Message Driven Beans, and use intermediateCatchEvent/TimerEvents to delay further processing.

However, after an intermediateCatchEvent fired, I'm no longer able to create any Entity Manager within a JavaDelegate. I get the exception 'No JTA UserTransaction available' which is actually correct, as the job executor is no longer executed in the JEE context.

I've configured the process engine as follows:


final ProcessEngineConfiguration pec = ProcessEngineConfiguration.createProcessEngineConfigurationFromResourceDefault();
        pec.setJobExecutorActivate(true);
        pec.setDataSource(dataSource);
        pec.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
        pec.setJpaEntityManagerFactory(entityManagerFactory);
        pec.setJpaCloseEntityManager(true);
        pec.setJpaHandleTransaction(false);

        processEngine = pec.buildProcessEngine();
        final RepositoryService repositoryService = processEngine.getRepositoryService();

        repositoryService.createDeployment()
            .name("TestProcess")
            .addClasspathResource("/processes/inquiry/TestProcess.bpmn20.xml")
            .addClasspathResource("/processes/inquiry/TestProcess.png")
            .deploy();

        LOG.detail("Processes deployed successfully.");

The entityManagerFactory as well as the datasource are injected resources in the EJB using


@Resource(name = "jdbc/daas-persistence")
private DataSource dataSource;

@PersistenceUnit(unitName = "daas-persistence", name = "emf/daas-persistence")
private EntityManagerFactory entityManagerFactory;

The process model is as follows:

[attachment=0]TestProcess.png[/attachment]

The problem arises in the "Create Query 3" service task, respectively in its JavaDelegate::execute() method. As I'm no longer within a JEE context, I manually have to create a new entity manager as WebSphere does not allow to use JNDI lookups to java:comp/env for threads outside of the container.

When trying to persist the new entity, I get the error that there is no active JTA transaction.

Can somebody please help me out here? Is there a way to use the JPA features of persisting process variables throughout the whole process, not only until a first job-related task (such as a timer)?

Thank you very much,

Heiko

Attachments

Outcomes