Pramati Technologies

Deploying Application

The deployment process requires the deployer, an expert in a specific operational environment, to deploy Web applications and Enterprise JavaBeans components into that environment. An expert deployer is responsible for resolving a lot of dependencies before the application can be deployed.

This chapter discusses deploying applications and running them. JARs, WARs and EARs, are all used to run applications. Running the application involves starting the Server and deploying the JAR, WAR or EAR.

Starting Deploy Tool

Tools > Deploy

JARs, WARs and EARs can all be deployed independently in a target Server environment. The deploy tool needs to know the target Server environment properties. To deploy any application, the Deploy tool first starts the Server. Since the Server for J2EE is in-built with Studio, starting and stopping the Server is possible without leaving Studio.

Third-party servers like WebLogic, Oracle can also be started from within Studio, once they have been configured using the Server Configuration panel available under the Tools main menu.

This chapter assumes that the user is deploying applications on the in-built Pramati Server. Refer to the corresponding chapters on WebLogic and Oracle, to know how to configure and work with these third-party servers.

After the Server is started, the Deploy tool attempts to get information on:

If it is discovered that resources are undefined, shut down the Server, add the resource and restart the Server. It is possible to "Hot Add" resources to a running Server. If the message Could not talk to Server is displayed, it means some or all of the above properties could not be obtained from the Server.

To diagnose this problem:

Starting the Server

Tools > Start Server

The Server for J2EE may be started in three ways:

When the Server is started, the following services are activated:

Viewing Incomplete Tasks

The application cannot be deployed until all dependencies are resolved. The arrow at the right hand bottom corner of the Deploy tool turns green when there are incomplete tasks to be completed before the application is ready for deployment. Clicking on the green arrow on the right hand corner takes you to the next task to be completed. View all the tasks that need to be completed before the application can be deployed, by choosing View > All Tasks.

It is recommended that the user complete the incomplete tasks using the Next Task button, as it follows the recommended path for deployment.

Validating Applications

The Validator tool, shipped with Pramati Server is used to validate archives based on certain pre-defined conditions. The validation verifies whether all tasks to be performed by the bean provider, as mentioned in the EJB 2.0 specification, are complete.

Example

The validation checks whether a bean class is abstract and if it is, displays the error message. The validation also checks whether the method - ejbCreate returns the PrimaryKey class and if it does not, displays the error message.

The Deploy Tool automatically validates an archive or module when it is opened for deploying. There are two types of validation options that can be enabled and disabled from being used when opening archives. Check the options by clicking on Archive > Validation Options from under the main menu:

To validate applications when they are opened, follow the given steps:

Archives can also be specifically validated by selecting Archive > Validate from the main menu. This brings up the validate dialog where the validation task is performed, and the status and progress of the validation being performed are displayed.

To stop the validation in between, use the Stop button. All the error messages are reported and displayed in this dialog with the following details:

Severity Severity levels are assigned against each validation condition. You can take corrective action depending on the message that appears against each validation condition. The levels are:

Component The name of the component where the error was found.

Message The message describing the nature of the error.

To copy all the messages to the clipboard before so that they can be pasted elsewhere, use the button - Copy to Clipboard. The success message is displayed once the bean passes the test. Once the validation is complete, use the Deploy button to deploy the module or archive. Use the Cancel button to cancel and close the validation.

Setting Bean Properties

The bean properties node in the tree allows setting the properties of each bean. Clicking on the node makes the right hand panel show a table of beans in the application and their properties. The attributes that can be set here are General, EJB References, Resource References, Resource Environment References, MDB Destinations, and Run As. The following sections provide detailed description for all the attributes mentioned above.

General Properties

This panel appears by default, when the Bean Properties node is selected. The attributes in this tab are:

Note: If a JAR contains four beans, the JAR name appears four times in the list.

After the specified time, if the pool size is always below the minimum pool size, then the pool size is reduced to the minimum pool size. To set the LAI(min), enter the value in this field.

If this name is already bound, then the name, ejb-name@jarname is provided, where ejb-name represents the name of the Bean, and jarname represents the name of the JAR. In case the above name is also bound, the names provided are ejb-name@jarname1, ejb-name@jarname2, ejb-name@jarname3 etc. such that the JNDI Name provided is always unique. The JNDI Name can be set in this field, by entering the value.

Note: No JNDI Names are provided for MDBs as they are never looked up or referenced.

Resolving EJB References

This panel is displayed on clicking the EJB References tab in the Bean Properties node. This panel lists the beans which refer other beans in the Container.

The attributes provided in this tab are:

Selecting any of the beans columns, displays the EJB-ref type, the interfaces of the bean (LocalHome, Local, Remote, RemoteHome), and also an optional description in the lower half of the panel. The description field is editable.

Resolving Resource References

Clicking on the Resource Ref tab allows mapping of resource references onto the defined resources. The defined resources are obtained from the Server. In case a new resource is added using the Resource Tool, it gets added to the running Server.

