Advertisements

Monday, August 20, 2018

Wildfly - Call local EJB from Camel Processor

Here are 2 steps you need to have in order to instantiate a EJB local instance.


  1. Specify the module dependency at the descriptor from the caller.
  2. Add the dependency where the interface are located
Module Dependency

By default, Java EE deployment units (jars, ejb-jars, wars, ears-and-their-contents) are isolated from each other. In other words, classes in one deployment unit do not have access to classes in other deployment units.

If your EJBs and interfaces are packaged in a jar named sample-engine-ejb-1.0.jar, then you can make the classes in this jar accessible to your web application by adding a WEB-INF/jboss-deployment-structure.xml file to it with the following content:
xml version="1.0"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.3">
    <deployment>
        <dependencies>
            <module name="deployment.sample-engine-ejb-1.0.jar" />
        </dependencies>
    </deployment>
</jboss-deployment-structure>

Maven Dependency

Caller needs to have access to the EJB local interface to cast the instance of the EJB.


  
   com.sample.ejb
sample-engine-ejb ejb 1.0 provided

No comments:

Post a Comment