+

Search Tips   |   Advanced Search

EJB 3.0 deployment overview


Learn about the EJBs 3.0 deployment model, including to Just-In-Time (JIT) deployment.

All Java EE appserver products have some form of EJB deployment phase in which the application is customized to run in that particular implementation of the appserver. Typically, this is accomplished by a deployment tool that is specific to the appserver and generates code to bridge the EJB interface and implementation code to the appserver's implementation for an EJB container. Some appserver products' deployment tools alter the bytecodes of the application classes, rather than generating code, but the end result is similar.

Application Server bridges the EJB interface with it's implementation by generating code that encapsulates the EJB implementation classes, connecting them to Application Server's EJB container. This allows the EJB container to host the enterprise beans and provide services to them. If one or more of the enterprise beans has remote interfaces defined, Application Server generates additional code to provide the remote function.

 

EJBDeploy Tool

Historically, EJB deployment in the appserver product has been performed by the EJBDeploy tool, which is included with WAS and packaged with the development tools for the WebSphere products.

The EJBDeploy tool introspects the external interfaces for the enterprise beans, generates the wrapper code as .java files, and compiles the code using the javac compiler to produce .class files that are packaged in the EJB module with the application code. The EJBDeploy tool also runs the rmic tool against the remote EJB interfaces in the application, producing additional stub and tie class files that interact with the Remote Method Invocation over Internet Inter-ORB Protocol (RMI-IIOP) (ORB), providing remote object support.

Typically, you run the EJBDeploy tool when you install the application on Application Server or before you install the application from the command-line tool or a development tool.

 

Just-In-Time (JIT) deployment

EJB 3.0 support in Application Server introduces a new feature called JIT deployment.

With JIT deployment, the EJB container dynamically generates the wrapper, stub, and tie classes in-memory when the application is running. Additionally, the Web container and application client containers dynamically generate the stub class that is required for remote EJB invocations.

Effectively, this means that you do not need to process EJB 3.0 modules, Web modules that invoke EJB 3.0 beans, or client modules that invoke EJB 3.0 beans, through the EJBDeploy tool before you run them in Application Server.

 

createEJBStubs tool

In most cases the Just-In-Time deployment feature can dynamically generates the RMI-IIOP stub classes that are required for invocation of remote EJB interfaces, there are some instances in which these stub classes are not dynamically generated. For EJB 3.0 clients that are not running inside an EJB 3.0 enabled Web container, EJB container, or client container, generate the stub classes with the createEJBStubs tool and verify the generated stubs are available in the client environment's class path. Typically, you would accomplish this by copying the generated stubs to the location where the client's business interface class resides. The createEJBStubs tool must be used to generate client-side stubs for the following environments:

 

Interoperability

There can be unexpected results if a WebSphere stack product, or another product, that runs on a version of Application Server that does not support EJB 3.0 attempts to remotely invoke a method on an EJB 3.0 compliant enterprise bean on a separate server that is running a version Application Server that supports EJB 3.0. If these products attempt to invoke a method through the enterprise bean's EJB 3.0 remote business interface, they might encounter exceptions that were introduced in EJB 3.0 that will be pushed back to the environment not EJB 3.0 compliant.

This scenario could also be an issue for an administrator of an environment that includes a combination of stack products that contain a mixture of EJB 3.0 compliant and non-compliant instances of Application Server.

The following is a list of the exception classes that have been introduced in EJB 3.0:

Refer to the EJB module deployment step to address potential interoperability issues.



Related concepts


EJB 3.0 module packaging overview
EJB modules

 

Related tasks


Deploy EJB modules
Task overview: Using enterprise beans in applications