Java Reference
In-Depth Information
TABLE 12-1. Required Enterprise Bean Features in the Embeddable Container
Container providers are allowed to support the full set of features in enterprise beans, but
applications that use the embedded container will not be portable if they use enterprise
bean features not listed in
Table 12-1
, such as the timer service, session beans as web ser-
vice endpoints, or remote business interfaces.
Running Embedded Applications
The embedded container, the enterprise bean components, and the client all are executed
in the same virtual machine using the same classpath. As a result, developers can run an
application that uses the embedded container just like a typical Java SE application as fol-
lows:
java -classpath mySes-
sionBean.jar:containerProviderRuntime.jar:myClient.jar
com.example.ejb.client.Main
In the above example,
mySessionBean.jar
is an EJB JAR containing a local stateless
session bean,
containerProviderRuntime.jar
is a JAR file supplied by the en-
terprise bean provider that contains the needed runtime classes for the embedded contain-
er, and
myClient.jar
is a JAR file containing a Java SE application that calls the busi-
ness methods in the session bean through the embedded container.
Creating the Enterprise Bean Container
The
javax.ejb.embedded.EJBContainer
abstract class represents an instance of
the enterprise bean container and includes factory methods for creating a container in-