Using enterprise JavaBeans applications that call local EJB components in another application

The Enterprise Beans specification requires that local client views are supported for Enterprise Bean components that are packaged within the same application. These views include local homes, local business interfaces, and the no-interface view. Local client views are also supported for Enterprise Bean components that are not packaged within the same application, but more configuration is required.

About this task

The product supports access to local client views to Enterprise Beans components packaged within a separate application with some restrictions:
  • The local interface and all parameter, return, and exception types that it uses must be visible to the class loader of both the calling application and the target Enterprise Beans application. You can ensure that they are visible by either using a shared library that is associated with a server class loader or by using a common library reference with both applications.
  • When the target Enterprise Beans application is stopped, any cached references to the Enterprise Beans must be refreshed by restarting the calling application. The simplest solution is to restart the calling application whenever you restart a target Enterprise Beans application on which it relies.

Procedure

Add the configuration to the server.xml file; for example:
<library id="ejbInterfaceLib">
        <file name="${server.config.dir}/lib/ejbInterfaceLib.jar"/>
    </library>
    <webApplication id="ejbClient" location="ejbClient.war">
        <classloader commonLibraryRef="ejbInterfaceLib"/>
    </webApplication>
    <ejbApplication id="ejbApp" location="ejbApp.ear">
        <classloader commonLibraryRef="ejbInterfaceLib"/>
    </ejbApplication>