How to properly integrate jBPM EJB services into EAR packaged web application in WildFly 10?

Viewed 312

I want to integrate jBPM (7.4.1) in my JavaEE 7 web application and utilize the provided EJB services.

I fully read the jBPM documentation. I followed some example projects that are linked from the docs. I struggled with google and asked on the jBPM IRC chat.

To enforce strict code separation I am using standard maven project structure for EARs, resulting in

- project
  |- kjar-module (BPMN definitions with jBPM kmodule descriptor)
  |- ejb module (JPA backed model entities and service layer)
  |- web module (JSF web frontent)
  |- ear module (packaging)

What I want to achieve, is to embedd the jBPM EJB services along with my own application service layer. What I have tried so far, is to add jBPM EJB service dependencies to my ejb-module and creating a simple startup EJB to register my process definitions via DeploymentService.

Therefore I added the jbpm-bom to my projects pom

<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>org.jbpm</groupId>
      <artifactId>jbpm-bom</artifactId>
      <type>pom</type>
      <version>7.4.1.Final</version>
      <scope>import</scope>
    </dependency>
  </dependencies>
</dependencyManagement>

and the EJB service dependency to my ejb-modules pom.

<dependency>
  <groupId>org.jbpm</groupId>
  <artifactId>jbpm-services-ejb-impl</artifactId>
</dependency>

Then I created a simple EJB

@Singleton
@Startup
public class ProcessManager {

  @EJB
  private DeploymentServiceEJBLocal deploymentService;
}

and deployed my web application to WildFly 10. Then WildFly complained with

17:49:03,052 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service jboss.deployment.subunit."flow-ear-2.0.0-SNAPSHOT.ear"."flow-ejb-2.0.0-SNAPSHOT.jar".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.subunit."flow-ear-2.0.0-SNAPSHOT.ear"."flow-ejb-2.0.0-SNAPSHOT.jar".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of subdeployment "flow-ejb-2.0.0-SNAPSHOT.jar" of deployment "flow-ear-2.0.0-SNAPSHOT.ear"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:154)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYEE0052: Failed to install component ProcessManager
at org.jboss.as.ee.component.deployers.ComponentInstallProcessor.deploy(ComponentInstallProcessor.java:109)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:147)
... 5 more
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYEJB0406: No EJB found with interface of type 'org.jbpm.services.ejb.api.DeploymentServiceEJBLocal' for binding xxx.ProcessManager/deploymentService
at org.jboss.as.ejb3.deployment.processors.EjbInjectionSource.getResourceValue(EjbInjectionSource.java:90)
at org.jboss.as.ee.component.deployers.ComponentInstallProcessor.processBindings(ComponentInstallProcessor.java:263)
at org.jboss.as.ee.component.deployers.ComponentInstallProcessor.access$000(ComponentInstallProcessor.java:80)
at org.jboss.as.ee.component.deployers.ComponentInstallProcessor$1.handle(ComponentInstallProcessor.java:215)
at org.jboss.as.ee.component.ClassDescriptionTraversal.run(ClassDescriptionTraversal.java:54)
at org.jboss.as.ee.component.deployers.ComponentInstallProcessor.deployComponent(ComponentInstallProcessor.java:218)
at org.jboss.as.ee.component.deployers.ComponentInstallProcessor.deploy(ComponentInstallProcessor.java:101)
... 6 more

Since I have initially asked the question, I realized some things. The EARs library folder is not scanned for EJBs. That explains the error above.

At the moment I am experimenting with various setups to get jBPM EJB service integration to work or better to say at least to get WildFly to start without any errors.

Is there only one way on how to do that? If not, what are best practices?

0 Answers
Related