Enterprise Java™ Bean (EJB) methods with remote interfaces

EJB methods with remote interfaces can be remotely accessed or hosted by CICS® Liberty by using RMI-IIOP technologies. You can enable remote EJB support with the ejbRemote-3.2 feature.

When you use remote EJB interfaces, there are considerations that you must be aware of. For more information, see Using enterprise JavaBeans with remote interfaces on Liberty.

Accessing EJB methods with remote interfaces

  1. To configure CICS Liberty to run an application which accesses EJB methods with remote interfaces, you must enable the ejbRemote-3.2 feature by adding the feature into the server.xml file, as follows:
    <featureManager>
        <feature>ejbRemote-3.2</feature>
    </featureManager>
  2. Configure your application binding files, for example ibm-*-bnd.xml, for remote EJB references that are defined either in the deployment descriptor <ejb-ref>, or with source code annotations, for example @EJB. A binding is not required for EJB references that provide a lookup name, either on the annotation or in the deployment descriptor. In the binding file, the EJB reference can be bound by using one of the java: names for an EJB or with one of the corbaname:names:
    @EJB(name="TestBean")
        TestRemoteInterface testBean;

    The binding is defined:

    <ejb-ref name="TestBean" binding-name=
    "corbaname:rir:#ejb/global/TestApp/TestModule/TestBean!test.TestRemoteInterface"/>
    
  3. Configure your application client to include stub classes.

Hosting EJB methods with remote interfaces

  1. To host EJBs in CICS Liberty so they can be called by other JVMs, you must enable the ejbRemote-3.2 feature by adding the feature to the server.xml file, as follows:
    <featureManager>
        <feature>ejbRemote-3.2</feature>
    </featureManager>
  2. Configure the IIOP server to customize ports and security settings. For more information, see Configuring IIOP-RMI Transport for Remote EJBs.
  3. Create an EJB application. For more information, see Creating an Enterprise JavaBeans (EJB) project.
  4. Generate stub classes. In Eclipse, right-click the EJB project and select Java EE Tools > Create EJB Client JAR.
  5. Deploy the EJB application to CICS Liberty as part of an EAR. For more information, see Creating an Enterprise Application project.
  6. Check the Liberty messages.log file to ensure that the EJB is enabled and bound to a namespace. You should see this message:
    CNTR0167I: The server is binding the ejb.remote.ejb.view.MyBeanRemote 
    interface of the MyBean enterprise bean in the ejb.remote.ejb.jar module of the 
    ejb.remote application. The binding location is: 
    java:global/ejb.remote/ejb.remote.ejb/MyBean!remote.ejb.view.MyBeanRemote