Developing EJB applications on Liberty

An Enterprise JavaBeans (EJB) application is a set of beans that are packaged a combination of a Java™ archive file (jar), web application archive file (war), or Java EE enterprise application archive file (EAR). 

About this task

The WebSphere® Application Server Liberty provides full support for the Enterprise JavaBeans specification. The EJB Specification also defines a lite subset, which is also a configurable feature provided in Liberty in addition to several other optional features that enable server configurations that only support subsets of the full EJB specification. These subsets enable the use of server configurations that use fewer resources when all capabilities of the EJB specification are not used by the installed applications.

For information about developing EJB applications by using WebSphere Developer Tools, see Developing EJB 3,x applications.

Enterprise JavaBeans core features
ejbLite

This feature enables the lite subset of the EJB technology as defined in the EJB specification. This subset includes support for local session beans that are written to the EJB 3.x APIs. Beginning with the ejbLite-3.2 feature, the subset also includes support for non-persistent EJB timers and asynchronous local interface methods.

Other than enabling the ejbLite-3.2 feature in the server.xmlfile, no additional configuration is required for this feature.

mdb

This feature enables the message-driven bean subset of the EJB technology, which is similar to the support that the ejbLite feature enables for session beans. The feature does not enable session beans, so if both session and message-driven beans are needed, then both features need to be enabled in the server.xml file.

The following features provide the minimum set of capabilities for the EJB APIs:

Note: EJB 2.x API entity beans are not supported by Liberty. For persistence, the Java Persistence API (JPA) must be used instead.
Enterprise JavaBeans extension features

The following features provide extensions to the core EJB features, which, when they are combined, provide support for the full set of EJB APIs:

ejbHome

Enables support of the EJB 2.x APIs, specifically, support for the javax.ejb.EJBLocalHome interface. The javax.ejb.EJBHome interface is also supported when combined with the ejbRemote feature. Since this feature is not useful without the ejbLite feature, enabling this feature automatically enables the corresponding ejbLite feature.

Other than enabling the feature in the server.xml file, no additional configuration is available for this feature.

ejbPersistentTimer

Enables support for persistent EJB timers. Enabling this feature automatically enables the corresponding ejbLite feature.

In addition to enabling this feature in the server.xml file, a data source must also be configured to provide the persistent store for the timers. By default, the DefaultDataSource is used, so that configuration is all that is required.

ejbRemote

Enables support for remote EJB interfaces. Enabling this feature automatically enables the corresponding ejbLite feature.

Other than enabling the feature in the server.xml file, no additional configuration is required for this feature.

Enterprise JavaBeans convenience feature

The following feature provides a convenient way to enable the full set of EJB APIs:

ejb

Enables all of the core and extension features for the specification level of the configured feature. For example, ejb-3.1 enables ejbLite-3.1 and mdb-3.1. This feature provides no additional support beyond what is provided by enabling all of the core and extension EJB features.

Other than enabling the feature in the server.xml file, no additional configuration is required for this feature.

Procedure

Enable the feature in the server.xml file. For example:
<featureManager>
         <feature>ejbLite-3.2</feature>
    </featureManager>

Icon that indicates the type of topic Task topic

File name: twlp_ejb_dev.html