cancel
Showing results for 
Search instead for 
Did you mean: 

Activiti, CDI and EJB problem

espe
Champ in-the-making
Champ in-the-making
Hello,
New to Activiti trying to migrate an existing solution to Activiti logic. Because of this I want to minimize the impact and reuse the same old EJBs I was using before by invoking them from Activiti's service tasks. Application server is Weblogic. What I did:

Created programmatically the process engine

CdiStandaloneProcessEngineConfiguration processEngineConfiguration = new CdiStandaloneProcessEngineConfiguration();
      processEngineConfiguration.setProcessEngineName("default");
      processEngineConfiguration.setDataSourceJndiName("JDBC_xxx");
      processEngineConfiguration.setDatabaseType("oracle");
      processEngineConfiguration.setTransactionsExternallyManaged(false);
      processEngineConfiguration.setJobExecutorActivate(true);
      processEngine = processEngineConfiguration.buildProcessEngine();


Created a test bean with one operation

@Stateless
@LocalBean
@Named
public class Dummy {
    public void print() {
                System.out….
         }
}


Created a simple definition with one service task and form properties trying to invoke the bean mentioned above

<serviceTask id="servicetask1" name="Service Task" activiti:expression="#{dummy.print()}"></serviceTask>


Initiated the process instance

RuntimeService runtimeService = processEngine.getRuntimeService();
runtimeService.startProcessInstanceByKey("myProcess");


and I am getting nothing. Not even an exception. As if everything is ignored. And obviously System.out statement never executes. So, am I missing something here? Do I need to configure my beans somewhere else? Just to mention that code (beans, processEngine creation etc) exists in different packages.
I also tried with activiti:expression="dummy.print()", as mentioned in the guide but still no luck.
From other tests that I made, I am sure that definition gets loaded and Activiti engine is properly configured overall.
3 REPLIES 3

vasile_dirla
Star Contributor
Star Contributor
just try to use the expression like that:
<code>
activiti:expression="#{dummy.print()}"
</code>

espe
Champ in-the-making
Champ in-the-making
I did but it's not working. Null pointer..
I am thinking that maybe it's because I'm not instantiating the default Spring process engine (I am using the cdi version), all the beans are not loaded properly.

vasile_dirla
Star Contributor
Star Contributor
please create a Unit test for it and put it here for download.