Pramati Technologies

Working with WebSphere 4.0

This chapter is for developers who are familiar with WebSphere Application Enterprise Server, version 4.0 (WAS 4.0) and would like to deploy their applications using WAS 4.0.

Studio provides tight integration with WebSphere Server 4.0. It automatically creates the required deployment descriptors while the application is being developed, and keeps the application in a "ready-to-deploy" state. Studio provides all the support required for deploying applications on local server. Some of the operations that are supported are:

This chapter discusses how to develop EJB 1.1 applications in Studio and deploy them on WebSphere.

Configuring WebSphere Deployer

To develop applications in Studio and test-deploy them on WebSphere 4.0 Server, the WebSphere Deployer needs to be configured in Studio. Click on Tools > Configure from the main menu. In the Tools Configure dialog that comes up, check against the option - WebSphere 4.0 deployer.

After closing the Tools Configure dialog, multiple instances of the WebSphere server can be created in Studio.

Note: Each configured Server instance has its own tab in the Output Panel.

Creating WebLogic Server Instances

To create an instance for WebSphere Server, click on Tools > Server Configuration from the main menu. In the Server Configuration dialog that comes up, click on the New button to create a new instance of the server. In the Add New Server dialog that pops up, enter the following information:

Server Name Enter the name of the server instance that is to be created in the dialog

Server Type Select the type of the server from the list in the combo box as WAS 4.0 AEs.

Pressing OK creates an instance of the server and displays the Server Config panel, where WebSphere properties are to be configured:

Server Name The Server name is automatically selected as the name entered in the Add New Server dialog. To select another server instance that is to be configured, choose from the list in the combo box

Type The Server type is displayed as the type selected in the Add New Server dialog.

Naming Port Enter the port number on which server has been configured to listen to orb requests. The default value is WebSphere server 900.

HTTP Port Enter the port number on which server has been configured to listen to http requests. The Default value for WebSphere server is 9080

Installation dir Enter the installation directory of WebSphere 4.0 server in this field. The directory entered here must be the parent directory of \bin, which was created when the server was installed.

Example

D:\WebSphere40\AppServer

Use the OK button to add the instance of the WebSphere Server. To delete a server instance, select the required server from the field, Server Name and use the Delete button.

Starting & Stopping Server

After creating the WebSphere server instance in Studio, close the Server Configuration panel, and select the instance from the Server Box in the Status Bar. Selecting the WebSphere server instance here makes it the current server, and all server specific operations for the active Desk is performed on the current server.

The WebSphere server instance can be started/stopped in a similar way as any other server in Studio. Use Tools > Start Server to start the Server. To stop a server, use Tools > Stop Server from the main menu. The Server can also be started/stopped using the Signal Box.

Deploying on WebSphere

Before deploying any application on WebSphere, keep the following points in mind.

The option Deploy, available on a right click on the Desk Root is disabled when the selected server is WebSphere. In such cases, deploy the Desk using any of the following options:

After the option, Deploy as ear has been used, individual modules can be updated by right clicking on the modules and selecting Deploy. Attempting to deploy a module without deploying the Desk as an ear, displays a message, prompting the user to deploy the Desk as an ear.

Adding a new module to the Desk, requires the Desk to be deployed again as an ear, for the server to pick-up the module as a part of the enterprise archive.

Desk Deployment

Applications are deployed using SEAppInstall utility of WebSphere. A Desk can be deployed as an ear on the server, using the Deploy as ear option, available on a right click on the Desk. The WebSphere specific .xmi files are automatically generated by Studio. These files contain all the required information like binding, finder descriptors. These details are then placed in the appropriate places at all levels in the ear, and the Desk is deployed with the name Desk_DeskName.ear. Here DeskName represents the name of the Desk.

Deployment should be performed without the server running, and the server should be started after deployment completes. For re-deploying the Desk, the server should be stopped and restarted after the deployment.

If the EJB module in the Desk contains container managed persistence beans, WebSphere generates two files, namely map.mapxmi and schema.dbxmi. These files contain the CMP mapping information, created by "top down mapping" method by WebSphere.The table name and database column names present in these files are based on the CMP names and their respective field names.

To map the CMPs to existing tables, these files need to be modified by entering the correct table and data base column names known as "middle-in-between mapping".This is performed automatically by Studio. The files are then extracted from the JAR, modified, and put inside the JAR. The JAR is then re-deployed, using the EjbDeploy utility. This saves the user from manually editing any of these files.

Module deployment

A module can be deployed individually only after if it has been deployed as a part of an ear, atleast once.

Example

If a Desk, myDesk contains modules MyEjbModule and MyWebModule, then the Desk first needs to be deployed as an EAR. The Desk, in this case is deployed as an EAR with the name Desk_MyDesk.ear, and it contains the JAR, MyEjbModule.jar and the WAR, MyWebModule.war. Modifying any of these modules, does not require the Desk to be re-deployed, and allows the modules to be deployed individually.

Adding a new module to the Desk, requires the Desk to be re-deployed as an EAR. This is needed for the server to pick the modules as a part of the EAR.

Individual EJB modules are deployed in WebSphere, using the EjbDeploy utility. If the module contains a CMP, the "middle-in-between" mapping is performed automatically by Studio.

Individual Web modules are deployed by copying the module directory from Studio to the WebModule.war directory located under <WAS_install_dir>\installedApps\Desk_DeskName.ear. Here <WAS_install_dir> is the installation directory of WebSphere, and DeskName, the name of the Desk.

Module deployment should be performed with the server not running. After deployment has been done, the server should be re-started for enabling it to pick up the changes.

Resources

The resources created using Resource Tool, are not automatically added to the WebSphere server by Studio. Resources with identical details should be bound to the server using WebSphere's admin console.

Example

If a data source is created with the JNDI name as demo and the url as jdbc:oracle:thin@hostname:port, then a data source with JNDI name, demo and url, jdbc:oracle:thin@hostname:port must be made available to the server using the admin console.

Queries for EJB 1.1 Beans

CMP 1.1 beans require finder queries for defining the Finder methods. These queries can be created using the Query Wizard while creating the bean, or in the Bean Properties panel before deployment. Studio interprets this query and writes WebSphere Application Server (WAS) specific query in its deployment descriptor.

The query should use only the bean table for which, the query is being written, and no other table.

Creating WebSphere Archives

Developing applications in Studio creates archives and modules with Pramati xml files. Deploying a Desk, creates an archive and makes a copy of this archive in the directory, <install_dir>\wasEar. The xmi files generated are stored in this archive and then the archive is deployed. This archive is then "ready to be deployed" on WebSphere server from outside Studio.

WebSphere Usage Restrictions

Example

CheckingHome home = (CheckingHome)ic.lookup("java:comp/env/ejb/Checking");

Object ob = home.findById(<id>);

Checking account = (Checking)PortableRemoteObject.narrow(ob, Checking.class);


Pramati Technologies  © Copyright   TOCPREVNEXTINDEX