AnsweredAssumed Answered

activiti-cdi in WebLogic

Question asked by zoikks@gmail.com on Sep 20, 2013
Hello,

I am working in the following environment:

WebLogic 12c
Java 7
MySql
EJB 3.1
Activiti 5.12.1

I wrapped the calls to manage workflows in an EJB that has been working well.  We wanted to make use of the CDI components to leverage injection into the delegates.  I have now switched over the activiti.cfg.xml configuration to use org.activiti.cdi.CdiStandaloneProcessEngineConfiguration.  I then created a sample bean to test injection capabilities:

@Named
public class TestCdiBean implements Serializable {
    private static final long serialVersionUID = 1L;
    @Named
    public void sayHello() {
        System.out.println("Hello Herm.");
    }
}

When I execute a workflow via a unit test:

@Test
@Deployment(resources = {"diagrams/SampleWorkflow.bpmn" })
public void testStartCdiProcess() {
    RuntimeService runtimeService = this.activitiRule.getRuntimeService();
    runtimeService.startProcessInstanceByKey("myProcess");
}

Everything executes properly.  When I inspect the BeanManager, I see my TestCdiBean in the beans listing.  However, when I execute the same code via a deployment in WebLogic, the TestCdiBean cannot be found in the BeanManager and exceptions are thrown.  I have stepped through the code and discovered the BeanManager does NOT contain a listing for my TestCdiBean.

I have read postings where similar issues have been noted but I have never seen an issue.  Is there something special that has to be done when executing inside WebLogic?  I'm happy to exchange code if anyone has any insights about getting around this issue.  Modifications to WebLogic or to the weblogic-application.xml are possibilities if required.

Thanks.

Outcomes