Pramati Technologies

Working with WebSphere 5.0

Overview

This chapter is for developers familiar with WebSphere Application Enterprise Server, version 5.0 and would like to deploy their applications using WAS v 5.0.

Studio provides tight integration with WebSphere Server 5.0. It automatically creates the deployment descriptors while the application is being developed, and keeps the application in a ready-to-deploy state. Studio provides support for deploying applications on local and remote server. The following functions can be performed inside Studio:

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

Configuring WebSphere 5.0 deployer

Configure WebSphere deployer before creating server instances. To work with WebSphere from Studio, the system requires minimum 512 MB RAM. Open runstudio.bat in an editor and add j2ee.jar and ibmjsse.jar to the system classpath. These files are available in WebSphere installation directory.

Setting classpath for Windows

JDK 1.3.x

Set the classpath as:

set classpath=c:\websphere\appserver\java\jre\lib\ext\ibmjsse.jar;c:\websphere\appserver\lib\j2ee.jar;c:\jdk1.3.1_03\lib\tools.jar;%install.root%\lib\pramati\classpath.jar

JDK 1.4 and above

Set the class path as:

set classpath=c:\websphere\appserver\java\jre\lib\ext\ibmjsse.jar; %install.root%\lib\pramati\classpath.jar

Setting classpath for Linux

JDK 1.3.x

Configure classpath as:

export classpath=/home/websphere/java/jre/lib/ibmjsse.jar:/home/websphere/lib/j2ee.jar:/usr/java/jdk1.3.1_03/lib/tools.jar:%install.root%/lib/pramati/classpath.jar

JDK 1.4 and above

Configure classpath as:

export classpath=/home/websphere/java/jre/lib/ibmjsse.jar:/home/websphere/lib/j2ee.jar:%install.root%/lib/pramati/classpath.jar

To develop applications in Studio and test-deploy them on WebSphere Server5.0, configure the WebSphere 5.0 Deployer in Studio. Click on Tools > Configure from the main menu. Select the option - WebSphere 5.0 deployer.

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

Each configured Server instance has a tab, `WAS 5 Output' in the Output Panel.

Creating WebSphere 5.0 server instances

To create an instance for WebSphere 5.0 server, select Tools > Server Configuration from the main menu. In the Server Configuration dialog, click New. In the Add New Server dialog, enter the following information:

Press OK to create a server instance and display the Server Config panel. Configure WebSphere properties as:

Note: Studio connects to server through a JMX SOAP connector as the value can not be set as RMI connector

Click OK to add the instance. To delete an instance, select the required server from Server Name field dropdown and click Delete.

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 and 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.

Note: Remote server cannot be started or stopped from Studio
Deploying applications on WebSphere

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:

If you add a new module to the desk, the entire desk should be deployed again as an ear.

Note: For WebSphere 5.0, the desk can be deployed as an EAR only. For deployment of a desk as an EAR, read the section on desk deployment in this document.

Deploying Message Driven Beans

To deploy a message driven bean(MDB), add a listener port for the MDB to WebSphere server. For example, for an MDB BuyQuote, add BuyQueueListenerPort to WebSphere 5.0 server.

For more information, read WebSphere 5.0 documentation.

Deploying a desk

Applications are deployed using MBean API provided by WebSphere. Deploy desk on the server as an EAR, using the right click Deploy as ear option. WebSphere specific .xmi files are automatically generated by Studio. These files contain all information such as binding, finder descriptors. These details are then placed appropriately at all levels in the EAR, and the desk is deployed with the name Desk_DeskName.ear where DeskName represents the name of the desk.

If the EJB module in the desk contains container managed persistence beans, Studio generates all required mapping files that contain the CMP mapping information.

To map the CMPs to existing tables, modify these files by entering the correct table and data base column names known as "middle-in-between mapping". Studio generates all mapping files and performs OR-mapping, automatically. Post OR-mapping, Studio uses EJB Deploy utility to generate deployment code.

Deploying EJB module

EJB module can be deployed as a separate application as a moduleName. To avoid class cast exception while accessing one module from another, ensure that the application classloader policy is set as `Single'.

To deploy a EJB module:

Deploying web module

To deploy a web module:

Adding datasources

Studio enables to add resources to WebSphere server from within Studio. Select Tools > Resources to open the Resource Tool.

Enter the details as:

For CMP 1.0, select Datasource Type as Datasource- V4 from the dropdown. For CMP 2.0, select Datasource.

Note: Other resources can be added using WebSphere 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\ejb-deploy. The .xmi files generated are stored in this archive and then the archive is deployed. This archive is then ready-to-deploy on WebSphere server from outside Studio.

Remote deployment

All deployment procedures except web module directory deployment for a remote WebSphere server is supported by Studio.

Enter the details as:

Adding datasources

For remote deployment, select Tools > Resources to open the Resource Tool. Enter the following details:

Initial setup for remote deployment

In <Pramati Studio install-dir>\wasUploadEAR, locate PramatiFileUpload.ear and deploy it in the remote WebSphere server using admin console for the local installation of WebSphere 5.0.

For details on the deployment in WebSphere, read WebSphere 5.0 documentation.

For information on deployment in Studio, read the sections `Deploying Message Driven Beans', `Deploying a desk', `Deploying EJB module', `Deploying web module'.

Log messages

For local WebSphere server, all log messages are displayed in the WebSphere tab in the output panel.

For remote deployment, Studio displays log messages of MBeans only.

Limitations in WebSphere usage

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

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

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

If Studio can not connect to WebSphere server, check:


Pramati Technologies  © Copyright   TOCPREVNEXTINDEX