cancel
Showing results for 
Search instead for 
Did you mean: 

Using Activiti in an JEE environment

chris_joelly
Champ in-the-making
Champ in-the-making
Hello,

i just try to figure out how to use Activiti engine in an JEE application running on an JEE server.

The server in question is Apache Geronimo which provides things like JPA and JSF, which i want
to use for an application, and for some parts of that application i want to use Activiti as process
engine.

I read through the Activiti documentation regarding some topics and the following questions arose
which i can not answer myself from the documentation, and trying all seems to be some effort so
if anybody has experience or knowledge about this issues i would be very glad to hear about it Smiley Happy

How can i initialize and start the process engine in an JEE/EAR based application? In JEE6 there is
a new type of session bean, singleton session bean which may be used for this issue. But what in
an JEE5 environment? Is there something similar?

Activiti is able to use JPA driven entities as process variables, but how needs Activiti to be configured
to use a datasource provided by the JEE server? Within an EJB module a persistence.xml needs to
be provided which configures JPA and a datasource can be referenced which is provided by the
JEE server. When Activiti is configured with a persistence unit from that persistence.xml, is this
sufficient for Activiti to be able to use the JPA driven entities from the EJB module?

Activiti is distributed with various tools like Explorer which provides a frontend to the tasks created
using the life time of a process. Can the process engine and the processes and tasks be managed
without Explorer, e.g. when building an own user interface around the Activiti engine? Is the REST
interface of Activiti the interface for such integration?

What about CDI? This is only available in JEE6 environments? Can this solve the initialization and
starting of the process engine with the @Inject ProcessEngine annotation? And are the JPA,
datasource, transaction and persistence unit issues too solvable using CDI in an JEE6 environment?

Thanks for any answer

Chris
15 REPLIES 15

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
Depending on what you want, you can make activiti use/join a jta transaction. It does not doe the transactionhandling itself. So that might be a solution

chris_joelly
Champ in-the-making
Champ in-the-making
hm. ok. i found this snippet in the forum:


   <bean id="transactionManager"
      class="org.springframework.transaction.jta.WebSphereUowTransactionManager"/>

   <!– process engine configuration –>
   <bean id="processEngineConfiguration"
      class="org.activiti.engine.impl.cfg.JtaProcessEngineConfiguration">
      <property name="dataSourceJndiName" value="jdbc/activitiDSH2" />
      <property name="transactionManager" ref="transactionManager" />
      <property name="transactionsExternallyManaged" value="true" />
      <property name="databaseSchemaUpdate" value="false" />
     
      <property name="mailServerHost" value="localhost" />
       <property name="mailServerPort" value="2525" />
      
   </bean>

and it is said that "The JTA process engine configuration needs a javax.transaction.TransactionManager…"

is this the configuration i need? and from where can i obtain such a TransactionManager?

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
is this the configuration i need? and from where can i obtain such a TransactionManager?

I think it is… Obtaining the JTA TransactionManager is done IN the class you specified (since it is container specific) So you should not need to do anything else (I think, did not use the spring way of configuring Activiti)

chris_joelly
Champ in-the-making
Champ in-the-making
finally i can initialize a process engine using the following activiti.cfg.xml and an singleton session bean in Glassfish:


<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jee="http://www.springframework.org/schema/jee"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd">

<jee:jndi-lookup jndi-name="java:appserver/TransactionManager" id="transactionManager" />

<bean id="processEngineConfiguration"
  class="org.activiti.engine.impl.cfg.JtaProcessEngineConfiguration">
  <property name="transactionManager" ref="transactionManager"/>
  <property name="transactionsExternallyManaged" value="true" />
  <property name="dataSourceJndiName" value="jdbc/MysqlErp" />
  <property name="databaseSchemaUpdate" value="true" />
  <property name="databaseType" value="mysql" />
  <property name="jobExecutorActivate" value="false" />
</bean>

</beans>

thanks for the help Smiley Happy

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
Thanks for reporting back…

idireneyoucef
Confirmed Champ
Confirmed Champ

you can use class java based  classe to replace activiti.cfg.xml it's bettre if you need help  i can help you