The attributes in this panel are:

Selecting a Bean row, displays the resource type, the resource authorisation, and also an optional description in the lower half of the panel. The description field is editable.

The types of the resources directly bound on the server are javax.jms.QueueConnectionFactory, javax.jms.TopicConnectionFactory, javax.sql.DataSource, javax.mail.Session, java.net.URL. If the resource is bound by a RAR, then there maybe a few other types of resources.

Session Timeout

Select the Session Timeout tab in the Bean Properties node. This panel appears only for stateful session beans. The attributes in this panel are:

Resource Environment References

Click on the Res Env Ref tab in the Bean Properties node. This panel contains a declaration of an enterprise bean's reference to an administered object associated with a resource in the enterprise bean's environment.

It consists of the resource environment reference name, the resource environment reference type expected by the enterprise bean code, the bean name, and the archive which the bean belongs to. The resource environment reference can be selected from the types, javax.jms.Queue and javax.jms.Topic.

The Deployer is allowed to select the value assigned to the bean's resource environment reference.

MDB Destinations

This panel appears as a tab in the Bean Properties node only if the bean selected is a message driven bean. This panel is used to select the destination types of the message driven beans in the JAR.

The destination specifies the type of the JMS destination. The destination type can be either Queue or Topic.

Environment Properties

All the environment entries that can be accessed from the EJB code are displayed here. An environment entry is scoped to the bean. This means:

It is possible to select the Java type of an environment entry value from the drop-down list under the Variable Type field.

Run As

Select the Run As tab in the Bean Properties node. This panel appears only after the Security Roles have been added. The deployer uses this to map a user to the run-as role for a Bean. The attributes are:

Viewing JAR Properties

Clicking on the JAR node on the left window displays the information corresponding to the tree node selected on the right window. The JAR node contains information about all the beans inside the JAR.

Checking the option - Start the application on server restart, available in this panel deploys the application every time the server is started.

General Information

Clicking on a Bean node under a JAR node, displays the tab, General. This panel displays Bean information, Deployment Information, and also the bean description.

The Bean information section displays the EJB Name, Bean Type, Home Interface, Remote Interface, Local Interface and Local Home Interface. The deployment descriptor is populated/developed based on the information provided by ejb-jar.xml file. The deployment descriptor for the EJB components is stored as META-INF/ejb-jar.xml. This section contains information on JNDI Name, Max Pool Size, Min Pool Size, and Low Activity Interval.

Method Information

Click on the bean node inside the JAR, and select the Method Information tab. All the methods of the Enterprise JavaBeans Home and Remote Interfaces are listed here. Check/Uncheck the methods that alter the bean state.

O-R Mapping

This panel appears only for CMP 1.1 beans. Click on the specific bean node, and select the CMFields tab. Use the existing tables so that the Server generates the appropriate queries to create, load, store, and remove CMP beans.

Follow the given steps to O-R map a CMP bean:

  1. Choose from the available data sources listed in the Data Source combo box.
  2. Choose an appropriate table from the field, Table. The table can be chosen from an existing database.
  3. Select the appropriate database attributes from the DB Attribute field, to map them to each of the CMP Fields in the table.
  4. Enter the required description in the CMF Description field. This is optional.

Primary Key Class

This panel appears only for if the bean selected is a EJB 2.0 bean, and its primary key class is java.lang.object. Select the Bean node in the JAR, and click on the PKPanel tab.

The attributes in this panel are:

Data Source Choose from the available data sources available in the combo box.

Table Name Choose an appropriate table from the field. The table can be chosen from an existing database.

PK Clicking on the a key icon for a database attribute makes it into a primary key class for the table. A primary key class has a yellow key as its icon. More than one database attribute can act as the primary key class. The CMFields and CMRelations tabs are enabled, only after the primary key class is selected.

The Data Source and Table Name fields are disabled in the CMFields panel to avoid confusion.

DB Attribute This field displays all the database attributes in the table.

Find-Query Mapping

This panel appears only when the bean selected is a CMP 1.1 bean. Click on the specific bean node and select the Finder Queries tab. This panel allows mapping of the find methods to the available queries that the method can be mapped to. Selecting a query displays the text of the query in the Query Text field.

To create New Queries, click the New button. This brings up the Query Wizard, which helps generate SQL Queries for CMP 1.1 Beans. The generated query is stored in the bean's Bean Properties file. Deploying the JAR containing the bean, generates a file called queries.props, and stores it in the specific JAR.

To import existing queries, click on Import. This brings up the Query Viewer, which helps import existing queries. This facility is used when transferring queries, prepared during development time to a deployment site or while relocating the EAR files.

Container Managed Relations

Click on the CMRelations tab in the Bean node to view up the Container Managed Relationships. This panel appears only for CMP 2.0 Beans. In the panel, view the existing container managed relations of the CMP 2.0 Bean.

