Deploying enterprise beans

Deploying an enterprise bean to an application server usually involves the following steps:
  1. Creating a deployment descriptor XML-based file compliant with Sun's EJB 1.1 specification.

    When you use JBuilder's EJB wizards to create your beans, the deployment descriptors are being created at the same time for you.

  2. Editing the environment properties that an EJB requires at runtime, if necessary.

    You can edit environment properties using JBuilder's Deployment Descriptor editor.

  3. Creating an EJB JAR file containing the deployment descriptor and all of the classes required to operate the EJB (bean class, remote interface, home interface, stubs and skeletons, primary key class if the EJB is an entity bean, and any other associated classes).

    When you compile your EJB group using the JBuilder development environment, the proper JAR file is created for you.

  4. Deploying your EJB to an EJB container.

    JBuilder has an EJB Deployment wizard that simplifies the deployment process for Inprise enterprise beans. If WebLogic Server is your target application server, choosing Tools|EJB Deployment invokes WebLogic's EJB deployment tool. In general, JBuilder uses the deployment tool associated with the application server you selected for the current project if such a tool is available.


Creating a deployment descriptor file

As you create your enterprise beans using JBuilder's EJB tools, JBuilder is creating deployment descriptors at the same time. You can then use the Deployment Descriptor editor to add additional information and modify attributes in the deployment descriptors.

Each deployment descriptor must conform to the following requirements according to the EJB 1.1 specification:

When you use JBuilder's EJB tools to create and edit your deployment descriptors, you don't have to worry about learning XML or conforming to the semantics rules specified in Sun's DTD. The Deployment Descriptor editor imposes these rules on the data you enter and edit. As you fill in information using the Deployment Descriptor editor, it lets you know what data are required. JBuilder's tools automatically set up the Inprise-specific extensions in an ejb-inprise.xml file. For more information about the Deployment Descriptor editor, see "Using the Deployment Descriptor editor."


The role of the deployment descriptor

The role of the deployment descriptor is to provide information about each EJB that is to be bundled and deployed in a particular JAR file. It's intended to be used by the consumer of the EJB JAR file. As the bean developer, it's your responsibility to create the deployment descriptor. You can also modify the deployment descriptor once the enterprise bean is deployed.

The information in the deployment descriptor is used in setting enterprise bean attributes. These attributes define how the enterprise bean operates within a particular environment. For example, when you set the bean's transactional attributes, they define how the bean behaves with respect to transactions. The deployment descriptor keeps the following information:

The types of information in the deployment descriptor

The information in the deployment descriptor can be divided into two basic kinds:

Structural information

The bean developer must provide the following structural information for each bean in the EJB jar:

All enterprise beans

Enterprise session beans

Enterprise entity beans

Application assembly information

You can specify any of the following application assembly information. During application assembly, this information is optional. This same information is not optional for the role of the deployer

During the process of application assembly or deployment, you can modify the following structural information:

You can't modify any other types of structural information. You can modify any application assembly information at deployment time, however.

Security

The application assembler usually specifies the following information in the deployment descriptor:

Security roles

Using the security role elements in the deployment descriptor, the developer can define one or more security roles. These define the required security roles for the clients of the enterprise beans.

Method permissions

Using the method-permission elements in the deployment descriptor, the developer can define method permissions. Method permissions are paired relations between the security roles and the methods of the enterprise bean's remote and home interfaces.

Linking of security role references

If security roles are defined, the developer must link them with security role references using the role-link element in the deployment descriptor.

If your target application server is the Inprise Application Server, you'll have an additional deployment descriptor for you enterprise bean, ejb-inprise.xml. To read more about Inprise-specific information in deployment descriptors, see the "Deploying Enterprise JavaBeans" chapter of the Inprise Application Server's Enterprise JavaBeans Programmer's Guide.


Deploying to an application server

When your bean is working to your satisfaction and if you selected the Inprise Application Server as your application server for your current project, you can deploy your bean to the Inprise Application Server using JBuilder's EJB Deployment wizard.

Start the application server, then use the EJB Deployment wizard. The steps explained here assume you are deploying to the Inprise container. If your target application server is the WebLogic server, choosing Tools|EJB Deployment wizard displays the WebLogic Deployer Tool.

Deploying a single JAR file

These are the steps for deploying a single JAR file:

  1. Choose Tools|EJB Deployment wizard.

  2. Select the Quick mode option.

    You can check Verbose Output if you want to see all the details.

  3. Click Next.

  4. Use the Browse button to locate the JAR file containing your bean.

  5. Select the container you want to deploy your bean. If there is only one server running at the time, it will be selected automatically.

  6. If you want stubs to be generated, check the Generate Stubs check box.

  7. Click Next to see the next page.

    The wizard attempts to deploy the bean and reports its status to you on the page:

  8. Click Finish.

Deploying multiple JAR files

If you have multiple JARs to deploy or complex deployment requirements, use the Advanced mode of the EJB Deployment wizard, which involves several more steps:
  1. Choose Tools|EJB Deployment wizard.

  2. Select the Advanced mode option and click Next.

  3. Use the Add button to locate the JAR files you want to deploy and click Next.

    The wizard analyzes the selected JARs and reports its result on this page indicating the type of deployment descriptors it found.

  4. Click Next.

  5. Specify your desired Stub Generation and Java2IIOP options and click Next.

  6. Specify your desired Packaging and Verifier options and click Next.

    The wizard generates any necessary stubs, packages the JARs, and verifies them, reporting the results on this page.

  7. Click Next to go to the next step.

  8. Using the Add button, select the running containers you want to deploy your JARs.

  9. Specify any Post-Deployment Action options you want and click Next.

    The final page displays, showing the results of the deployment:

  10. Click Finish.