Hi again,
hm. after having not received any feedback yet, I will bother you now with all the details of my setup and implementation:
I have added my servicetasks into the activiti-explorer WAR file and the Remote EJB which I want to use from the servicetask is located in another deployment unit. By the way, we are building the activiti-explorer WAR file through a maven-web project into which we have copied all activiti stuff into the right places, so that we can easily integrate our own stuff in the standard maven way.
In the pom.xml of the activiti-explorer-web module I have added the dependency for activiti-cdi:
<code>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-cdi</artifactId>
</dependency>
</code>
The version comes from the parent pom.xml's dependencyManagement and is currently 5.16.4
in the activiti.cfg.xml i configured the transactionManager and processEngineConfiguration like this (as described in the activiti userguide for 5.16.4):
<code>
<bean id="transactionManager" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:appserver/TransactionManager"/>
<property name="resourceRef" value="true" />
</bean>
<bean id="processEngineConfiguration" class="org.activiti.cdi.CdiJtaProcessEngineConfiguration">
<!–<property name="dataSource" ref="dataSource" />–>
<property name="dataSourceJndiName" value="jdbc/activitiDS"/>
<property name="transactionManager" ref="transactionManager" />
<property name="databaseSchemaUpdate" value="true" />
<property name="jobExecutorActivate" value="true" />
<property name="enableDatabaseEventLogging" value="true" />
<property name="customFormTypes">
<list>
<bean class="org.activiti.explorer.form.UserFormType"/>
<bean class="org.activiti.explorer.form.ProcessDefinitionFormType"/>
<bean class="org.activiti.explorer.form.MonthFormType"/>
</list>
</property>
</bean>
</code>
The processEngineConfiguration bean also contains an LDAP config which I have cut out.
I inject the runtimeService and other activiti Beans in my ServiceTask:
<code>
@BusinessProcessScoped
public class UpdateProduktinstanzStatusServiceTask implements JavaDelegate {
@Inject
protected ProcessEngine processEngine;
@Inject
protected RepositoryService repositoryService;
@Inject
protected RuntimeService runtimeService;
@Inject
protected TaskService taskService;
@Inject
@ProcessInstanceId
private String processInstanceId;
@Inject
private ProcessInstance processInstance;
</code>
When I fire up the activiti-explorer WAR file in my Glassfish 4.1 Server, there are no errors and I can log into activiti-explorer without errors. There are 2 warnings (see excerpt below), but they don't seem to be related to my problem.
Here is the corresponding excerpt from the startup of the processEngineConfiguration Bean:
<code>
Warnung: The following warnings have been detected: WARNING: Parameter 1 of type java.util.Set<java.lang.Class<?>> from public void org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.setCustomMybatisMappers(java.util.Set<java.lang.Class<?>>) is not resolvable to a concrete type.
Warnung: The following warnings have been detected: WARNING: Parameter 1 of type java.util.Set<java.lang.Class<?>> from public void org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.setCustomMybatisMappers(java.util.Set<java.lang.Class<?>>) is not resolvable to a concrete type.
Information: 13 Nov 2014 09:31:32,703 [admin-listener(3)] INFO org.activiti.cdi.impl.ActivitiExtension:66 - Initializing activiti-cdi.
Information: 13 Nov 2014 09:31:32,731 [admin-listener(3)] INFO org.activiti.engine.ProcessEngines:97 - Initializing process engine using configuration 'file:/home/stephan/dev/my-netbeans-projectgroups/ngs/ngs-pga-parent/ngs-pga-activiti-explorer-web/target/ngs-pga-activiti-explorer-web-0.0.0.2/WEB-INF/classes/activiti.cfg.xml'
Information: 13 Nov 2014 09:31:32,732 [admin-listener(3)] INFO org.activiti.engine.ProcessEngines:166 - initializing process engine for resource file:/home/stephan/dev/my-netbeans-projectgroups/ngs/ngs-pga-parent/ngs-pga-activiti-explorer-web/target/ngs-pga-activiti-explorer-web-0.0.0.2/WEB-INF/classes/activiti.cfg.xml
</code>
and some lines later:
<code>
Information: 13 Nov 2014 09:31:33,186 [admin-listener(3)] DEBUG org.springframework.beans.factory.support.DefaultSingletonBeanRegistry:220 - Creating shared instance of singleton bean 'processEngineConfiguration'
Information: 13 Nov 2014 09:31:33,187 [admin-listener(3)] DEBUG org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory:449 - Creating instance of bean 'processEngineConfiguration'
Information: 13 Nov 2014 09:31:33,257 [admin-listener(3)] DEBUG org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory:523 - Eagerly caching bean 'processEngineConfiguration' to allow for resolving potential circular references
Information: 13 Nov 2014 09:31:33,324 [admin-listener(3)] DEBUG org.springframework.beans.factory.support.DefaultSingletonBeanRegistry:220 - Creating shared instance of singleton bean 'transactionManager'
Information: 13 Nov 2014 09:31:33,324 [admin-listener(3)] DEBUG org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory:449 - Creating instance of bean 'transactionManager'
Information: 13 Nov 2014 09:31:33,337 [admin-listener(3)] DEBUG org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory:523 - Eagerly caching bean 'transactionManager' to allow for resolving potential circular references
Information: 13 Nov 2014 09:31:33,387 [admin-listener(3)] DEBUG org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory:1595 - Invoking afterPropertiesSet() on bean with name 'transactionManager'
Information: 13 Nov 2014 09:31:33,387 [admin-listener(3)] DEBUG org.springframework.jndi.JndiTemplate:150 - Looking up JNDI object with name [java:appserver/TransactionManager]
Information: 13 Nov 2014 09:31:33,390 [admin-listener(3)] DEBUG org.springframework.jndi.JndiLocatorSupport:111 - Located object with JNDI name [java:appserver/TransactionManager]
Information: 13 Nov 2014 09:31:33,393 [admin-listener(3)] DEBUG org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory:477 - Finished creating instance of bean 'transactionManager'
Information: 13 Nov 2014 09:31:33,398 [admin-listener(3)] DEBUG org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory:449 - Creating instance of bean 'org.activiti.explorer.form.UserFormType#5d4b8d2c'
Information: 13 Nov 2014 09:31:33,402 [admin-listener(3)] DEBUG org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory:477 - Finished creating instance of bean 'org.activiti.explorer.form.UserFormType#5d4b8d2c'
Information: 13 Nov 2014 09:31:33,403 [admin-listener(3)] DEBUG org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory:449 - Creating instance of bean 'org.activiti.explorer.form.ProcessDefinitionFormType#b21738e'
Information: 13 Nov 2014 09:31:33,405 [admin-listener(3)] DEBUG org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory:477 - Finished creating instance of bean 'org.activiti.explorer.form.ProcessDefinitionFormType#b21738e'
Information: 13 Nov 2014 09:31:33,406 [admin-listener(3)] DEBUG org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory:449 - Creating instance of bean 'org.activiti.explorer.form.MonthFormType#41297557'
Information: 13 Nov 2014 09:31:33,407 [admin-listener(3)] DEBUG org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory:477 - Finished creating instance of bean 'org.activiti.explorer.form.MonthFormType#41297557'
Information: 13 Nov 2014 09:31:33,411 [admin-listener(3)] DEBUG org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory:449 - Creating instance of bean 'org.activiti.ldap.LDAPConfigurator#8d6c42d'
Information: 13 Nov 2014 09:31:33,435 [admin-listener(3)] DEBUG org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory:477 - Finished creating instance of bean 'org.activiti.ldap.LDAPConfigurator#8d6c42d'
Information: 13 Nov 2014 09:31:33,437 [admin-listener(3)] DEBUG org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory:477 - Finished creating instance of bean 'processEngineConfiguration'
</code>
When I start an instance of a process containing the above Servicetask as its very first action, and set a breakpoint in my execute-Method, I see, that all variables of the CDI-Injections are null. It seems, that acitiviti-cdi simply does not recognize my Servicetask to be a CDI-Bean and thus doesn't inject anything…
As already stated in my first post, this is Glassfish 4.1 with JavaEE7 and CDI 1.2(!)
Any help would be appreciated