The JOIN conditions can be edited in the Deploy tool. To do this, follow the given steps

Concurrency for CMP 2.0 Beans

Edit the concurrency properties for the CMP 2.0 Beans in this panel. Select one of the option as the Isolation level type from the following:

The Exclusion Type can be either selected as

Setting Web Properties

The Web Properties node in the tree allows setting the properties of the war files. Web applications are deployed according to the Servlet 2.2 specification from Sun Microsystems, which describes the use of Web Applications as a standardized way of grouping together the components of a Web-based application. These components include JSP pages, HTTP servlets, and static resources such as HTML pages or image files.

In addition, a Web application can access external resources such as Enterprise JavaBeans and JSP tag libraries. Each server can host any number of web applications.

General Properties

Click on the General tab in the Web Properties node to bring up the General panel. This panel contains the following attributes:

The context roots assigned should be unique in the Server namespace. The context root will then be the "root" under which the content of the archive will be available.To edit this, click on the specific name, and type the required context root name.

EJB Reference

This panel is displayed on clicking the EJB References tab in the Web Properties node. The EJB References panel are used to declare references to enterprise beans. The attributes are:

Selecting the web archive row in this panel, displays the EJB-ref type, the interfaces of the bean (LocalHome, Local, Remote, RemoteHome), and also an optional description in the lower half of the panel. The description field is editable.

Resource Reference

Clicking on the Resource Ref tab in the Web Properties node brings up the Resource Reference panel. This panel allows mapping of resource references to external resources. The defined resources are obtained from the Server. In case a new resource is added using the Resource Tool, it gets added to the running Server.

The attributes in this panel are:

Selecting a Web archive row, displays the resource type, the resource authorisation, and also an optional description in the lower half of the panel. The description field is editable.

The types of the resources directly bound on the server are javax.jms.QueueConnectionFactory, javax.jms.TopicConnectionFactory, javax.sql.DataSource, javax.mail.Session, java.net.URL. A few other types of resources may exist if the resource is bound by a RAR.

Resource Environment References

Click on the Res Env Ref tab in the Web Properties node. This panel contains a declaration of a web application's reference to an administered object associated with a resource in the web application's environment.

The attributes that it contains are the resource environment reference name, and an indication of the resource environment reference type expected by the web application code.

The Deployer is allowed to select the value assigned to the web archive's resource environment reference.

Environment Properties

Click on the Environment tab in the Web Properties node to bring up the panel. This panel is used to assign environment values to web archives. This allows the applications to easily access resources and external information without explicit knowledge of how the external information is named or organized.

Viewing WAR Properties

Clicking on the WAR node on the left window displays the information corresponding to the tree node selected on the right window.

The details shown in the right window are Name, Date, Time, Size, Ratio, Packed, and Path.

Checking the option - Start the application on server restart, available in this panel deploys the application every time the server is started.

Resolving Security Role References

Click on the Security node in the Deploy Tool to bring up the Security panel. This allows assigning of the realm roles to the security references defined in the JARs and WARs. The available realm roles are obtained from security service started by the Server.

The attributes in this panel are:

Realm The realm specifies the realm name to use in HTTP Basic authorization. Select from the available realms in the combo box.

Module This displays the Login modules in the security role. The modules describe the interfaces implemented by the authentication technology providers.

Role Name This field displays all the role names that have been already defined for the application. The User Manager Tool may be used to define the security roles.

Role Link Select from the Role Links available in the combo box, whose value is the name of the security role.

If there is a problem in obtaining the security service from the Server, please check the log and Output Panel in Studio. In case a new realm role is added, the Server should be stopped and restarted.

Setting RAR Properties

RARs can be deployed on Pramati Server in two ways - independently as a .rar file, and after being packaged into an enterprise archive. If the RAR is deployed independently, the application exists at the server level and any application can use it.

If the RAR is deployed as an EAR, the application is specific to that archive. Undeploying the EAR, undeploys the RAR. Deploying a RAR in an EAR, needs at least one connection factory configuration, and is shown as an incomplete task in the Deploy Tool if not created. Connection factories are used to access a connection instance.

To configure the connection factory settings, click on RAR node in the tree and select the Configuration tab.

The attributes to be set are:

The Property section in the panel defines the property sets (one property set per ManagedConnectionFactory instance) for creating connections to various underlying EIS instances.

Saving the Archive

Clicking on Archive > Save from the main menu saves the opened archive in the Deploy tool. The archive is also saved every time the user closes the archive, closes the dialog box, clicks on Exit in the menu item, or deploys the archive.

Deploying the Application

Archive > Deploy

Once the resources have been resolved, the application is deployed. While the application is being deployed, Studio displays the progress bar to show the progress of the deployment. Once the application is deployed, it is ready to be accessed by the client.


Pramati Technologies  © Copyright   TOCPREVNEXTINDEX