Point-and-Run Tomcat Applications From Pramati Server

thumbsshameServers

Nov 17, 2013 (3 years and 6 months ago)

99 views

21
Point-and-Run Tomcat Applications From
Pramati Server
Overview
The Point-and-Run feature enables Server to serve an application running on another
application server or web server environment without migrating the environment. Server is
configured according to the application requirement, automatically. The configuration in
the source environment, including datasources, users, and security roles is replicated in
Server. The changes to sources in the Server directories are reflected when served.
The Pramati Deployment Service (PDS) framework, which is part of Server architecture,
provides all the required handling for Point-and-Run. The feature ensures equivalent
tuning and runtime parameters are setup on Server.
What can you run on Server
The types of applications that can be run on Server are:
• Standard J2EE archive with Pramati deployment XMLs
• Standard J2EE archive with deployment XMLs of another vendor
• Exploded application
• Application running on another application or web server
￿
Note: This is the Point-and-Run scenario, where an application running on another server
environment can easily run on Server, without any intervention.
• Standard J2EE archive without Pramati deployment XMLs.
To Point-and-Run an application, specify:
• Source environment type as Tomcat, ServletExec, Weblogic, or others
• Source server directory for all applications or specific application directory.
The Point-and-Run framework does all the necessary processing to run the application on
Server. The application files are accessed from the source server directory without copying
or modifying them.
Point-and-Run framework
Point-and-Run framework plugs into the PDS, which is the core for all deployment
operations. PDS generates the required structures Pramati application objects that the
containers process to serve the application. PDS allows plugging in handlers for various
application types.
160
Pramati Server 3.5 Deployment Guide
Fig The Point-and-Run Framework
Running a web application deployed on another server involves making the application data
available to the deployed application and registering it with the PDS. An application object is an
abstraction of an application. PDS is used for plugging in vendor specific handlers that create
application objects. These application objects contain information about:
• location of the content to be served
• compiled servlet classes
• helper and library JARs
• deployment descriptor for
web.xml
The handler creates the application object and sets up server configuration, including datasources,
other required resources, and security roles.
How is Point-and-Run processed by Server
The Point-and-Run process is triggered by the deployer and one of the following detail is provided:
• Install directory of the source server: Point-and-Run picks up the server configuration
information, understands the source and configures Server. The list of applications is picked up
and all the applications are run.
• Location of the application: Server configuration is not changed, but the setup required for
application to run on Server is configured.
161
Chapter 21
Point-and-Run Tomcat Applications From Pramati Server
Configuring an application
Application configuration comprises of references such as, resource references and security roles. The
framework understands the configuration of the source server and the environment. It sets up the
same on Pramati Server to provide the application the same environment as that of the source server.
Resolution of resources and environment
All resources or references required by the application must be resolved and bundled in Server
specific deployment descriptors. References are resolved as per the J2EE specifications. The
following type of references are resolved:
• Resource references
• Security role references
• Environment entries
Pramati specific deployment information
To Point-and-Run an application, a working dataset is required within Server. This dataset includes
the Pramati specific deployment descriptors for the application and location for keeping compiled
servlet-classes. When an application is ported to Server, it creates the following dataset:
• pramati-j2ee-server.xml
• WEB-INF\classes
• a marked directory in Server archives to make sure the application is registered after a Server
extract.
Configuring Server
Configuring Server involves setting up an environment similar to the source server. This includes
configuring tuning parameters such as worker threads count and connection timeout parameters.
Point-and-Run from Server Shell
At the default J2EE shell prompt, type:
pointnrun <vendor-name> <source server home DIR> [optional: application path]
For Tomcat server, type:
pointnrun tomcat $TOMCAT_HOME [$APP_DIRECTORY_PATH]
$TOMCAT_HOME - Tomcat installation home directory path.
$APP_DIRECTORY_PATH - application directory path.
Point-and-Run for Tomcat
Running web applications deployed on Tomcat server involves undersanding and setting up the
same environment required for the application to run on Pramati Server.
162
Pramati Server 3.5 Deployment Guide
Tomcat Configuration for web applications
PDS supports Point-and-Run for Tomcat server version 4.0 onwards. Configuration information of
applications deployed in Tomcat is present in
server.xml
located at <TOMCAT_HOME>/conf/
server.xml. Configuration information includes information on virtual host, resource configuration,
and security configuration.
Virtual host information
An application can be served from a virtual host by dropping the application content into the
document root of the virtual host. The document root is configured in the
server.xml
under the
tag
<Host>
.
Resource configuration
Resource configuration used by the application is present in the
server.xml
under the tag
<Resource>
. Tomcat supports resources of type datasource and mail resource. References for the
resources used by the Tomcat applications are specified in the
web.xml
as per the servlet
specification.
Security configuration
Security configuration information is specified in the
tomcat-users.xml
located at
<TOMCAT_HOME>/conf/tomcat-users.xml. This file consists of the user names, passwords, and
the fields a user can participate in.
Configuring application running on Tomcat for Server
To Point-and-Run a Tomcat application on Server, the information present in the configuration
xmls for the application needs to be configured in Server. This process involves:
1
Recreating the resources and security roles used by the Tomcat application from the definitions
obtained from Tomcat configuration xmls.
2
Creating deployment descriptor that contains all reference mappings for the references in the
Tomcat application, resolved into Server environment.
User interface to Point-and-Run Tomcat applications
You can Point-and-Run Tomcat applications on Server using the Server shell.
Using the J2EE default shell
On the Server shell prompt, type:
pointnrun tomcat $TOMCAT_HOME [$APP_DIRECTORY_PATH]
$TOMCAT_HOME - Tomcat installation home directory path.
$APP_DIRECTORY_PATH - application directory path.
Note: If $APP_DIRECTORY_PATH is not specified, all the applications get picked up which indicates
complete Point-and-Run.
163
Chapter 21
Point-and-Run Tomcat Applications From Pramati Server
What can be processed for Tomcat
The Server configuration information can be processed from Tomcat environment.
Server configuration information
Tomcat server configuration is setup in the server.xml file located at <TOMCAT_HOME>\conf.
Information about users is defined in tomcat-users.xml located at <TOMCAT_HOME>\conf.
From
server.xml
, the following information is read and setup on Pramati Server:
• Host
• Name: Virtual host name
• AppBase: Document root directory for virtual host
<Host name="localhost" debug="0" appBase="webapps" unpackWARs="true">
• Context: This includes information on resources that will be needed by the application, such as:
• Configuration mandated by the specification for application:
• Resources (JDBC and Mail resources)
• Security Roles
• Environment Entries
For example,
<Resource name="jdbc/EmployeeAppDb" auth="SERVLET" type="javax.sql.Data
-
Source" />
<ResourceParams name="jdbc/EmployeeAppDb">
<Environment name="maxExemptions" type="java.lang.Integer" value="15" />
Configuring Server to Point-and-Run an application
This process configures Server according to Tomcat-instance configuration, setting up all the
applications and their configuration to run on Pramati Server.
Point-and-Run using the shell
To Point-and-Run an application, at Server shell prompt, type:
pointnrun tomcat $TOMCAT_HOME
Note: To Point-and-Run Tomcat applications, you should not set an empty <Context path>.
Pramati supports pure J2EE specifications, and the following option may be required to run a few
Tomcat applications on Pramati Server:
running_in_tomcat_mode
Attributes and parameters used to Point-and-Run an application
The attributes and parameters used to Point-and-Run applications running on Tomcat can be
summarised as:
• Configuring datasources
164
Pramati Server 3.5 Deployment Guide
• Limitations: Driver classes should be placed in the Server classpath or in the /ext directory.
Resources which are defined in <Context> can not be overridden by <DefaultContext>
• Setting up Security Information
• Users
• Roles
• Resolution
• Complete Point-and-Run
• Limitation: Applications with empty Context Path can not be setup.
Features that cannot be configured
Following are the features that cannot be configured to Point-and-Run Tomcat applications:
1
EJB References - as these are EJBs deployed on a different target server than Pramati.
2
Server defined Environment Entries - as these are not specification based environment entries.
Point-and-Run for Apache/Tomcat server
Tomcat applications can be run by an Apache-Tomcat Engine, where the Apache server serves as the
web-server redirecting the JSP requests to the embedded Tomcat Server.
Apache server can redirect the requests to Tomcat for serving JSPs through plug-ins. Apache
redirects JSP requests to Tomcat Server using the
mod_jk
plug-in. JK is a module for Apache and its
configuration is specified in the
httpd.conf
file under Apache’s configuration directory.
The Apache-Tomcat Point-and-Run allows just specifying Apache directory and the server
configuration. All details and applications are picked up and served in Server.
Tomcat application information can be specified in the mod jk plug-in configuration in two ways.
Include Directive
With include directive, Apache configuration can point to another configuration file. This directive
takes a path where the configuration files reside. This configuration file contains the Tomcat aliases
or contexts that are served from Apache.
IfModule Directive
With IfModule Directive, configuration information can be specified for a particular module. For
mod_jk module, this directive contains the information of Tomcat aliases or contexts that are served
from Apache using the mod jk plug-in.
Configuring Apache/Tomcat
Configuring Apache/Tomcat server involves identifying the mod-jk plug-in configuration in Apache
configuration. It also involves obtaining the aliases or context information of the Tomcat
applications that are served from Apache using this configuration.
165
Chapter 21
Point-and-Run Tomcat Applications From Pramati Server
Server configuration
Apache server configuration is specified in APACHE_HOME\conf\httpd.conf file in Apache
specific format. Apache has directives that represent different types of configuration. The following
directives are setup for Pramati Web Server at different levels of their appearance in the
configuration file.
Table 1: Apache Directives for Point-and-Run
Directives
Options
Description
DocumentRoot
Root directory from which files are served.
Alias
This directive allows documents to be stored in the local file system other than
the documentRoot.
ErrorDocument
In the event of any problem or error, this directive allows to configure HTTP
error codes to a particular action such as displaying an error message, an error
document within the local system, or an error document by redirecting to
another URL.
Directory Index
This directive sets the list of resources to look for, when the client requests an
index of the directory by specifying a '/' at the end of the directory name.
Directory
This directive encloses a group of directives which will apply only to the named
directory and sub-directories of that directory.
Options
This directive controls which server features are available for a particular
directory.
Virtual Host
This directive enclose a group of directives which will apply only to a particular
virtual host.
Socket Property
Directives
KeepAlive
Provide long HTTP sessions which allow multiple client requests to be sent over
the same TCP connection.
KeepAlive
Timeout
The number of seconds web-server will wait for a subsequent request before
closing the connection.
Tomcat Plug-in
configuration
Reference to the Tomcat configuration XML- located through the Tomcat
application alias
166
Pramati Server 3.5 Deployment Guide