Getting Started with vFabric tc Server

vFabric tc Server

vFabric tc Server 2.5


Table of Contents

1. Copyright Notice
2. Quick Start Instructions
3. Overview of tc Server
3.1. Features of tc Server
3.2. Comparing tc Runtime and Apache Tomcat
3.3. tc Server Editions
3.4. How tc Server and Hyperic Work Together
3.5. Links to Additional Documentation
4. Release Notes
4.1. Versioning Process
4.2. What's New and Changed in This Release?
4.3. Supported and Tested Configurations
4.4. Fixed Issues
4.5. Restrictions
5. What Are the Main Steps Required to Get Going?
5.1. Before You Begin
5.2. Installing tc Server and Creating a New tc Runtime Instance
5.3. Starting the Components and Doing Initial Configuration
5.4. Exploring the Features of tc Server
6. Installing tc Server
6.1. Before You Begin: System Requirements
6.2. Installing tc Server: Main Steps
6.3. Overview of tc Server Directories, Variables, and Configuration Files
7. Post-Installation Tasks
7.1. Creating a New tc Runtime Instance
7.2. Starting and Stopping tc Runtime Instances
7.3. Windows: Installing the HQ Server and Agents as Windows Services
7.4. Starting and Stopping the HQ Server and Agents
7.5. Getting Started with the HQ User Interface
7.6. Deploying Applications to tc Runtime Instances
7.7. Uninstalling tc Server: Typical Steps
8. Upgrade and Migration Guide
8.1. Upgrading a 2.0.X or 2.1.X tc Server Installation to 2.5
8.2. Upgrading a 2.5.X tc Runtime to the Latest Version
9. Tutorial: Using HQ to Configure and Manage tc Runtime Instances
9.1. Before You Begin
9.2. Restart a tc Runtime Instance
9.3. Reconfigure a tc Runtime Instance
9.4. Deploy a Web Application to a tc Server Runtime Instance
9.5. Add tc Runtime Instances to the Favorite Resources Portlet
9.6. Create an HQ Group of Multiple tc Runtime Instances
9.7. Monitoring tc Runtime Instances
9.8. Manage the Preconfigured Deadlock Detected Alert
10. Tutorial: Very Simple HelloWorld Web Application
10.1. Before You Begin
10.2. Creating and Deploying the HelloWorld Web Application
10.3. Java Source of the Hello.java Servlet
10.4. JSP Source for the hello.jsp JSP
10.5. Sample web.xml File
10.6. Sample Default index.html File
10.7. Ant Build File to Compile and Package the Example
11. Troubleshooting
11.1. HQ: Resources Not Showing up in the HQ User Interface
11.2. HQ: Errors When Trying to Add an Auto-Discovered Resource
11.3. HQ Agent: Errors When Starting on Solaris
11.4. tc Runtime: Hot Redeploy/Stop/Undeploy on Windows Fails
11.5. tc Runtime: Error When Running a Web Application on tc Runtime and Using SpringSource Tool Suite
11.6. tc Runtime: JVM Performing a Full GC

1. Copyright Notice

Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents.

VMware is a registered trademark or trademark of VMware, Inc. in the United States and/or other jurisdictions. All other marks and names mentioned herein may be trademarks of their respective companies.

2. Quick Start Instructions

This section provides quick start instructions for installing VMware vFabrictc Server™ Standard Edition and the VMware vFabric Hyperic® management components (HQ Server and Agent) on the same computer, creating a tc Runtime instance, and starting all components. The instructions install the tc Runtime component in a separate directory from the HQ management components.

Note: tc Runtime is the runtime component of tc Server.

It is assumed that you are installing version 4.5 of vFabric Hyperic; this version includes the tc Server HQ plug-in in all standard distributions.

If you want to install the Developer or Spring Editions of tc Server; install different components on different computers; or simply want more detailed installation instructions, see Installing tc Server. It is assumed that you are installing tc Server from scratch; if you are upgrading an existing tc Server installation, see the upgrade documentation.

To install all tc Server components:

  1. Download and install a JDK or JRE on your local computer. See Required Software: JDK or JRE.

  2. Open a terminal (Unix) or Command Prompt (Windows) and create two new directories: one that will contain the tc Runtime component (such as /home/tcserver) and one that will contain the HQ Agent and the HQ Server (such as /home/hyperic.) For example, on Unix:

    prompt$ mkdir /home/tcserver
    prompt$ mkdir /home/hyperic
  3. From the VMware Download Center, download the most recent vfabric-tc-server-standard-2.5.X-X.zip file and unzip the contents into the tc Runtime directory you created in the preceding step. The X-X in the zip file name is the release number and type, for example 0-RELEASE.

    This action is all that is required to install tc Runtime; there is no installer program.

    For example, if you created a directory called /home/tcserver in the preceding step, and downloaded the Standard Edition file in the /home/Downloads directory:

    prompt$ cd /home/tcserver
    prompt$ unzip /home/Downloads/vfabric-tc-server-standard-2.5.0-RELEASE.zip

    After you unzip the ZIP file you will have a directory called /home/tcserver/vfabric-tc-server-standard-2.5.X-X. This directory contains all the tc Runtime files and directories.

  4. From the VMware Download Center, download the VMware vFabric Hyperic Server and Agent distribution and unpack it into a temporary directory.

    Be sure you download version 4.5.1.x of HQ which includes the tc Server HQ plug-in. Download both the HQ Server and Agent components. You can download a distribution for your particular platform, such as Windows or Linux, or you can download a platform-neutral distribution that does not contain a JDK or database (labelled noJRE.) If you download the latter distribution, you must also install a database server, such as Oracle or Postgres, because the platform-neutral version of HQ does not include one. The platform-specific versions include an evaluation database server to get you started.

    See the vFabric Hyperic Documentation for details.

  5. From your terminal window or Command Prompt, change to the temporary directory in which you unpacked the HQ distribution and execute the setup.sh (Unix) or setup.bat (Windows) script.

    For example, if you downloaded and unpacked the HQ distribution into the /home/Downloads directory, you will have a sub-directory called hyperic-hq-installer:

    prompt$ cd /home/Downloads/hyperic-hq-installer
    prompt$ ./setup.sh

    After accepting the terms of agreement, enter 1,2 to install both the HQ Server and HQ Agent. The script asks a few more questions, such as an encryption key for encrypting the database-user password and the directory in which you will install HQ Server and Agent (/home/hyperic in our example.) If you are installing a platform-specific version of HQ, the setup.sh script might ask you to run another script as the root user. If you are installing the platform-neutral version of HQ, the script asks for information about your database, including the database URL, name and password of the user that connects to the database. For more information, see the vFabric Hyperic Documentation.

    When the setup.sh script completes, HQ Server is installed in /home/hyperic/server-4.5.X.X-EE and the HQ Agent is installed in the directory /home/hyperic/agent-4.5.X.X-EE.

To create a tc Runtime instance and start all components:

  1. From your terminal window or Command Prompt, change to the tc Runtime directory and execute the tcruntime-instance command to create a basic tc Runtime instance (called myserver in the example):

    prompt$ cd /home/tcserver/vfabric-tc-server-standard-2.5.X.X
    prompt$ ./tcruntime-instance.sh create myserver
  2. (Windows only) Use the tcruntime-ctl command to make the new runtime instance a Windows service:

    prompt$ tcruntime-ctl.bat myserver install
  3. Execute the tcruntime-ctl command to start the new tc Runtime instance:

    prompt$ ./tcruntime-ctl.sh myserver start

    To ensure that the tc Runtime instance actually started, invoke its welcome page in a browser. Use the URL http://host:8080, where host is the computer on which the tc Runtime instance is running (localhost if local):

    http://localhost:8080
  4. Start the HQ Server:

    (Windows) First install HQ Server as a Windows service, and then start the server:

    prompt> cd \home\hyperic\server-4.5.X.X-EE
    prompt> bin\hq-server.bat install
    prompt> bin\hq-server.bat start

    (Unix) Change to the HQ Server directory and start the server with the hq-server.sh command:

    prompt$ cd /home/hyperic/server-4.5.X.X-EE
    prompt$ bin/hq-server.sh start 
  5. Start the HQ Agent:

    (Windows) Install the HQ Agent as a Windows service and then start it:

    prompt> cd \home\hyperic\agent-4.5.X.X-EE
    bin\hq-agent.bat install
    bin\hq-agent.bat start

    (Unix) Change to the HQ Agent directory and start the agent with the hq-agent.sh command:

    prompt$ cd /home/hyperic/agent-4.5.X.X-EE
    prompt$ bin/hq-agent.sh start

    The first time you start the HQ Agent, it prompts for information about the HQ Server to which it will connect. Assuming this is a non-production installation, you can usually take the default values. When the script prompts you for the HQ server IP address, enter 127.0.0.1 or localhost; this is because this Quick Start section installs both the HQ Server and Agent on the same computer (host). The default HQ login/password is hqadmin/hqadmin.

  6. Invoke the HQ server console using the URL http://host:7080 in your browser, where host is the computer on which the HQ server is running (localhost if local):

    http://localhost:7080

    Username and password, by default, are both hqadmin.

    The tc Runtime instance should show up automatically in the auto-discovery portlet; it is called tc Runtime servername. Other resources might also show up, such as the HQ Agent itself and a database server. Click the Add to Inventory button so you can begin to manage and monitor the tc Runtime instance.

    Click the Help link on the HQ server console for online help.

3. Overview of tc Server

3.1 Features of tc Server

vFabric tc Server is a Web application server based on open-source Apache Tomcat. It preserves the best of Tomcat and adds many mission-critical operational capabilities that are unavailable in the open-source product:

For a detailed comparison between tc Server and Apache Tomcat, see Comparing tc Runtime and Apache Tomcat.

tc Server Enhancements to Apache Tomcat

The tc Server runtime component, known as tc Runtime, offers substantial usability enhancements over the open-source Apache Tomcat server:

  • Improved out-of-the-box configuration. In most cases, you can use tc Server immediately after you install it, with no additional configuration.

  • Easy creation of a tc Runtime instance with the tcruntime-instance command script. You can leverage additional (optional) configuration features by specifying prepackaged templates when you create a tc Runtime instance, such as automatically configuring clustering or SSL.

  • Easy and intuitive to start a tc Runtime instance on both Unix and Windows platforms.

  • Default configuration of high-concurrency JDBC connection pool in new tc Runtime instances.

Easy Configuration and Monitoring with Hyperic

Hyperic is a comprehensive enterprise application management tool for managing and monitoring tc Runtime instances, Spring-powered applications, and a variety of non-SpringSource platforms and application servers such as Apache Tomcat. The server instances and applications can be running on multiple computers. Hyperic provides a single console with powerful dashboards through which you can easily check the health of your applications. With Hyperic, you can:

  • Manage the lifecycle of tc Runtime instances by starting, stopping, and restarting a local or remote instance.

  • Manage the lifecycle of a group of tc Runtime instances that are distributed over a network of computers.

  • Configure a single instance of tc Runtime. Configuration options include the various port numbers to which the tc Runtime instance listens, JVM options such as heap size and enabling debugging, default server values for JSPs and static content, JDBC datasources, various tc Runtime connectors, and so on.

  • Using the tcsadmin command-line tool, configure a group of tc Runtime instances.

  • Deploy a Web application from an accessible file system, either local or remote. You can deploy to a single tc Runtime instance or to a predefined group of servers.

  • Manage the lifecycle of applications deployed to a single tc Runtime instance or group of servers. Application lifecycle operations include start, stop, redeploy, undeploy, and reload.

In addition to the preceding tc Runtime-specific Hyperic tasks, you perform the standard tasks:

  • Inventory the resources on your network.

  • Monitor resources.

  • Receive alerts on problems with resources. The tc Server HQ plug-in includes a variety of preconfigured alerts.

  • Control resources.

Enhanced Diagnostics

tc Server includes a full set of diagnostic features that makes it easy for you to troubleshoot problems with a tc Runtime instance or the applications that you deploy to tc Runtime instances. These diagnostic features include:

  • Thread diagnostics. When you deploy and start a Web application on a tc Runtime instance, and then clients begin connecting and using the application, you might find that the clients occasionally run into problems such as slow or failed requests. By default, tc Runtime logs errors in the log files; however, it is often difficult to pinpoint the exact source of the error and how to fix it. With thread diagnostics enabled, tc Runtime provides additional troubleshooting information.

  • Deadlock detection. The tc Server HQ plug-in automatically detects whether a thread deadlock occurs in a tc Runtime instance or an application deployed to the instance.

  • Time in Garbage Collection.The tc Server HQ plug-in has a new metric that represents the percentage of process up time (0 -100) that a tc Runtime instance has spent in garbage collection.

  • Tomcat JDBC DataSource monitoring. A new tc Server HQ plug-in service represents the high-concurrency Tomcat JDBC datasources you have configured for your tc Runtime instance. This service monitors the health of the datasource, such as whether its connection to the database has failed or was abandoned, and whether the JDBC queries that clients execute are taking too long.

For some diagnostics features, the tc Server HQ plug-in includes one or more preconfigured alerts that make it easy for you to monitor the tc Runtime instance, as well as manage the various thresholds at which an alert is triggered. For additional information about these diagnostic features, and information about managing the associated Hyperic alerts, see tc Server Administration Guide, under Managing tc Runtime-Related Hyperic Alerts.

tc Server Command-Line Interface and Command Scripts

You can use the command-line interface (CLI) tcsadmin to:

  • List servers, groups, and deployed applications.

  • Deploy applications

  • Configure tc Runtime instances and groups

  • Control tc Runtime instances and groups

3.2 Comparing tc Runtime and Apache Tomcat

The runtime component of tc Server (tc Runtime) is an enterprise version of Apache Tomcat. tc Runtime is a drop-in replacement for Apache Tomcat, ensuring a seamless upgrade path for existing custom-built and commercial software applications already certified for Tomcat. Maintaining this level of compatibility enables customers to add the functionality they need to run and manage their applications more effectively with the least amount of effort.

tc Runtime also adds many business-critical features to standard Apache Tomcat. The following sections compare the two:

Standard Application Server Features

tc Runtime and Apache Tomcat share key standard features of application servers.

Table 3.1. Standard Application Server Feature Comparison

Application Server FeaturesvFabric tc RuntimeApache Tomcat
Servlet 2.5 and 3.0 supportYesYes
Java Server Pages (JSP) 2.1 and 2.2 supportYesYes
HTTP session clusteringYesYes
Advanced I/O featuresYesYes
Pre-built advanced non-blocking I/O componentsYesYes
Basic Windows service wrapperYesYes

Enterprise Application Server Features

Because tc Runtime is based on Apache Tomcat, it provides a powerful yet lightweight platform that is compatible with existing Tomcat-based applications and with Web applications that run on other Java EE application servers such as IBM WebSphere Application Server or Oracle WebLogic Server. Applications can be seamlessly moved from Apache Tomcat to tc Runtime to gain the benefits that tc Runtime provides beyond the base Apache Tomcat.

Table 3.2. Enterprise Application Server Feature Comparison

Enterprise Application Server FeaturesvFabric tc RuntimeApache Tomcat
Multiple runtime instances from a single binary installationYesNo
New high-concurrency JDBC connection pool`YesNo
Preconfigured for JMX managementYesNo
Includes latest security vulnerability and bug fixesYesRebuild Tomcat yourself to apply incremental fixes.
Includes a control script compatible with Unix etc/init.dYesNo
Enhanced Windows service wrapperYesNo

tc Server offers scripts and templates to simplify performing a number of advanced configurations.

Table 3.3. Advanced Configuration Tools Comparison

Advanced Configuration FeaturesvFabric tc ServerApache Tomcat
Templated production-ready configuration out-of-the-boxYesNo
Create Tomcat single server configurationYesNo
Modify general server configuration including JVM startup parametersYesNo
Modify context container configurationYesNo
Modify server defaults for JSPs and static contentYesNo
Add, modify, and delete JDBC datasourcesYesNo
Modify HTTP and AJP connector settingsYesNo
Create and view general servicesYesNo
Modify general engine configurationYesNo
Pre-tuned JVM optionsYesNo

Business-Critical Operational Features

tc Runtime includes advanced, distributed management and monitoring capabilities through a centralized management console called Hyperic user interface.

The tables in this section list the capabilities that tc Runtime provides over and above the base Apache Tomcat and also notes the features that Hyperic provides for existing Apache Tomcat environments.

tc Runtime provides a wide range of capabilities that enable developers, administrators, and operators to centrally diagnose, measure, and monitor the distributed application infrastructure.

Table 3.4. Diagnostics, Metrics, and Monitoring Feature Comparison

Diagnostics, Metrics, and Monitoring FeaturesvFabric tc RuntimeApache Tomcat
Application deadlock detectionYesNo
Uncaught exception detectionYesNo
Garbage collection metrics, including throughput and countYesNo
SQL query time monitoring metricsYesNo
Enhance response time monitoring metricsYesNo
Enhanced connection pool health metricsYesNo
Enhanced thread pool health metricsYesNo
Role-based customizable dashboardYesYes (via Hyperic)
Automated inventory of application servers and software resourcesYesYes (via Hyperic)
Real-time metric collection and monitoring of tc Runtime, Tomcat, Apache Web server, Apache ActiveMQ, underlying JVM, operating system, and other resourcesYesYes (via Hyperic)
Charting and graphing performanceYesYes (via Hyperic)
Advanced alerting: multi-conditional, availability, event, and recovery alerts, group-based alerting, and escalation schemesYesYes (via Hyperic)
Log file tracing, alerts on event levelsYesYes (via Hyperic)
Alerts based on configuration file updatesYesYes (via Hyperic)
Performance baselining for alert thresholdsYesYes (via Hyperic)

tc Runtime provides a centralized, secure dashboard that enables administrators and operators to organize, operate, and control their distributed applications and infrastructure.

Table 3.5. Centralized Operations and Management Feature Comparison

Centralized Operations and Management FeaturesvFabric tc RuntimeApache Tomcat
Secure, distributed, JMX-based server managementYesNo
Create application server groupsYesYes (via Hyperic)
Application server start/stop/restart from central consoleYesYes (via Hyperic)
List deployed applications and current statusYesNo
Application deploy/undeploy/reload/start/stopYesNo
Security and access/authorization controlYesYes (via Hyperic)
Scheduled control: maintenance activities, on-demand actions, scheduled remediation actions, or scheduled responses to alert conditionsYesYes (via Hyperic)

tc Server provides scripting support for administrators and operators who prefer to create and run scripts to handle distributed configuration and deployment steps.

Table 3.6. Scripting Feature Comparison

Scripting FeaturesvFabric tc RuntimeApache Tomcat
List deployed serversYesNo
Create server groupsYesNo
Add and delete servers to and from groupsYesNo
List deployed applications, including current statusYesNo
Deploy application WAR fileYesNo
Undeploy applicationYesNo
Start, stop, and reload deployed applicationsYesNo
Get (download) configuration files and JVM parameters from a serverYesNo
Modify configuration files on an individual serverYesNo
Set (push) configuration files and JVM parameters to a server groupYesNo
Start, stop, and restart a server or group of serversYesNo

3.3 tc Server Editions

tc Server is available in the following editions:

Developer Edition

The Developer Edition of tc Server is geared towards the application developer. It contains the tc Runtime, along with utilities that make it easy to create and start tc Runtime instances and a set of templates that make it easy to quickly create specific preconfigured tc Runtime instances, such as cluster-node ready and SSL-enabled.

This edition also includes Spring Insight Developer, an application that provides real-time visibility into the behavior and performance of user applications. The tc Server Developer Edition contains a template called insight that includes the Spring Insight application. You use this template to create new tc Runtime instances enabled with Spring Insight. See Using Spring Insight Developer for help setting up and using Spring Insight. (tc Server Developer Edition does not include access to Hyperic Server and Agent.)

The Developer Edition is distributed as either a ZIP or compressed TAR file with the following names:

  • vfabric-tc-server-developer-2.5.X.RELEASE.zip

  • vfabric-tc-server-developer-2.5.X.RELEASE.tar.gz

Standard Edition

The Standard Edition of tc Server is geared towards the administrator. Similar to the Developer Edition, the Standard Edition contains the tc Runtime, scripts to easily create and start tc Runtime instances, and templates to quickly create specific types of tc Runtime instances (such as cluster-node ready or SSL-enabled.) This edition does not include Spring Insight Developer.

With the Standard Edition, you have access to the vFabric Hyperic management system, which (as of version 4.5) includes the tc Server HQ plugin in the general distribution. Install vFabric Hyperic if you want to use Hyperic to configure and manage the tc Runtime. If you do not want to use Hyperic to manage tc Runtime instances and want to use the tc Runtime on its own, install only the tc Runtime.

The Standard Edition is distributed as either a ZIP or compressed TAR file with the following names:

  • vfabric-tc-server-standard-2.5.X.RELEASE.zip

  • vfabric-tc-server-standard-2.5.X.RELEASE.tar.gz

To download an evaluation of Hyperic, go to the VMware Downloads Center.

Spring Edition

The Spring Edition of tc Server includes the Standard Edition and Hyperic management components, plus production optimizations for Spring-based applications in the form of instrumented JARs for the following Spring technologies: Spring Framework, Spring Security, Spring Web Flow, and Spring Web Services.

3.4 How tc Server and Hyperic Work Together

tc Server is available in a variety of editions, based on whether you are a developer or an administrator. The Standard and Spring editions of tc Server, because they are targeted at administrators, include the Hyperic management capabilities. This section shows how the runtime component of tc Server (called tc Runtime) and the Hyperic components (Hyperic Server and Hyperic Agents) work together, and possible configurations that you can install on one or more computers.

The simplest scenario is where you install all components (tc Runtime, Hyperic Agent, and Hyperic Server) on the same computer. In this case, the computer acts as a host for the tc Runtime instances and their deployed applications as well as a host to the Hyperic Server and Hyperic Agent, which are used to manage the tc Runtime instances.

Figure 3.1. Installing on One Computer

Installing on One Computer

In the preceding figure, the Hyperic Server is managing just one tc Runtime instance. The Hyperic server can, of course, manage multiple instances, as well as manage other kinds of servers. Because the tc Runtime instances are all on one computer, you only need to install one Hyperic Agent.

Figure 3.2. Multiple tc Runtime Instances on One Computer

Multiple tc Runtime Instances on One Computer

A slightly more complicated scenario is where you create multiple tc Runtime instances on one computer, say computerA, and the Hyperic Server on computerB. In this case, you must install the Hyperic Agent on computerA so that the Hyperic Server is able to manage the tc Runtime instances on computerA from computerB. computerA is referred to as a managed node.

Figure 3.3. Installing on Two Computers

Installing on Two Computers

In another scenario, you host the Hyperic Server on computerB, but want to install tc Runtime on many computers, possibly of different platforms such as Unix and Windows. In this case you must also install the Hyperic Agent on each computer (managed node) that hosts the tc Runtime instances.

In the following figure, for example, computerC might be a Windows platform while all the rest of the computers are Unix. Also note that each computer has a different set of tc Runtimes installed, but only one Hyperic Agent. In the figure, all computers except computerB are managed nodes.

Figure 3.4. Installing on Multiple Computers

Installing on Multiple Computers

3.5 Links to Additional Documentation

Because tc Runtime is based on Apache Tomcat, much of the documentation about using tc Runtime itself is provided by Apache.

The Hyperic management component of tc Server provides monitoring and management for your Web infrastructure. You can use it to streamline operations, manage infrastructure complexity, and drive service level improvements. The Hyperic user interface includes online help for both generic Hyperic functionality, as well as tc Server related functionality. For detailed documentation about Hyperic:

The following links provide additional documentation for programmers who develop Web applications using the Spring Framework and standard Java EE technologies such as servlets and JSPs:

4. Release Notes

The following sections contain release-specific information about vFabric tc Server.

4.1 Versioning Process

The tc Server bundle has a version number separate from the underlying components. Minor revisions, maintenance updates, and service releases of any set of underlying components increment the fully qualified bundle version. As of the 2.5 release, the bundle contains the following separately versioned components. The initial major version of each component is noted. Specific downloads have fully qualified version information on each component.

  • tc Runtime: Apache Tomcat-based runtime container, major versions 6.0 and 7.0. The fully qualified version of the tc Runtime is a combination of the underlying Apache Tomcat version and an alphabetic modifier to track maintenance updates on the same underlying Tomcat version, for example, tomcat-6.0.32.A-RELEASE.

  • tc Server Hyperic Plug-In: vFabric Hyperic plug-in that enables advanced management and monitoring, major version 2.5.

  • Hyperic Agent: Agent portion of bundle, major version 4.5.

  • Hyperic Server: Hyperic Server, preconfigured with the tc Server Hyperic plug-in, major version 4.5.

4.2 What's New and Changed in This Release?

2.5.2 Maintenance Release

The tc Server 2.5.2 maintenance upgrades tc Runtime 6.0 and tc Runtime 7.0 and provides minor bug fixes.

The Hyperic tc Server plug-in version 2.5.2 is included in the Hyperic 4.5.2.1 maintenance release. The tc Server plug-in is now Java 1.5 compatible, as required by Hyperic.

tc Runtime Version Upgrades

tc Server 2.5.2 includes the following upgraded tc Runtime versions:

  • tc Runtime 6.0 is based on Apache Tomcat 6.0.33

  • tc Runtime 7.0 is based on Apache Tomcat 7.0.20

2.5.1 Maintenance Release

tc Runtime 7.0 Version Update

The tc Runtime 7.0 version is based on tomcat-7.0.16.A-RELEASE as its core.

New Option for Hyperic tc Server Command-Line create-group Command

The Hyperic tc Server command-line interface create-group command has a new --version option to specify the tc Runtime version. The option accepts values of 6.0 and 7.0. Only servers of the specified tc Runtime version can be added to a group.

2.5.0 Release

The 2.5.0 release of tc Server includes support for tc Runtimes based on Tomcat 6.0 and Tomcat 7.0. You can choose the version of tc Runtime when you create an instance. tc Runtime 7.0 offers several new features, including support for the Servlet 3.0, JSP 2.2, and JSP-EL2.2 specifications, as well as security improvements.

Following are additional features and changes that are new to this tc Server release:

  • When using tc Runtime 7.0, you can deploy multiple versions of a web application with the same context path simultaneously by appending a version number to the context name. This makes it possible to deploy an updated application without interrupting existing sessions. New requests for the application are routed to the newest version of the application. Requests that have existing session information continue to use the version of the application that is managing the session. See Deploying Multiple Versions of an Application in this guide. See The Context Container at the Apache website for more details about this feature.

  • The tcruntime-instance command has a new upgrade verb that you can use to upgrade a tc Server instance created with tc Server 2.0 or tc Server 2.1 to tc Server 2.5. You can specify the new tc Runtime version to use or allow the upgraded instance to continue using the same tc Runtime version, if that version is available in the new tc Server release.

4.3 Supported and Tested Configurations

The sections that follow list the configurations supported by version 2.5.X of the tc Runtime component.

For supported configuration information about the Hyperic Server and Agent, see Installation Requirements.

Supported Java EE Specifications

SpringSource tc Runtime supports:

Supported JRE Versions

SpringSource tc Runtime runs on version 1.6 of the Java Runtime Environment (JRE).

Supported Configurations: tc Runtime

The following table lists the supported configurations for running the tc Runtime. Other configurations may be supported on request; contact your sales representative for details.

Because you typically install and run the Hyperic Agent on the same computer as the tc Runtime, you should also consult HQ Agent Requirements.

SpringSource recommends that you follow the guidance of your operating system or JVM vendor when deciding which patch levels should be applied to your computer. In general, the latest patch update levels are recommended.

Table 4.1. Supported Configurations

Operating SystemMajor VersionChip ArchitectureJVMtc Runtime Version
RedHat Enterprise Linux (RHEL)V5x86 32/64 bitSun HotSpot 1.62.5.X
Ubuntu10.04 LTSx86 64 bitSun HotSpot 1.62.5.X
Windows2008 Server (SP2)x86 32/64 bitSun HotSpot 1.62.5.X
Windows2003 Server (SP2 and newer)x86 32 bitSun HotSpot 1.62.5.X

Tested Configurations: tc Runtime

The following tables list specifically tested patch update levels for the latest 2.5.X version of tc Runtime. This table is updated as new configurations are tested.

Table 4.2. Tested Configurations

Operating SystemMajor VersionChip Architecture (Tested)Fully Qualified JVM Version (Tested)Version of tc Runtime (Tested)
RedHat Enterprise Linux (RHEL)V5 (Kernel 2.6.18-164.28.1.el5PAE)x86 32 bitSun HotSpot 1.6.0_202.5.0
RedHat Enterprise Linux (RHEL)V5 (Kernel 2.6.18-164.28.1.el5)x86 64 bitSun HotSpot 1.6.0_202.5.0
Ubuntu10.04 LTSx86 64 bitSun HotSpot 1.6.0_222.5.0
Windows2008 Server (SP2)x86 32 bitSun HotSpot 1.6.0_182.5.0
Windows2008 Server (SP2)x86 64 bitSun HotSpot 1.6.0_182.5.0
Windows2003 Server (SP2)x86 32 bitSun HotSpot 1.6.0_182.5.0

4.4 Fixed Issues

Issues Fixed in tc Server 2.5.2

The following table lists the product issues that were fixed in the 2.5.2 maintenance release.

Table 4.3. Fixed Issues in 2.5.2

Issue IDDescription
TCS-2350The tc Server plug-in for Hyperic uses a Java 1.6 call that prevented tc Server instances from being discovered on Linux platforms. Hyperic requires plug-ins to be compatible with Java 1.5.
TCS-2351After changing JVM heap settings via Hyperic, The <Connector> element in server.xml is altered to add keyAlias, keystoreFile, keystorePass, algorithm, scheme, and secure attributes with their default values.
TCS-2352When using Hyperic to add an AJP connector to a tc Runtime instance, the server fails to restart.
TCS-2354The tcsadmin command with the --secure option does not work if the server uses self-signed certificates, unless the signer's certificate is imported into the JRE's cacerts file.
TCS-2356Deploying a large WAR file using Hyperic fails and a blank screen appears in the Hyperic UI. The source of the blank page contains an InstanceOperationFailedException message.
TCS-2363In a Spring MVC application created with Spring Tool Suite, the WebApplicationInitializer class is not found when deploying to the STS built-in tc Server.

Issues Fixed in tc Server 2.5.1

The following table lists the product issues that were fixed in the 2.5.1 maintenance release.

Table 4.4. Fixed Issues in 2.5.1

Issue IDDescription
TCS-2086Graceful shutdown using the tcruntime-ctl stop command does not work for tc Runtime 7 instances started with the tcruntime-ctl run command.
TCS-2102Clarify documentation about upgrading an unpinned tc Server 2.0.x or 2.1.x instance to tc Server 2.5.0 with the tcruntime-instance.sh upgrade command.
TCS-2258The template file templates/base-tomcat-7/conf/catalina-fragment.properties is missing a line continuation character (,\) before the end of a line in the definition of the tomcat.util.scan.DefaultJarScanner.jarsToSkip property.
TCS-2276Clarify documentation about the differences between the tcruntime-instance modify-version and tcruntime-instance upgrade commands.
TCS-2277The Hyperic tc Server command-line interface always assumes tc Runtime groups are based on Tomcat 6. This is fixed in the 2.5.1 release with the addition of the --version option for the create-group command.
TCS-2279Update documentation to show the addition of the application version to the output of the Hyperic tc Server CLI list-applications command.

4.5 Restrictions

You can use the HQ application management features that are specific to tc Server only with the runtime component of tc Server (also called tc Runtime); these features do not work with standard Apache Tomcat. The HQ application management features include deploy, undeploy, start, stop, and reload of Web applications.

5. What Are the Main Steps Required to Get Going?

This chapter provides a roadmap to the high-level steps you perform to get vFabric tc Server up and running. Each step points to a more targeted procedure in this guide, such as installing tc Server, starting up the components, and using the vFabric Hyperic user interface to configure and manage a tc Runtime instance or group.

5.1 Before You Begin

You install tc Server by installing its components: the tc Runtime and the management components (Hyperic Server and Agent.) If you are installing only the Developer Edition of tc Server, you install only the tc Runtime. If you are installing the Standard Edition, which includes access to Hyperic HQ to manage and monitor tc Server, you install the tc Runtime, the HQ Server, and the HQ Agent. See tc Server Editions for details about the available editions. Each edition comes in ZIP and compressed TAR formats.

When installing both the runtime and management components, you can install all components on the same computer or on multiple computers. Typically, you install a single HQ Server, and then install the tc Runtime and HQ Agent on one or more computers. You then create one or more tc Runtime instances.

[Note]Note

This section assumes that you are installing tc Server for the first time. If you have already installed a previous version of tc Server, created one or more tc Runtime instances, and now want to upgrade all the components to the latest version, see Upgrade and Migration Guide.

It is also assumed in most of this documentation that you will use the separate layout for tc Runtime instances, rather than the combined layout (which is similar to the standard Apache Tomcat layout.) In the separate layout, CATALINA_HOME and CATALINA_BASE point to separate directories; in the combined layout they point to the same directory. The default when you create an instance is to use the separate layout because it offers many benefits over the combined layout, although you can of course use the latter if you wish by specifying the --layout option of the tcruntime-instance script. See Differences Between the Separate and Combined Layouts for more information. Unless otherwise specified, the rest of the documentation assumes the separate layout.

5.2 Installing tc Server and Creating a New tc Runtime Instance

This high-level installation step includes the following sub-steps:

  1. Install the tc Runtime on one or more computers. You perform this step for all editions of tc Server: Developer, Standard, and Spring.

    See Installing tc Server: Main Steps.

  2. If you want to install the HQ management components, you install the HQ Server once.

    See Installing Standard Edition (Including HQ Management Components) .

  3. If you want to install the HQ management components, install the HQ Agent on all computers on which you installed the tc Runtime.

    See Installing Standard Edition (Including HQ Management Components) .

  4. Create a new tc Runtime instance on the computers on which you installed the tc Runtime.

    See Creating a New tc Runtime Instance.

5.3 Starting the Components and Doing Initial Configuration

After you install tc Server, you start the components. Depending on how you have configured tc Server, you perform the following sub-steps on the computers on which you have installed the particular components.

  1. Start the tc Runtime instance(s) on each computer on which you installed the tc Runtime.

    See Starting and Stopping tc Runtime Instances.

  2. Start the HQ Server on the computer on which you installed it.

    See Starting and Stopping the HQ Server and Agents.

  3. Start the HQ Agent on all computers on which you installed it. Typically these are the same as the computers on which you installed the tc Runtime.

    See Starting and Stopping the HQ Server and Agents.

  4. Invoke the HQ user interface in your browser, log in, and be sure it is configured for you to start managing tc Runtime instances.

    See Getting Started with the HQ User Interface.

5.4 Exploring the Features of tc Server

After you start all components of tc Server, log into the HQ user interface, and add the tc Runtime instances to the inventory, you are now ready to explore the features of tc Server.

  1. Run through the HQ tutorial which describes typical tasks you perform on tc Runtime instances, such as deploying applications, configuring servers, and creating and using HQ groups.

    See Tutorial: Using HQ to Configure and Manage tc Runtime Instances.

  2. If you are completely new to programming Web applications, and want to learn how to create a very simple one, run through the Simple Web Application tutorial.

    See Tutorial: Very Simple Web Application Development.

  3. If you installed the Developer Edition of tc Server, try out Spring Insight, which gives you real-time visibility into the behavior and performance of your existing user applications. See Using Spring Insight.

    Using the Spring Insight Development Kit, you can create your own Spring Insight plug-ins that are tailored to the specific needs of your applications. See Using Spring Insight.

  4. If you want to deploy existing Web applications without using the HQ user interface, you can use static deployment.

    See Deploying Applications to a tc Runtime Instance for details.

  5. Learn about more advanced administration tasks, such as creating and using tc Runtime clusters and using the tc Server command-line interface by reading the tc Server Administration Guide.

6. Installing tc Server

This chapter describes how to install the various editions of vFabric tc Server.

6.1 Before You Begin: System Requirements

This section includes topics that discuss tc Server software requirements, such as the required Java Development Kit (JDK) or Java Runtime Environment (JRE) and database server. Read this section before you begin the tc Server installation.

For HQ Server and Agent requirements, see Installation Requirements on the Hyperic documentation Web site.

Required Software: JDK or JRE

No editions of tc Server bundle a JDK or JRE. Before you install tc Server, download and install a JDK or JRE on each computer on which you will install the tc Runtime component of tc Server. If you are installing the HQ components, the JDK or JRE requirement depends on whether you install the platform-specific or platform-neutral version; only the latter requires a JDK or JRE because the former bundles one. See Supported Configurations for platform-specific details of the JDK or JRE versions that are supported and have been tested.

For most platforms you can download and install the Sun JDK or JRE, although for IBM computers you might want to install the IBM-specific JDK or JRE. The following links point to download Web sites:

After you install the JDK or JRE, set your JAVA_HOME environment variable to point to your installation and update your PATH environment variable to point to the JAVA_HOME/bin directory.

Windows only. If you are installing the management components of tc Server (HQ Server and Agent), then you must also set the HQ_JAVA_HOME system environment variable to point to the location of your JDK or JRE. Set HQ_JAVA_HOME as a system environment variable; if you set it as a user environment variable, the HQ Agent aborts on startup.

Possibly Required Software: Database Server

This section applies only if you are using the Standard or Spring editions of tc Server and you want to also install the HQ Server and Agents management components using the platform-neutral version of the HQ distribution.

The HQ Server uses a database to store its metadata. The platform-neutral version of HQ Server does not, however, bundle a database. This means that if you do not have a database server already installed on either the computer on which you are going to install HQ Server or on an accessible remote computer, then you must download and install one. The platform-specific versions of the HQ distribution bundle a non-production database for you to get started, although it is not recommended that you use this database for production purposes.

Use Oracle 10g/11g, PostgreSQL, or MySQL 5.x with HQ Server. During the installation of HQ Server, you will provide the database URL for JDBC connection and the database username and password.

To set up one of these databases for use with HQ Server, see Set Up Hyperic Database.

Installing on Unix Platforms: Important Notes

This section contains notes about installing tc Server on Unix systems.

tar Command Compatibility

If you are installing tc Server on Unix and have downloaded the compressed TAR file format (*.tar.gz), be sure that the tar command on your computer is compatible with the one required by tc Server. Open a terminal window and enter:

prompt$ tar --help

Search the help output for a -z option (which filters the output through gzip); if the tar command on your computer supports this option, then it is compatible with the one required by tc Server and you can begin the installation.

If, however, your tar command does not supports this option, then you must install GNUtar (gtar) from an external source. For example, the Web site Sunfreeware.com includes many free downloads for the Solaris platform, including GNUtar.

After you install GNUtar, update the PATH environment variable (either of the user installing tc Server or the system-wide environment variable) to include the location of the gtar command. The location depends on the directory in which you installed GNUtar.

If you have installed GNUtar, then substitute the command gtar for any references to tar in the following install procedure.

Spaces in File and Directory Names

On Unix systems, avoid pathnames containing spaces. Directory and file names containing spaces can cause errors in scripts when added to search paths or specified as command arguments.

6.2 Installing tc Server: Main Steps

This section describes how to install tc Server. It is divided into sub-sections, depending on the edition of tc Server you are going to install. Be sure to read tc Server Editions for information about each edition, what they contain, and the names of the *.zip or *.tar.gz files into which each edition is packaged.

The procedures cover both Unix and Windows installation. Most of the instructions, however, are for Unix. If you are installing on Windows, change the forward slashes (/) to back slashes (\); other differences in the installation are called out.

[Note]Note

It is assumed that you are installing tc Server for the first time. If you have already installed a previous version of tc Server, have created one or more tc Runtime instances, and now want to upgrade all the components to the latest version, see Upgrade and Migration Guide. The upgrade guide also describes how to upgrade an existing pre-4.5 HQ installation so that it can manage tc Runtime instances.

Installing Developer Edition

  1. Download and install a JDK or JRE, if you do not already have one installed on your computer. See Before you Begin: System Requirements.

  2. Download the tc Server Developer Edition distribution from the VMware Download Center.

    The Developer Edition is distributed as either a ZIP or compressed TAR file with the following names:

    • vfabric-tc-server-developer-2.5.X.RELEASE.zip

    • vfabric-tc-server-developer-2.5.X.RELEASE.tar.gz

  3. Open a terminal (Unix) or command window (Windows) and create the main tc Server installation directory, such as /home/tcserver. For example, on Unix:

    prompt$ mkdir /home/tcserver
  4. Unzip or untar the tc Server distribution file into the new directory.

    This creates a directory called vfabric-tc-server-developer in the main tc Server installation directory that contains the tc Runtime utility scripts, the templates directory, the tomcat-version directories, and so on.

    The templates directory in turn contains a template called insight that contains the Spring Insight feature.

    See Overview of tc Server Directories, Variables, and Configuration Files for details.

  5. Create a tc Runtime instance that contains Spring Insight by specifying the insight template. The exact steps depend on your platform (Unix or Windows).

    Unix: Change to the /home/tcserver/vfabric-tc-server-developer directory and execute the tcruntime-instance.sh script to create an instance. For example:

    prompt$ cd /home/tcserver/vfabric-tc-server-developer
    prompt$ ./tcruntime-instance.sh create insight-instance -t insight

    Windows: Change to the c:\home\tcserver\vfabric-tc-server-developer directory and execute the tcruntime-instance.bat script to create an instance:

    prompt> cd c:\home\tcserver\vfabric-tc-server-developer
    prompt> tcruntime-instance.bat create insight-instance -t insight
  6. Start the new tc Runtime instance. The exact steps depend on your platform (Unix or Windows).

    Unix: Execute the tcruntime-ctl.sh script to start the instance. For example:

    prompt$ ./tcruntime-ctl.sh insight-instance start

    Windows: Execute the tcruntime-ctl.bat script to first install the tc Runtime instance as a Windows service and then start it:

    prompt> tcruntime-ctl.bat insight-instance install
    prompt> tcruntime-ctl.bat insight-instance start

    Subsequently, you can use tcruntime-ctl.bat or the Windows Services console to start and stop the tc Runtime instance. In the Windows Services console, the tc Runtime instance is displayed with the name SpringSource tc Runtime - unique-name, where unique-name is a combination of server name and server directory.

  7. After the tc Runtime instance starts, invoke Spring Insight in your browser:

    http://host:8080/insight

    where host refers to the computer on which it is running; if this is the same computer as the browser, you can use localhost:

    http://localhost:8080/insight

See Using Spring Insight for overview and usage information about Spring Insight as well as information about creating plug-ins that extend Spring Insight.

For general tc Server post-installation tasks discussed in this section, such as creating tc Runtime instances and starting them, see Next Steps.

Installing Standard Edition (tc Runtime Only)

  1. Download and install a JDK or JRE, if you do not already have one installed on your computer. See Before you Begin: System Requirements.

  2. On the VMware Download Center page under VMware vFabric tc Server, download the vFabric tc Server Standard Edition package distribution.

    Choose the ZIP or the compressed TAR file distribution:

    • vfabric-tc-server-standard-2.5.X.RELEASE.zip

    • vfabric-tc-server-standard-2.5.X.RELEASE.tar.gz

  3. Open a terminal (Unix) or command window (Windows) and create the main tc Server installation directory, such as /home/tcserver. For example, on Unix:

    prompt$ mkdir /home/tcserver
  4. Unzip or untar the tc Server distribution file into the new directory.

    This action is all that is required to install tc Runtime; there is no installer program.

    For example, if you created a directory called /home/tcserver in the preceding step, and downloaded the Standard Edition file in the /home/Downloads directory:

    prompt$ cd /home/tcserver
    prompt$ unzip /home/Downloads/vfabric-tc-server-standard-2.5.0.RELEASE.zip

    This creates a directory called vfabric-tc-server-standard-2.5.0.RELEASE in the main tc Server installation directory that contains the tc Runtime utility scripts, the templates directory, the tomcat-version directory, and so on.

    See Overview of tc Server Directories, Variables, and Configuration Files for details.

See Next Steps for links to post-installation procedures.

Installing Standard Edition (Including HQ Management Components)

This section describes how to install one or more instances of tc Runtime and HQ Agent together (also referred to as a managed node), as well as a single HQ Server; assuming the HQ components are version 4.5 or later, both HQ components automatically include the tc Server HQ plug-in.

Read How tc Server and HQ Work Together to understand the various installation scenarios for managed nodes and the HQ Server. Then decide which tc Server components (tc Runtime, HQ Agent, and HQ Server) you are going to install on your computer(s). The typical scenarios are:

  • Install all components on the same computer.

  • Install HQ Server on one computer and install the managed node (HQ Agent and tc Runtime) on one or more different computers.

The procedure below breaks the steps into those you do on the managed node computer(s) and those you do on the HQ Server computer. If you are installing everything on the same computer, then simply execute all steps on the same computer.

[Note]Note

If you will be installing tc Runtime instances on multiple computers you must install HQ Agent on each computer.

If you have an existing HQ installation, see Upgrade and Migration Guide for details about upgrading HQ with the tc Server HQ plug-in.

  1. On the computer on which you are going to install the managed node (tc Runtime and HQ Agent), download and install a JDK or JRE, if you have not already done so. See Before You Begin: System Requirements.

  2. Open a terminal (Unix) or Command Prompt (Windows) and create two new directories: one that will contain the tc Runtime component (such as /home/tcserver) and one that will contain the HQ Agent (such as /home/hyperic.) If you wish, you can install tc Runtime and HQ Agent in the same directory, but it is assumed in this procedure that you will install them in different directories. For example, on Unix:

    prompt$ mkdir /home/tcserver
    prompt$ mkdir /home/hyperic
  3. From the VMware Download Center, download the vFabric tc Server Standard Edition distribution. Choose the ZIP or compressed TAR file distribution:

    • vfabric-tc-server-standard-2.5.X.RELEASE.zip

    • vfabric-tc-server-standard-2.5.X.RELEASE.tar.gz

  4. Unzip or untar the tc Server distribution file into the /home/tcserver directory.

    This action is all that is required to install tc Runtime; there is no installer program.

    For example, if you created a directory called /home/tcserver in the preceding step, and downloaded the Standard Edition file in the /home/Downloads directory:

    prompt$ cd /home/tcserver
    prompt$ unzip /home/Downloads/vfabric-tc-server-standard-2.1.0-RELEASE.zip

    A directory called vfabric-tc-server-standard is created in the main tc Server installation directory that contains the tc Runtime utility scripts, the templates directory, the tomcat-version directory, and so on.

    See Overview of tc Server Directories, Variables, and Configuration Files for details.

  5. From the VMware Download Center, download the Agent-only 4.5 Hyperic HQ EE distribution and unpack it into the /home/hyperic directory.

    The HQ Agent will be installed in the directory /home/hyperic/agent-4.5.X.X-EE.

  6. On the computer on which you are going to install HQ Server, determine whether you need to download and install a JDK/JRE or database server. You typically only need to do this if you are installing the platform-neutral version of HQ Server; the platform-specific version bundles a JDK/JRE and non-production database server to get you started. See Before you Begin: System Requirements.

    If you are using your own database server, obtain the URL and username/password used to connect to it, because the installation program for HQ Server will ask for it.

  7. Open a terminal (Unix) or Command Prompt (Windows) and create the directory that will contain the HQ Server, such as /home/hyperic. For example, on Unix:

    prompt$ mkdir /home/hyperic

    If you are installing all components on the same computer, you can install the HQ Server into the HQ Agent or tc Runtime directory that you already created (/home/tcserver in our example).

  8. From the VMware Download Center, download the Hyperic HQ EE (Enterprise Edition) distribution and unpack it into a temporary directory.

    Be sure you download version 4.5 of HQ which automatically includes the tc Server HQ plug-in. You can download a distribution for your particular platform, such as Windows or Linux, or you can download a platform-neutral distribution that does not contain a JDK or database (labelled noJRE.)

  9. From your terminal window or Command Prompt, change to the temporary directory in which you unpacked the HQ distribution and execute the setup.sh (Unix) or setup.bat (Windows) script.

    For example, if you downloaded and unpacked the HQ distribution into the /home/Downloads directory, you will have a sub-directory called hyperic-hq-installer:

    prompt$ cd /home/Downloads/hyperic-hq-installer
    prompt$ ./setup.sh

    After accepting the terms of agreement, enter 1 to install just the HQ Server (you installed the HQ Agent in a preceding step.) The script asks a few more questions, such as an encryption key for encrypting the database-user password and the directory in which you will install HQ Server (/home/hyperic in our example.) If you are installing a platform-specific version of HQ, the setup.sh script might ask you to run another script as the root user. If you are installing the platform-neutral version of HQ, the script asks for information about your database, including the database URL, name and password of the user that connects to the database. For more information, see the vFabric Hyperic Documentation.

    When the setup.sh script completes, HQ Server is installed in /home/hyperic/server-4.5.X.X-EE.

    See Installing the Agent and Server from a Tarball or Zip Archive for additional details about the questions asked by the setup.sh script.

See Next Steps for links to post-installation procedures.

Installing Spring Edition

  1. On the VMware Download Center page under VMware vFabric tc Server, download the tc Server Standard Edition and the Instrumented Spring JARs.

  2. Follow the instructions in Installing Standard Edition (Including HQ Management Compnents) to download and install the tc Server managed node and HQ Server.

  3. Download the distributions of Spring Framework, Spring Web Flow, Spring Security, and Spring Web Services that have been specifically instrumented for management with Hyperic HQ.

  4. See Spring Instrumentation Documentation for information about using these instrumented JARs with your Spring application.

Next Steps

See Overview of tc Server Directories, Variables, and Configuration Files for conceptual information about tc Server directories and configuration files. See Post-Installation Tasks for the list of typical post-installation procedures, such as creating tc Runtime instances, starting the various components of tc Server and getting started with the HQ user interface.

Then try out the tutorials: Tutorial: Using HQ to Configure and Manage tc Runtime Instances and Tutorial: Very Simple Web Application Development.

6.3 Overview of tc Server Directories, Variables, and Configuration Files

This section provides basic reference information about the tc Server installation directories and the most important configuration files.

When you install the tc Runtime component, you simply unpack the appropriate *.zip or *.tar.gz file into the main installation directory. This creates a vfabric-tc-server-edition subdirectory, where edition refers to the edition of tc Server you are using (standard or developer.) This subdirectory in turn contains all tc Server-related files and directories. In particular:

  • tomcat-version. Where version is the version of the core Apache Tomcat on which this version of the tc Runtime is based, such as tomcat-6.0.25.A-RELEASE. tc Server 2.5 includes runtimes based on both Tomcat 6.0 and Tomcat 7.0. This is the basic CATALINA_HOME directory; Apache Tomcat users will recognize its contents.

  • templates. Out-of-the-box templates for creating customized tc Runtime instances, such as cluster-node enabled or SSL-ready. You optionally specify one or more of these templates when you run the tcruntime-instance.sh|bat script to create a new tc Runtime instance.

  • lib. JAR files that implement the templating mechanism and are used by the tcruntime-instance script. .

  • tcruntime-instance.sh|bat. Scripts for creating new tc Runtime instances.

    When you create a new tc Runtime instance with this script, the script creates (by default) a subdirectory of the vfabric-tc-server-edition directory with the same name as the new tc Runtime instance; this new directory is the CATALINA_BASE of the tc Runtime instance. The new directory contains the instance-specific configuration files, its own Web application deployment directory, log files, and so on.

  • tcruntime-ctl.sh|bat. Scripts for controlling tc Runtime instances, such as starting or stopping them. The bin directories of individual tc Runtime instances include their own versions of these scripts that in turn call these main ones. You can also call the top-level scripts if you specify the name of the tc Runtime instance.

tc Server Variables

The following tc Server variables are used:

  • CATALINA_HOME. Root directory of your tc Runtime installation.

    The CATALINA_HOME variable points to the directory INSTALL_DIR/vfabric-tc-server-edition/tomcat-version, where INSTALL_DIR is the directory in which you installed tc Server (such as /home/tcserver), edition refers to the edition of tc Server you are using (developer or standard), and version is the version of the underlying Tomcat, such as 6.0.30.A-RELEASE.

  • CATALINA_BASE. Root directory of a particular tc Runtime instance.

    This directory contains the instance-specific files, such as the conf/server.xml file that configures this particular instance. If you created a tc Runtime instance called myserver and you are using the Standard Edition, then the CATALINA_BASE of the instance is INSTALL_DIR/vfabric-tc-server-standard/myserver by default.

The following variables are "exposed" by tc Runtime, which means that you can set them or use them in your environment (or in the bin/setenv.sh file of your tc Runtime instance) to achieve the specified results:

  • CATALINA_OUT. Unix only. Use this environment variable to specify a file to which a tc Runtime instance writes stdout and stderr messages. If you do not explicitly set this environment variable, then the tc Runtime instance writes stdout and stderr messages to the file CATALINA_BASE/logs/catalina.out.

    For example, to specify that the tc Runtime instance write its stdout and stderr messages to /home/tcserver/tcruntime-instance-6.log, set the variable in your environment or setenv.sh as follows:

    CATALINA_OUT=/home/tcserver/tcruntime-instance-6.log
  • INSTANCE_NAME. Name of the tc Runtime instance. You can use this variable to create other unique variables within configuration scripts.

    For example, on Unix platforms you can update the bin/setenv.sh file to use the name of the tc Runtime instance when defining the CATALINA_OPTS variable as follows:

    CATALINA_OPTS="-Dinstance.name=$INSTANCE_NAME"

    On Windows, the equivalent change would be to the conf/wrapper.conf file as follows:

    set CATALINA_OPTS=-Dinstance.name=%INSTANCE_NAME%
  • INSTANCE_BASE. Specifies the parent directory of the tc Runtime instance. The full pathname of the tc Runtime instance directory would be $INSTANCE_BASE/$INSTANCE_NAME.

    You can use the INSTANCE_BASE variable in the same way as the INSTANCE_NAME variable, as described in the preceding bullet.

tc Runtime Instance Directory Structure

After you create a new tc Runtime instance, its CATALINA_BASE directory contains the following sub-directories:

  • bin. Contains the tcruntime-ctl.* scripts to start and stop tc Runtime instances, as well as the setenv.* scripts. The *.sh Unix files are functional duplicates of the *.bat Windows files.

  • conf. Contains the configuration files for the tc Runtime instance, such as server.xml, catalina.properties, web.xml, context.xml, and so on.

  • lib. Contains resources shared by all Web applications deployed to the tc Runtime instance.

  • logs. Location of the logs files.

  • webapps. Deployment directory for the Web applications deployed to the tc Runtime instance.

  • work. Temporary work directory for all deployed Web applications.

  • temp. Directory used by the JVM for temporary files.

tc Runtime Instance Configuration Files

You configure a particular tc Runtime instance by changing its configuration files (either by editing the XML file manually or through the HQ user interface); later chapters of this documentation describe how to do this. All the configuration files for a tc Runtime instance are located in its CATALINA_BASE/conf directory. The most important configuration files are as follows:

  • server.xml. Main configuration file for a tc Runtime instance. It configures the behavior of the servlet/JSP container.

    By default, the server.xml file for a tc Runtime instance uses variable substitution for configuration properties that must be unique across multiple tc Runtime instances on the computer, such as HTTP and JMX port numbers. These variables take the form ${var}. For example, the variable for the HTTP port that the tc Runtime instance listens to is ${http.port}. The specific values for these variables for a particular tc Runtime instance are stored in the catalina.properties file, in the same directory as the server.xml file.

  • catalina.properties. Properties file that contains the tc Runtime instance-specific values for variables in the server.xml file.

  • context.xml. Configures the context that is loaded by all Web applications deployed to the tc Runtime instance.

  • web.xml. Default web.xml file that is loaded by all deployed Web applications, in addition to their individual web.xml files.

  • wrapper.conf. Windows only. Configures the Java Service Wrapper from Tanuki Software used to install the tc Runtime instance as a Windows service. The Wrapper correctly handles user log outs under Windows, service dependencies, and the ability to run services that interact with the desktop.

  • jmxremote.access and jmxremote.password. Configures the JMX users and passwords.

  • logging.properties. Configures the logging system of the tc Runtime instance.

7. Post-Installation Tasks

After you install the components of vFabric tc Server on all relevant computers, you perform some or all of the following post-installation tasks, depending on the edition of tc Server: Start and run the HQ Server and agents; create and start tc Runtime instances; deploy Web applications to an instance; or invoke and use the HQ user interface to monitor and configure tc Runtime instances. (As a performance-monitoring alternative to HQ, you can install and configure Spring Insight. See Using Spring Insight.)

7.1 Creating a New tc Runtime Instance

The following sections describe how to create new instances of tc Runtime and provide related information:

The procedural topics cover both Unix and Windows commands. The documentation uses Unix-like forward slashes (/) for directories; if you are on a Windows platform, change these to back slashes (\).

Creating tc Runtime Instances: Typical Steps

This section describes the simplest way to create a new tc Runtime instance. For an explanation of the type of instance that the example creates, see the description following the procedure.

  1. Open a terminal window (Unix) or Command Prompt (Windows).

  2. Change to the INSTALL_DIR/vfabric-tc-server-edition-release directory, where INSTALL_DIR refers to the main tc Server installation directory, such as /home/tcserver, edition refers to the edition of tc Server you are using (developer or standard.), and release is the release specifier For example:

    prompt$ cd /home/tcserver/vfabric-tc-server-standard-2.5.0-RELEASE
  3. Run the tcruntime-instance.sh (Unix) or tcruntime-instance.bat (Windows) script, passing it the create serverName option. Replace serverName with the name of your new tc Runtime instance. See Best Practice: Naming tc Runtime Instances for tips on naming an instance.

    For example, on Unix:

    prompt$ ./tcruntime-instance.sh create myserver 

    On Windows:

    prompt> tcruntime-instance.bat create myserver 

When the preceding sample command completes, the new tc Runtime instance is located by default in the INSTALL_DIR/vfabric-tc-server-edition/myserver directory (such as /home/tcserver/vfabric-tc-server-standard/myserver); you can specify a different instance directory with the --instance-directory directory option. This directory is also the value of the CATALINA_BASE variable for this tc Runtime instance. For example:

prompt> tcruntime-instance.bat create myserver --instance-directory /home/tcserver/instances

In the preceding example, the myserver instance directory will be /home/tcserver/instances/myserver.

By default, the tc Runtime instance uses the JAVA_HOME environment variable for the Java binaries, or the instance uses the java binary that it found in the PATH environment variable when it started. You can specify a specific JAVA_HOME using the --java-home option.

The ports of the tc Runtime instance are the default values:

  • HTTP listen port: 8080

  • JMX port: 6969

  • AJP port: 8009

  • Shutdown port: -1

The preceding tcruntime-instance sample did not specify the --version option, so the instance is pinned to the highest tc Runtime version located in the installation directory, for example 7.0.8.A-RELEASE. You can use the modify-version verb to unpin the instance. See Pinning tc Runtime Instances to a Specific Version for more information.

When you use the tcruntime-instance.sh|bat command script to create an instance, you can specify additional optional parameters, as described in tcruntime-instance.sh Reference. For example, you can use the --property option to specify a configuration property.

tcruntime-instance.sh Reference

The tcruntime-instance command script has five possible command verbs, used to create, modify, or upgrade a tc Runtime instance, list the existing instances, or display help for the command script. Each command has its own set of options, as described in the tables in this section. Depending on the command, you must specify the name of a tc Runtime instance. The general syntax for each of the commands follows; click on the link to see the options for that particular command:

tcruntime-instance create instance-name [options]
tcruntime-instance modify-version instance-name [options]
tcruntime-instance upgrade instance-name [options]
tcruntime-instance list [options]
tcruntime-instance help [command-name]

The create Command

Use the create command to create a new tc Runtime instance.

The command requires that you specify a name for the new tc Runtime instance directly after the create text.

When you create a new instance, and you do not specify the --template option to apply one or more specific templates, the tcruntime-instance script creates a basic tc Runtime instance that uses the default template (called bio); this template adds the Blocking IO (BIO) HTTP Connector to the server.xml of the instance. You can use the --template option to apply one or more templates so that the instance is automatically configured for a particular feature, such as the NIO connector, clustering, or SSL.

Examples of creating new tc Runtime instances are shown after the options reference table.

The following table lists options for the create command of tcruntime-instance.sh|bat. When specifying the most common options, you can use either the short form (such as -i) or the long form (such as --instance-directory); less common options support only the long form.

Table 7.1. Options of the create Command

Option (Long Form)Option (Short Form, if available)Description
--forceN/AForces the script to create a new tc Runtime instance, even if one already exists. By default the script does not force the creation.

If you specify this parameter and a tc Runtime instance with the name already exists, the script replaces only the existing bin and conf directories; the script does not replace the other directories, such as lib or temp. It is assumed in this case that you do not want to touch the user-specific files, such as Web applications.

To update the tc Runtime version used by an instance, use the modify-version command, not the --force option.

--help-hOutputs usage information about the create command usage.
--interactiveN/ATells the script to interactively ask for configuration properties. For example, use this parameter if you want to change the default port numbers, as listed in Creating tc Runtime Instances: Typical Steps.

Warning: Be sure that all tc Runtime instances on the same computer have unique port numbers.

--instance-directory instanceDir-i instanceDirReplace instanceDir with the full or relative pathname of the directory in which you want the new tc Runtime instance to be created. If you specify a relative directory pathname, the directory is relative to the directory from which you are running the tcruntime-instance.sh|bat script.

The default value of this option is the current working directory.

--java-home

--java-home path_to_jre

N/AIf specified without a path_to_jre value, hard-codes the JAVA_HOME variable in various files of the instance, using the global JAVA_HOME environment variable value. You can also use this option to specify a different location of the JDK or JRE. In this case, replace path_to_jre with the full pathname of the JRE or JDK.

If you do not specify this option at all, then the instance uses the JAVA_HOME global environment variable, and does not hard-code the value anywhere.

--layout layoutN/ASpecifies the type of layout you want your new tc Runtime instance to use: separate or combined. The default value is separate.

In the separate layout, CATALINA_HOME and CATALINA_BASE point to different directories; in the combined layout they point to the same directory, which means that the tc Runtime binaries are bundled within your instance. The combined is the standard Apache Tomcat layout.

Warning: SpringSource recommends that you always use the separate layout, which is why it is the default value if you do not specify this option. For addiditonal information, see Differences Between the Separate and Combined Layouts.

--properties-file file-f fileSpecifies the name of a properties file that contains configuration properties that you want to apply to the new tc Runtime instance.

When you create the properties file, it should contain one property per line, in the form template-name.property-name=value. The name of the property depends on the template. For example, the default template (called bio) has two configuration properties: http.port and https.port. Other templates might specify their own configuration properties. If you want to pass your own values of these properties to the tcruntime-instance script at the command line, rather than the instance taking the default values, create a file such as the following:

bio.http.port=9090

bio.https.port=9191

Then point to this configuration property file using this option:

--properties-file my-property-file

--property template.property=value-p template.property=valueSpecifies a single configuration that you want to apply to the new tc Runtime instance.

When you create a tc Runtime instance, the tcruntime-instance script always applies a template, even if it is the default one (called bio). Templates usually have configuration properties. For example, the bio template has two configuration properties: http.port and https.port. Other templates might specify their own configuration properties. If you want to pass your own values of these properties to the tcruntime-instance script at the command line, rather than the instance taking the default values, use this option to specify the property in the form template-name.property-name=value.

For example, to specify that the HTTP port for a new tc Runtime instance that uses the default template is 9090, specify the property as follows:

--property bio.http.port=9090

--template template_name-t template_nameApplies a template to a newly-created tc Runtime instance. You can specify this option multiple times to apply multiple templates to the instance.

In this context, a tc Runtime template refers to a set of customized tc Runtime files that the tcruntime-instance script copies to or merges with the instance it just created.

The template files are organized in the standard Tomcat hierarchy; for example, configuration files are in the conf directory and binary files are in the bin directory. Changes to the conf/server.xml or conf/context.xml files of the instance are contained in template files called conf/server-fragment.xml or conf/context-fragment.xml, respectively. These fragment XML files contain just the additions, deletions, or changes that will be applied to the base tc Runtime instance. When the tcruntime-instance script applies the template after it has created a new base instance, it merges server-fragment.xml or context-fragment.xml files with their base originals, or it might replace other instance files, depending on the contents of the template. For example, the template might copy one or more applications to the webapps directory so that they are automatically deployed on startup.

If you use this option to specify one or more templates that do not add a <Connector> element to the server.xml configuration file, the tcruntime-instance script automatically adds a Blocking IO (BIO) HTTP Connector to the instance. If your templates include a <Connector> element, then the script does not add a BIO Connector.

Replace the template_name argument with the name of an existing subdirectory of the INSTALL_DIR/vfabric-tc-server-edition/templates directory, where edition refers to the Edition of tc Server you are using (developer or standard.) An example of an existing template is apr-ssl or cluster-node.

For additional details and examples about using this feature, see Creating a tc Runtime Instance with a Template.


The following example shows how be be interactively prompted for configuration properties (such as port numbers) and that you want the new tc Runtime instance to be located in the /home/tcserver/instances directory:

prompt$ ./tcruntime-instance.sh create myserver --instance-directory /home/tcserver/instances
    --interactive

The following example shows how to pin a new instance to version 6.0.32.A-RELEASE of tc Runtime and to specify a hard-coded value for JAVA_HOME:

prompt$ ./tcruntime-instance.sh create myserver --version 6.0.32.A-RELEASE
    --java-home /home/java/jdk1.6.0_20

The following example shows how to pass the value 9090 to the http.port configuration property of the default template (called bio), rather than use the default value of 8080:

prompt$ ./tcruntime-instance.sh create myserver --property bio.http.port=9090

The modify-version Command

Use the modify-version command to modify the version of tc Runtime used by an existing instance that is pinned to a particular version of tc Runtime.

Use the --version option to specify the new version of the instance. If you do not specify --version, the resulting instance is unpinned, which means it uses the latest available version of tc Runtime. See Pinning tc Runtime Instances to a Version.

Note: It is assumed that you have already installed the tc Runtime version to which you want to modify the existing instance.

Examples of modifying existing tc Runtime instances are shown after the options reference table.

The following table list options for the modify-version command of tcruntime-instance.sh|bat. When specifying the options, you can use either the short form (such as -i) or the long form (such as --instance-directory).

Table 7.2. Options of the modify-version Command

Option (Long Form)Option (Short Form)Description
--version version-v versionPins the instance to the specified version of tc Runtime, such as 6.0.32.A-RELEASE.

Valid values depend on the versions of tc Runtime that you have installed. The tcruntime-instance.sh script determines the list of available versions by searching for INSTALL_DIR/tomcat-XXX directories, where XXX follows a pattern such as 6.0.32.A-RELEASE. You can check for these directories to determine the versions to which you can pin a tc Runtime instance.

If you do not specify this option, the instance is not pinned to a tc Runtime version, which means that when you use the tcruntime-ctl.sh|bat script to start the instance, the script searches for the highest version and applies it to the instance. For example, if 6.0.24.A-RELEASE, 6.0.24.B-RELEASE and 6.0.32.A-RELEASE are all present, and you don't specify this option, then the start script automatically chooses 6.0.32.A-RELEASE as the version of the instance. See Pinning a tc Runtime Instance to a Specific Version for more information.

--instance-directory instanceDir-i instanceDirReplace instanceDir with the full or relative pathname of the directory that contains the tc Runtime instance you want to modify. If you specify a relative directory pathname, the directory is relative to the directory from which you are running the tcruntime-instance.sh|bat script.

The default value of this option is the current working directory.

--help-hOutputs usage information about the modify-version command usage.

The following example shows how to modify an existing tc Runtime instance called myotherserver to use version 6.0.32.A-RELEASE of tc Runtime; the resulting instance will be pinned to this version:

prompt$ ./tcruntime-instance.sh modify-version myotherserver --version 6.0.32.A-RELEASE 

The following example shows how to unpin the myotherserver instance so it always uses the latest available version of tc Runtime when it starts:

prompt$ ./tcruntime-instance.sh modify-version myotherserver 

The upgrade Command

Use the upgrade command to upgrade an instance to a new version of tc Server. The upgrade command copies the existing instance to a new instance directory and updates the files and descriptors in the instance.

The difference between the upgrade command and the modify-version command is that the upgrade command upgrades the tc Server scripts and other tc Server files to a newer version, and the modify-version command changes the tc Runtime version to a tc Runtime based on a different Apache Tomcat release.

[Note]Note

The upgrade command can upgrade an instance using tc Runtime 6 to a newer version of tc Runtime 6, but not to tc Runtime 7. To move from tc Runtime 6 to tc Runtime 7, create a new instance using tc Runtime 7 and redeploy your Web applications.

The usual procedure for using the upgrade command is to:

  1. Install the new tc Server release in a directory alongside the existing tc Server installation.

  2. Execute the upgrade command from the new tc Server installation directory, specifying the instance to be upgraded in the old tc Server installation directory.

This results in a new tc Runtime instance in the new tc Server installation directory. When all instances have been upgraded, restarted, and verified, the old tc Server instance directory can be removed.

Before you use the upgrade command:

  • If the instance to be upgraded is running, stop it. For example, execute the following command in the tc Server Installation directory:

    prompt$ tcruntime-ctl.bat myInstance stop
  • If the instance to be upgraded is installed as a Windows service, uninstall it. For example:

    prompt$ tcruntime-ctl.bat myInstance uninstall

After running the upgrade command, install the new instance as a Windows service (if on Windows) and then start the new instance.

If you have linked the CATALINA_HOME/bin/init.d.sh script to /etc/init.d on a UNIX system, unlink the script before upgrading and then re-link the script in the new instance directory after the upgrade is complete.

Table 7.3. Options of the upgrade Command

Option (Long Form)Option (Short Form)Description
--instance-directory instanceDir-i instanceDirReplace instanceDir with the full or relative pathname of the directory where the upgraded instance is to be created. If you specify a relative pathname, the directory is relative to the directory where you run the tcruntime-instance.sh|bat script.

The default value of this option is the current working directory.

--version version-v versionSpecifies the tc Runtime version to use for the upgraded instance. This option is required when upgrading an unpinned instance or to prevent the instance from being upgraded to the most recent release. If omitted, the most recent available version of the existing major release is used; if the instance is currently using tc Runtime 6, it is upgraded to use the highest tc Runtime 6 version in the tc Server installation directory.

Valid values for version depend on the versions of tc Runtime that you have installed. The tcruntime-instance.sh script determines the list of available versions by searching for INSTALL_DIR/tomcat-XXX directories, where XXX follows a pattern such as 6.0.32.A-RELEASE. You can check for these directories to determine which versions to which you can pin a tc Runtime instance.

--help-hDisplays usage information for the upgrade command.


The following example upgrades the instance at /home/tcserver/vfabric-tc-server-standard/myInstance to a new instance at /home/tcserver/vfabric-tc-server-standard-new/myInstance. The upgraded instance will use tc Runtime release 7.0.6.A.RELEASE. The command is executed in the /home/tcserver/vfabric-tc-server-standard-new directory:

prompt$ cd /home/tcserver/vfabric-tc-server-standard-new
prompt$ ./tcruntime-instance.sh upgrade ../vfabric-tc-server-standard/myInstance -v 7.0.6.A.RELEASE

The list Command

Use the list command to list the known tc Runtime instances. For each instance, the command outputs the information additional information, such as the parent directory of the instance, the directories that contain its command scripts and binaries, the version of the instance (both base tc Runtime version and tc Server version), and whether the instance is currently running.

The following table lists options for the list command of tcruntime-instance.sh|bat. When specifying the options, you can use either the short form (such as -i) or the long form (such as --instance-directory)

Table 7.4. Options of the list Command

Option (Long Form)Option (Short Form)Description
--instance-directory instanceDir-i instanceDirReplace instanceDir with the full or relative pathname of the directory that contains the tc Runtime instances for which you want a listing. If you specify a relative directory pathname, the directory is relative to the directory from which you are running the tcruntime-instance.sh|bat script.

The default value of this option is the current working directory.

--help-hOutputs usage information about the list command usage.

The following example shows how to list known instances in the tc Server installation directory. There is one instance, myInstance, in this example.

prompt$ ./tcruntime-instance.sh list 
Listing instances in '/home/tcserver/vfabric-tc-server-standard-2.5.0.RELEASE' 
  myInstance Status: 
    INFO Derived instance name: myInstance 
    INFO Executing /home/tcserver/vfabric-tc-server-standard-2.5.0.RELEASE/./tcruntime-ctl.sh 
    INFO Instance name: myInstance 
    INFO Script directory: /home/tcserver/vfabric-tc-server-standard-2.5.0.RELEASE 
    INFO tc Runtime location:/home/tcserver/vfabric-tc-server-standard-2.5.0.RELEASE 
    INFO Instance base: /home/tcserver/vfabric-tc-server-standard-2.5.0.RELEASE 
    INFO Binary dir: /home/tcserver/vfabric-tc-server-standard-2.5.0.CI-279/tomcat-7.0.14.A.CI-72 
    INFO Runtime version: 7.0.14.A.CI-72 
    INFO Script version: 2.5.0.RELEASE 
    STATUS Instance is RUNNING as PID=6039 

Getting Help for tcruntime-instance

To view a summary of all available commands of the tcruntime-instance script, use the help command:

prompt$ ./tcruntime-instance.sh help

To view the usage information about a particular command, specify the name of the command after the help command:

prompt$ ./tcruntime-instance.sh help create

The output includes brief information about the available options. You can also use the --help option of the commands to view the same information:

prompt$ ./tcruntime-instance.sh create -h
prompt$ ./tcruntime-instance.sh create --help

Pinning tc Runtime Instances to a Specific Version

Depending on whether you explicitly specify the --version parameter of the tcruntime-instance.sh|bat script when you create an instance, the resulting tc Runtime instance is either pinned or unpinned to a particular version of tc Runtime. Specifically:

  • If you explicitly specify the --version parameter, the tc Runtime instance is pinned to that version. This means that when you use the tcruntime-ctl.sh|bat script to start the instance, the instance always uses this tc Runtime version, even if you have installed a more recent version of the tc Runtime.

  • If you do not specify the --version parameter, the tc Runtime instance is unpinned. This means that when you use the tcruntime-ctl.sh|bat script to start the instance, the script searches for the most recent version of tc Runtime and applies it to the instance.

To determine the list of available versions, search for INSTALL_DIR/tomcat-XXX directories, where XXX follows a pattern such as 6.0.32.A-RELEASE.

For example, if you create a new instance using the following command:

prompt$ ./tcruntime-instance.sh create myserver --version 6.0.32.A-RELEASE

the myserver instance will always use version 6.0.32.A-RELEASE of the tc Runtime, even if a more recent version is installed. If, however, you do not specify the --version parameter, for example:

prompt$ ./tcruntime-instance.sh create myserver 

the myserver instance always uses the latest version of tc Runtime that is currently installed. Thus if you later install a new version of tc Runtime (which means that there will be a new tomcat-7.0.X.X-X directory alongside the existing ones), and start the unpinned myserver instance using the tcruntime-ctl.sh|bat script, the instance automatically uses the latest tc Runtime version without your having to explicitly do anything.

To determine whether an existing tc Runtime instance is pinned, check for the file INSTANCE-DIR/conf/tomcat.version; if the file exists, then the instance is pinned to the version specified in the file.

To change the version of a pinned instance, use the modify-version command together with --version to specify the new version. For example:

prompt$ ./tcruntime-instance.sh modify-version myserver --version 6.0.26.A-RELEASE

Finally, if you want to convert a currently pinned instance to one that is unpinned, use the modify-version command without --version. For example:

prompt$ ./tcruntime-instance.sh modify-version myserver 

Best Practice: Naming tc Runtime Instances

The name of a tc Runtime instance is the name of its CATALINA_BASE directory, minus the leading directory paths. As a reminder, CATALINA_BASE is the base directory of the instance; this directory contains the instance-specific startup scripts in the bin sub-directory, the configuration files in the conf sub-directory, and so on. For example, if you create a tc Runtime instance in the /home/tcserver/vfabric-tc-server-standard/myServer directory, then its name is myServer.

The HQ user interface also uses this naming convention when first identifying a tc Runtime instance. In particular, the HQ user interface displays an instance with the name platform-resource tc Runtime catalina-base-dir, where platform-resource refers to the computer on which the tc Runtime instance is running and catalina-base-dir refers to the CATALINA_BASE directory of the tc Runtime instance without the leading directory pathnames. The HQ user interface uses the full pathname of CATALINA_BASE as the default description of the instance.

This means, however, that if you create two instances whose full pathnames differ, but their main installation directory names are the same, the instances will show up in the HQ user interface with the same names. This makes it difficult to differentiate multiple tc Runtime instances from each other, although you can always look at the description for the full pathname.

For this reason, it is best practice to use unique names for the main installation directory for each tc Runtime instance on the same computer.

Creating a tc Runtime Instance with a Template

Templates make it easier to automatically configure certain tc Runtime features at the time you create a tc Runtime instance. These features include SSL, clustering, and so on.

You use the --template option to specify a template to the tcruntime-instance script when you create a new tc Runtime instance. You can specify the --template option multiple times if you want to apply multiple templates, such as clustering and SSL.

When you create a tc Runtime instance using tcruntime-instance, the script performs the following high-level steps:

  • Creates the instance directory and applies the base template to it. This template provides configuration common to all tc Runtime instances, such as ensuring that the instance can be monitored with HQ.

  • If you specified one or more templates with the --template option, the script applies each template in order. The templates might update the instance's server.xml or context.xml file as well as copy over other files, such as JAR files.

  • Applies any needed configuration properties. The script gets the value of these properties either interactively from you, from the --property or --properties-file options you might have specified at the command-line, or from the default property values if no value is provided.

  • If there are no <Connector> elements in the server.xml file after the templates have been applied, the tcruntime-instance script adds a Blocking IO (BIO) HTTP Connector to the instance.

A template is simply a directory under the INSTALL-DIR/templates directory that contains additional or customized tc Runtime instance files. For example, the directory might contain a conf/server-fragment.xml file, which the tcruntime-instance script uses to update the base server.xml file with the relevant feature. The directory might also contain additional JAR files.

An example of creating an instance using the nio-ssl template is as follows:

prompt$ ./tcruntime-instance.sh create myserver --template nio-ssl

To use this feature, the specified template must already exist. You can use one of the out-of-the-box templates.

The files that make up a template reside in a single directory; the name of the template directory is the name of the template. The template files are organized in the standard Tomcat subdirectory hierarchy. For example, configuration files live in the conf subdirectory and JAR files live in the lib subdirectory. The configuration files in the conf template directory are actually just fragments of XML, called server-fragment.xml or context-fragment.xml, that contain just the additions, deletions, or changes that the script applies to the base instance. When the tcruntime-instance script applies the template after it has created a new base tc Runtime instance, it merges the XML fragment files with the corresponding base conf/server.xml or conf/context.xml file, and copies over any other files, such as JAR files. Depending on the contents of the template directory, the new tc Runtime instance might be quite different from the standard one. For example, the template might modify the standard server.xml file with additional server configuration, or copy one or more applications to the webapps directory so that they are automatically deployed on startup.

The argument to the --template option must be the tc Runtime template directory. The tcruntime-instance script looks for the template directory in the INSTALL_DIR/vfabric-tc-server-edition/templates directory, where edition refers to the edition of tc Server you are using (developer or standard.)

You can specify the --template option multiple times; the tcruntime-instance script applies each template in the order given. First the script copies over any non-configuration files to the appropriate instance directory, and then the script merges the configuration file fragments with the instance configuration files. You will receive a warning if the creation of the instance copies over files with the same name and directory location from two or more different templates.

The following example shows how to create a new tc Runtime instance called myserver using the nio out-of-the-box template which adds a NIO Connector to the server.xml file:

prompt$ ./tcruntime-instance.sh create myserver --template nio

In the preceding example, because it does not specify the --version or --java-home options, the instance is unpinned, and thus uses the latest installed version of tc Runtime, and the instance uses the value of JAVA_HOME in the environment.

The following example shows how to create an instance that uses two templates:

prompt$ ./tcruntime-instance.sh create myserver --template insight --template jmx-ssl

Note that the insight template is available only in the Developer Edition of tc Server.

Templates Provided by tc Runtime

SpringSource tc Runtime provides a number of out-of-the-box templates. Most are server configuration related; for example, one template sets up a basic cluster node configuration and another sets up SSL. Some templates are provided only in certain editions of tc Server, such as the insight template in the Developer Edition.

You can download a tc Server template for setting up HTTP session replication using VMware vFabric GemFire, the in-memory distributed data management platform, from the VMware vFabric GemFire section of the VMware Download Center. See Setting Up GemFire HTTP Session Management for tc Server at the GemFire community website for instructions for using the template.

The following example shows how to use the nio out-of-the-box template to create a tc Runtime instance that is automatically configured with the NIO Connector in its server.xml file:

prompt$ ./tcruntime-instance.sh create myserver-nio --template nio

Because the nio template is in the templates directory, you simply specify its name at the --template option.

The following table lists the templates that are provided by tc Runtime out-of-the-box and how each template differs from the generic tc Runtime instance (created without a specific template.) All templates are located in the INSTALL_DIR/vfabric-tc-server-edition/templates, where edition refers to the edition of tc Server you installed (developer or standard).

Table 7.5. Out-of-the-Box Templates Provided by tc Runtime

Template NameComparison with Default tc Runtime Instance
baseThis template is the base from which all new tc Runtime instances are created. It provides the configuration that is common to all tc Runtime instances, such as ensuring that the instance can be monitored with HQ. When this template is applied, either the base-tomcat-6 or base-tomcat-7 is applied as well, depending on the tc Runtime version to be used by the instance.
base-tomcat-6Part of the base template, this directory contains files specific to tc Runtime 6.
base-tomcat-7Part of the base template, this directory contains files specific to tc Runtime 7.
ajpThis template adds an Apache JServe Protocol (AJP) connector, which enables Apache web server to communicate with the tc Runtime instance. For details about the connector, see The AJP Connector in the Apache Tomcat Configuration Reference.
apr

This template:

  • Adds a APRLifecycleListener to detect the APR-based native library required to use the APR/native connector.

  • Adds the APR HTTPS connector.

NOTE: You must install the APR/native library in order to use the APR connector.

For more information, see Apache Portable Runtime (APR) based Native library for Tomcat on the Apache Tomcat Web site.

apr-ssl

This template:

  • Adds an APRLifecycleListener to detect the APR-based native library required to use the APR/native connector.

  • Adds an APR HTTPS connector.

  • Adds a sample certificate and key files for testing the SSL configuration.

    Warning: These sample certificates and key files are provided only to aid testing and debugging; they are not for production use. You must replace them with your own generated certificates and keys before moving to a production system.

NOTE: You must install the APR/native library in order to use the APR connector.

For more information, see Apache Portable Runtime (APR) based Native library for Tomcat and SSL Configuration HOW-TO on the Apache Tomcat Web site.

bio

This template adds a Blocking IO (BIO) HTTP Connector to the new instance's server.xml file.

bio-sslThis template:
  • Adds a Blocking IO (BIO) HTTPS connector.

  • Adds a sample JKS keystore for testing the SSL configuration.

    Warning: The sample keystore is provided only to aid testing and debugging; it is not for production use. You must replace it with your own generated keystore before moving to a production system.

For more information, see The HTTP Connector and SSL Configuration HOW-TO on the Apache Tomcat Web site.

cluster-nodeThis template:
  • Adds the default Cluster configuration at the Engine level. By default, multicast discovery is used to identify other nodes in the cluster. If multicast is not enabled on the subnet or if multiple tc Runtime clusters may be present on the same subnet, reconfigure this cluster node to use static membership.

  • Adds the jvmRoute attribute to the Engine element to uniquely identify the node. This is parameterized using ${tcserver.node}, which is defined in the CATALINA_BASE/conf/catalina.properties file.

    tc Server provides a default value for the jvmRoute attribute. You can specify a value other than the default when you create the tc Runtime instance by specifying the cluster-node.node.name property using the --property option as follows: --property cluster-node.node.name=my-node.

Because this template does not specifically add a Connector to the instance's server.xml file, the tcruntime-instance script will automatically add a Blocking IO (BIO) HTTP Connector.

For more information, see Clustering/Session Replication HOW-TO on the Apache Tomcat Web site.

diagnosticsThis template:
  • Adds a sample JDBC resource configuration that integrates with the request diagnostics to report slow queries.

  • Adds a ThreadDiagnosticsValve at the Engine level to report on slow running requests.

Because this template does not specifically add a Connector to the instance's server.xml file, the tcruntime-instance script will automatically add a Blocking IO (BIO) HTTP Connector.

insight

Developer Edition Only. This template adds the Spring Insight Web application to your instance. Spring Insight gives you real-time visibility into the behavior and performance of your user applications. See Using Spring Insight.

Because this template does not specifically add a Connector to the instance's server.xml file, the tcruntime-instance script will automatically add a Blocking IO (BIO) HTTP Connector.

jmx-sslThis template:
  • Updates the JmxSocketListener to use SSL for all JMX communication

  • Adds a sample JKS keystore that you can use to test the JMX over SSL configuration.

    Warning: The sample keystore is provided only to aid testing and debugging; it is not for production use. You must replace it with your own generated keystore before moving to a production system.

Because this template does not specifically add a Connector to the instance's server.xml file, the tcruntime-instance script will automatically add a Blocking IO (BIO) HTTP Connector.

For more information, see SSL Configuration HOW-TO on the Apache Tomcat Web site.

nioThis template adds a Non-Blocking IO (NIO) connector for HTTP.

For more information, see The HTTP Connector on the Apache Tomcat Web site.

nio-sslThis template:
  • Adds an NIO HTTPS connector.

  • Adds a sample JKS keystore that you can use to test the SSL configuration.

    Warning: The sample keystore is provided only to aid testing and debugging; it is not for production use. You must replace it with your own generated keystore before moving to a production system.

For more information, see The HTTP Connector and SSL Configuration HOW-TO on the Apache Tomcat Web site.


Differences Between the Separate and Combined Layouts

You can create two flavors of tc Runtime instances, depending on the layout of their files:

  • Separate layout: In this layout, the instance's CATALINA_HOME and CATALINA_BASE point to two different directories. Typically, CATALINA_HOME points to a tomcat-6.0.X.X-RELEASE directory, which in turn contains the set of tc Runtime binaries that are shared by other instances that use the separate layout.

    SpringSource highly recommends you use this layout, which is the default.

  • Combined layout: This layout closely resembles the standard Apache Tomcat layout where the instance's CATALINA_HOME and CATALINA_BASE point to the same directory. This means that each instance that uses the combined layout has its own copy of the tc Runtime binaries. For this reason, it is very difficult to upgrade to a new version of tc Runtime.

    SpringSource does not recommend you use this layout, because it is so difficult to upgrade instances. The main reason for using it is if you are familiar with the Apache Tomcat layout and want to continue to use it in your environment.

7.2 Starting and Stopping tc Runtime Instances

The following sections describe how to start and stop tc Runtime instances on both Unix and Windows platforms.

On Unix platforms, you typically use shell scripts to start and stop tc Runtime instances; alternatively, you can configure your Unix boot process to start the instance automatically. On Windows, you first install the tc Runtime instance as a Windows Service. You can use the tcruntime-ctl script or the Windows Services console to start and stop it.

Unix: Starting and Stopping tc Runtime Instances Interactively Using tcruntime-ctl.sh

By default, the tcruntime-instance.sh script creates all tc Runtime instances under the INSTALL_DIR/vfabric-tc-server-edition directory, where INSTALL_DIR refers to the directory in which you installed tc Server, such as /home/tcserver, and edition refers to the edition or package of tc Server you are using (developer or standard). Each tc Runtime instance lives in its own directory; this directory translates into the server's CATALINA_BASE variable. This is the default behavior of the command script; you might have specified a different location of your tc Runtime instance.

In the following procedure, it is assumed that you installed a tc Server Standard Edition.

To start and stop a tc Runtime instance:

  1. Start a terminal window and change to the CATALINA_BASE/bin directory of the tc Runtime instance you want to start or stop.

    For example, if you installed tc Server in /home/tcserver and created a new tc Runtime instance called myserver:

    prompt$ cd /home/tcserver/vfabric-tc-server-standard/myserver/bin

    (If you are using the Developer Edition or Standard Edition of tc Server, the CATALINA_BASE directory path includes the vfabric-tc-server-developer or vfabric-tc-server-standard directory, respectively.)

  2. Start the tc Runtime instance by executing the tcruntime-ctl.sh start command. For example:

    prompt$ ./tcruntime-ctl.sh start

    This command starts the tc Runtime instance as a daemon under the current user account.

  3. Stop a currently running tc Runtime instance by executing the tcruntime-ctl.sh stop command:

    prompt$ ./tcruntime-ctl.sh stop

See tcruntime-ctl Command Reference for the full list of commands of the tcruntime-ctl script.

Unix: Starting tc Runtime Instances Automatically at System Boot Time

For Unix platforms, the tc Runtime installation includes a command script file called INSTALL_DIR/vfabric-tc-server-edition/boot.rc.template, which is a template that you can use to customize your Unix boot process so that tc Runtime instances start automatically when your computer starts. It is assumed that you already know how to customize the Unix boot process for your particular platform, so this section does not provide details about where you should put this particular boot file (although typically you rename the file something like boot.rc and put it in the /etc/rc.d directory.) Rather, this section describes the updates you should make to the boot template file to reflect your tc Runtime instance environment. Consult your Unix administration documentation for further details about customizing the boot process.

A one-to-one relationship exists between a boot.rc file and a tc Runtime instance. For example, to start multiple tc Runtime instances automatically on the same Unix computer, you create separate boot.rc files for each tc Runtime instance, modify each of them to reflect the environment of the corresponding tc Runtime instance, and then put each of these files in the appropriate boot directory.

Edit only the top part of the boot.rc.template file that sets the following environment variables:

  • TOMCAT_USER: Unix user account that you want the tc Runtime instance to run as.

  • TC_SERVER_HOME: Absolute pathname to the tc Runtime installation home directory. This directory will be something like /home/tcserver/vfabric-tc-server-standard, where /home/tcserver is the directory into which you installed tc Server. If you are using the Developer Edition, then the directory path instead will include vfabric-tc-server-developer.

  • INSTANCE_BASE: Absolute pathname to the directory that contains your tc Runtime instance. By default, this directory is the same as the TC_SERVER_HOME directory; in this case, you can set the variable to $TC_SERVER_HOME. However, tc Runtime instances can be located anywhere, in which case you should specify the absolute pathname.

  • INSTANCE_NAME: Name of the tc Runtime instance. This name corresponds to the name of the directory in which the instance is located; this directory is relative to the INSTANCE_BASE directory.

  • JAVA_HOME: Absolute pathname of the home directory of the JDK you want the tc Runtime instance to use.

The following example specifies the tc Runtime home directory as /home/tcserver/vfabric-tc-server-standard, the instance directory as the tc Runtime home directory, the instance name as myserver, the JDK location as /home/java/jdk1.6.0_11, and the tomcat user as the starter of tc Runtime process:

TOMCAT_USER=tomcat
TC_SERVER_HOME=/home/tcserver/vfabric-tc-server-standard
INSTANCE_BASE=$TC_SERVER_HOME
INSTANCE_NAME=myserver
JAVA_HOME=/home/java/jdk1.6.0_11

Do not modify any part of the boot.rc.template file after the text DO NOT EDIT BEYOND THIS LINE.

Windows: Starting and Stopping tc Runtime Instances as Windows Services

By default, the tcruntime-instance.bat script creates all tc Runtime instances under the INSTALL_DIR\vfabric-tc-server-edition directory, where INSTALL_DIR refers to the directory in which you installed tc Server, such as c:\home\tcserver and edition is developer or standard. Each particular tc Runtime instance lives in its own directory; this directory translates into the server's CATALINA_BASE variable. This is the default behavior of the command script; you might have specified a different location of your tc Runtime instance. If so, adjust the following procedure accordingly.

In the following procedure, it is assumed that you installed a tc Server Standard Edition.

To start and stop tc Runtime instances as Windows Services:

  1. If this is the first time that you will install and start the tc Runtime instance after creating it, start a Command Prompt window and continue with this procedure.

    If you have already installed the tc Runtime instance as a Windows Service, use the Windows Services control panel to start and stop it.

  2. Change to the CATALINA_BASE\bin directory of the tc Runtime instance you want to start or stop.

    For example, if you installed tc Server in c:\home\tcserver and created a new tc Runtime instance called myserver:

    prompt> cd c:\home\tcserver\vfabric-tc-server-standard\myserver\bin

    If you are using the Developer Edition of tc Server, the CATALINA_BASE directory will include the vfabric-tc-server-developer directory.

  3. Install the tc Runtime instance as a Windows service:

    prompt> tcruntime-ctl.bat install

    The command installs the tc Runtime instance as an automatic Windows Service, which means that the tc Runtime instance starts automatically when you start the Windows computer. You can change this behavior using the Windows Service control panel.

    You should see a message indicating a successful installation:

    wrapper | SpringSource tc Runtime - tcserver-c-home-tcserver-vfabric-tc-server-standard-myserver installed.

  4. Start and stop the tc Runtime instance using the tcruntime-ctl.bat script or the Windows Services console. The tc Runtime instance is displayed in the console with the name SpringSource tc Runtime - unique-name, where unique-name is a unique combination of server name and server directory.

    To start an instance using tcruntime-ctl.bat:

    prompt> tcruntime-ctl.bat start

    To stop an instance using tc-runtime-ctl.bat:

    prmopt> tcruntime-ctl.bat stop

To uninstall the tc Runtime service, execute the following command:

prompt> tcruntime-ctl.bat uninstall

Although SpringSource recommends that you always install the tc Runtime instance as a Windows service and stop and start it using the Services console, you can also stop and start the tc Runtime instance manually. See tcruntime-ctl Command Reference for the full list of commands of the tcruntime-ctl script.

Windows Java Service Wrapper

On Windows, tc Runtime uses a Java Service Wrapper from Tanuki Software to install the tc Runtime instance as a Windows service. The Wrapper correctly handles user logouts under Windows, service dependencies, and the ability to run services which interact with the desktop.

The wrapper is configured using the CATALINA_BASE\conf\wrapper.conf file, where CATALINA_BASE is the top-level directory of the tc Runtime instance, such as c:\home\tcserver\vfabric-tc-server-standard\myserver. In most circumstances, you do not need to update this file because the default one created when you created the tc Runtime instance handles most use cases. However, you might sometimes want to further customize the Windows service to fit particular circumstances of your environment; in which case you can edit the wrapper.conf file.

For details about the configuration properties, see Configuration Property Overview.

tcruntime-ctl Command Reference

You use the tcruntime-ctl.sh (Unix) and tcruntime-ctl.bat (Windows) command scripts to manage tc Runtime instances. The syntax of the script is as follows:

tcruntime-ctl.sh|bat command [option]

Typically, you run the command from the bin directory of the tc Runtime instance itself. However, you can also run it from the INSTALL_DIR/vfabric-tc-server-edition directory if you specify the name of the instance, where INSTALL_DIR refers to the directory in which you installed tc Server and edition refers the edition of tc Server (developer or standard.)

For example, to start a tc Runtime instance called myserver from the bin directory of the instance itself on Unix:

prompt$ cd /home/tcserver/vfabric-tc-server-standard/myserver/bin
prompt$ ./tcruntime-ctl.sh start

You can accomplish the same thing by running the command from the vfabric-tc-server-standard (or vfabric-tc-server-developer) directory by specifying the name of the instance:

prompt$ cd /home/tcserver/vfabric-tc-server-standard
prompt$ ./tcruntime-ctl.sh myserver start

It is assumed in the remainder of this section that you are running the command script from the bin directory of the tc Runtime instance.

The following table describes the tcruntime-ctl script commands and supported platforms.

Table 7.6. Commands of the tcruntime-ctl Script

CommandDescriptionPlatform
install run-as-userInstalls the tc Runtime instance as a Windows service. You then start and stop the service using the Windows Service console.

The optional run-as-user parameter specifies the user account that you want the tc Runtime service to actually run as when you start the service using the Windows Service console; if you do not specify this parameter, then the user account that initially installed it is used. You can specify only user accounts that have their Logon as Service right set to run a Windows service. See Setting the Logon-As- Service Right for a Windows User.

When you run this command and explicitly specify a run-as-user user, the script asks you for the password of the specified user. tc Runtime still installs the instance as a service, even if you enter an incorrect password. However, when you try to start the service, it fails with a logon error. You must uninstall the service and reinstall it with the correct password.

Windows only
uninstallUninstalls the tc Runtime instance from the Windows Service.Windows only
startStarts the tc Runtime instance as a daemon process.

On Windows, you must have previously installed the tc Runtime instance as a Windows service to be able to start it using the tcruntime-ctl.bat start command; see the documentation on the tcruntime-ctl.bat install command in this table for more information.

Unix and Windows
restart timeoutStops, and then immediately starts, a running tc Runtime instance. As with the start command, restart starts the instance as a daemon process.

On Windows, you must have previously installed the tc Runtime instance as a Windows service to be able to restart it using the tcruntime-ctl.bat restart command; see the documentation on the tcruntime-ctl.bat install command in this table for more information.

By default, the tcruntime-ctl script (when stopping the tc Runtime instance) waits for up to 60 seconds for the process to exit gracefully. If the server process exits earlier, the script proceeds to restart the server. If the process has not exited by the end of the timeout period, the script forces a termination of the process before restarting the server. Using the optional timeout parameter, you can set your own timeout value by specifying an integer option for the number of seconds. For example, to specify that you want the instance to stop after 10 seconds:

prompt$ ./tcruntime-ctl.sh restart 10

Unix and Windows
runStarts the tc Runtime instance as a foreground process.Unix and Windows
batchRuns the tc Runtime instance using the catalina.bat script as a batch job. Specifically, the script starts the tc Runtime instance by running the following command: %CATALINA_HOME%\bin\catalina.bat run.Windows only
stop timeoutStops a running tc Runtime instance. By default, the tcruntime-ctl script waits for up to 60 seconds for the process to exit gracefully; if it has not, then the script forces a termination of the process.

Using the optional timeout parameter, you can set your own timeout value by specifying an integer option for the number of seconds. For example, to specify that you want the instance to stop after 10 seconds:

prompt$ ./tcruntime-ctl.sh stop 10

Unix and Windows
statusReports the status of a tc Runtime instance, such as whether it is running or stopped, as well as useful information such as the directory from which the tc Runtime instance gets its binary files, the main instance source directory, and so on.Unix and Windows

The following table describes the options you can use with the tcruntime-ctl script. All the options are optional; you can use them with any of the tcruntime-ctl commands.

Table 7.7. Options of the tcruntime-ctl Script

OptionDescription
-d tcRuntimeDirReplace tcRuntimeDir with the full pathname of the tc Server installation directory. Use this option if you are running the tcruntime-ctl.sh|bat script from a location other than its default location.

The default value of this option is the location of the tcruntime-ctl.sh|bat script.

-n instanceDirReplace instanceDir with the full pathname of the parent of the tc Runtime instance directory. Use this option if the tc Runtime instance directory is not in the default location (i.e., the main tc Server installation directory).

For example, if the full instance directory of a tc Runtime instance is /home/tcserver/instances/myserver, then you would specify /home/tcserver/instances for this option.

The default value of this option is the current working directory.


The following example shows how to stop the tc Runtime instance called myserver after waiting for up to 60 seconds:

prompt$ cd /home/tcserver/vfabric-tc-server-standard/myserver/bin
prompt$ ./tcruntime-ctl.sh stop 60

In the following example, use of the -n option indicates that the tc Runtime instance called myotherinstance has an instance directory of /home/tcserver/instances/myotherinstance. The example shows how to use the tcruntime-ctl script located in the main tc Server installation directory.

prompt$ cd /home/tcserver/vfabric-tc-server-standard
prompt$ ./tcruntime-ctl.sh myotherinstance stop 60 -n /home/tcserver/instances

Windows: Setting the Logon-as-Service Right for a Windows User

The tcruntime-ctl.bat install command has an optional run-as-user parameter by which you specify the user account that you want the tc Runtime service to run as when you start the service from the Windows Service console. Windows requires that the specified user account must have their Logon as Service right set for this feature to work properly. To set this right:

  1. From the Windows Start menu, open the Control Panel.

  2. Open Administrative Tools.

  3. Open the Local Security Policy tool.

  4. Expand the Local Policies settings.

  5. Click the User Rights Assignment.

  6. On the right side, double-click on the Log on as a service policy.

  7. Click on the Add User Or Group button and enter the user account name using the wizard.

The Local Security Policy tool does not appear to be available on Home versions of Windows 2000 and XP. It is thus not possible to run the tc Runtime service as a specific account under those versions of Windows.

7.3 Windows: Installing the HQ Server and Agents as Windows Services

SpringSource recommends that you install both the HQ Server and all HQ Agents as Windows Services, and then start and stop them from the Service console. This section describes how to install both components. See Starting and Stopping the HQ Server and Agents for details about starting and stopping the HQ Server and Agents, particularly when starting the HQ Agent for the first time.

To install the HQ Server as a Windows Service:

  1. Open a Command Prompt window.

  2. Change to the HQ_SERVER_INSTALL_DIR\bin directory, where HQ_SERVER_INSTALL_DIR refers to the directory in which you installed the HQ Server, such as c:\home\hyperic\server-4.5.X.X-EE\bin:

    prompt> cd c:\home\hyperic\server-4.5.X.X-EE\bin
  3. To install the HQ Server as a Windows Service:

    prompt> hq-server.exe -i 

    After a few status messages, you will see a Done. message when installation is complete.

    The command installs the HQ Server as an automatic Windows Service, which means that the server starts automatically when you start the Windows computer. You can change this behavior through the Windows Service control panel.

    Now, and subsequently, start (and stop) the HQ Server using the Windows Service control panel. The HQ Server is listed as Hyperic HQ Server.

  4. To uninstall the Windows service:

    prompt> hq-server.exe -u

    You will see a Removing 'Hyperic HQ Server' Service ... Done upon completion.

To install the HQ Agent as a Windows Service:

  1. Start a Command Prompt window.

  2. If you have not already done so, set the HQ_JAVA_HOME system environment variable to point to the location of your JDK or JRE. Set it as a system environment variable; if you set it as a user environment variable, the HQ Agent aborts on startup.

  3. Change to the HQ_AGENT_INSTALL_DIR\bin directory, where HQ_AGENT_INSTALL_DIR refers to the directory in which you installed the HQ Agent, such as c:\home\hyperic\agent-4.5.X.X-EE\bin:

    prompt> cd c:\home\hyperic\agent-4.5.X.X-EE\bin
  4. To install the HQ Agent as a Windows service:

    prompt> hq-agent.bat install

    You see a Hyperic HQ Agent installed. message upon completion.

    The preceding command installs the HQ Agent as an automatic Windows Service, which means that the agent starts automatically when you start the Windows computer. You can change this behavior using the Windows Service control panel.

    If you are starting the HQ Agent for the first time, see the procedure for starting the HQ Agents for further instructions. Subsequently, start (and stop) the HQ Agent using the Windows Service control panel. The HQ Server is listed as Hyperic HQ Server.

  5. To remove (uninstall) the Windows service:

    prompt> hq-agent.bat remove

    You will see a Hyperic HQ Agent removed. message upon completion.

7.4 Starting and Stopping the HQ Server and Agents

This section describes how to control the HQ Server and Agents, specifically starting and stopping them.

On Unix platforms, you always use shell scripts to start and stop the HQ Server and HQ Agent. On Windows, it is recommended that you first install both the server and agents as Windows Services, and subsequently use the Windows Services console to start and stop them. Using the Windows Services console, you can also specify whether the HQ Server and Agent should start automatically when the operating system itself starts. The section below describes how to install the server and agents as Windows services.

Depending on how you have configured all the components of tc Server (tc Runtime, HQ Server and HQ Agents), you might run the commands to start and stop the HQ Agent and Server on the same computer or on different computers.

[Note]Note

This section provides basic information about starting and stopping the HQ Server and Agent, just enough to get you up and running. For additional detailed information, see Hyperic documentation links:

Unix: Starting and Stopping the HQ Server and Agent

To start and stop the HQ Server:

  1. Open a new terminal window.

  2. Change to the HQ_SERVER_INSTALL_DIR/bin directory, where HQ_SERVER_INSTALL_DIR refers to the directory in which you installed the HQ Server, such as /home/hyperic/server-4.5.X.X-EE. For example:

    prompt$ cd /home/hyperic/server-4.5.X.X-EE/bin
  3. To start the HQ Server:

    prompt$ ./hq-server.sh start

    The script displays Starting HQ Server... and then the shell/Command Prompt on success.

  4. To stop the HQ Server:

    prompt$ ./hq-server.sh stop

    The server is fully stopped when you see the message Stopped HQ Server.

See the HQ_SERVER_INSTALL_DIR/logs/server.log for details about the starting or stopping of the HQ Server.

To start and stop the HQ Agent:

  1. Start a new terminal window.

  2. Change to the HQ_AGENT_INSTALL_DIR/bin directory, where HQ_AGENT_INSTALL_DIR refers to the directory in which you installed the HQ Agent, such as /home/hyperic/agent-4.5.X.X-EE. For example:

    prompt$ cd /home/hyperic/agent-4.5.X.X-EE/bin
  3. To start the HQ Agent, execute the following command:

    prompt$ ./hq-agent.sh start

    The script displays Starting HQ Agent... and then the shell/Command Prompt on success.

    [Important]Important

    The first time you start the agent, the script requests information about the HQ Server to which it will communicate; this is a one-time event and subsequent starts of the agent do not require this input. See the table in the Configure Agent-Server Communication Interactively section of the Hyperic documentation for information about these prompts.

  4. To stop the HQ Agent, execute the following command:

    prompt$ ./hq-agent.sh stop

    The agent is fully stopped when you see the message Stopped HQ Agent.

See the HQ_AGENT_INSTALL_DIR/log/agent.log for details about the starting or stopping of the HQ Agent.

Windows: Starting and Stopping the HQ Server and Agent

To start and stop the HQ Server:

  1. If you have not already done so, install the HQ Server as a Windows Service, as described in Installing the HQ Server and Agents as Windows Services.

  2. Start (and stop) the HQ Server using the Windows Service control panel. The HQ Server is listed as Hyperic HQ Server.

See the HQ_SERVER_INSTALL_DIR\logs\server.log for details about the starting or stopping of the HQ Server.

To start and stop the HQ Agent:

  1. If you have not already done so, install the HQ Agent as a Windows Service, as described in Installing the HQ Server and Agents as Windows Services.

  2. If this is the first time you start the HQ Agent after installing it, start a Command Prompt window and continue with this procedure.

    Otherwise, use the Windows Service console to start (and stop) the HQ Agent. The HQ Agent is listed as the Hyperic HQ Agent.

  3. If you have not already done so, set the HQ_JAVA_HOME system environment variable to point to the location of your JDK or JRE. Note that you are required to set it as a system environment variable; if you set it as a user environment variable, the HQ Agent will abort on startup.

  4. Change to the HQ_AGENT_INSTALL_DIR\bin directory, where HQ_AGENT_INSTALL_DIR refers to the directory in which you installed the HQ Agent, for example c:\home\hyperic\agent-4.5.X.X-EE. For example:

    prompt> cd c:\home\hyperic\agent-4.5.X.X-EE\bin 
  5. The first time you start the HQ Agent, you must start it from the command line:

    prompt> hq-agent.bat start 

    The command requests information about the HQ Server to which it will communicate; this is a one-time event and subsequent starts of the HQ Agent do not require this input. See the table in the Configure Agent-Server Communication Interactively section of the Hyperic documentation for information about these prompts.

  6. Subsequently, start (and stop) the HQ Agent using the Windows Service console. The HQ Agent is listed as the Hyperic HQ Agent.

See the HQ_AGENT_INSTALL_DIR\log\agent.log for details about the starting or stopping of the HQ Agent.

7.5 Getting Started with the HQ User Interface

After you install and start the HQ Server and all the agents on all computers that host tc Runtime instances, you invoke the HQ user interface in your browser so that you can start using it to monitor and configure tc Runtime instances, as well as other resources.

The following procedure describes how to access the HQ user interface, add a tc Runtime instance to the HQ inventory, and update the tc Runtime instance JMX configuration properties so that HQ can manage them.

  1. Invoke the HQ user interface in your browser:

    http://host:port 

    where:

    • host is the computer on which you installed the HQ Server. If your browser is running on the same computer as the HQ Server, you can use localhost or 127.0.0.1.

    • port is the TCP/IP listen port of the HQ Server, specified when you installed the server. The default value is 7080.

      The TCP/IP listen port is configured in the HQ_SERVER/conf/hq-server.conf file, where HQ_SERVER is the directory in which you installed the HQ Server. If the default listen port does not work, search this file for the actual value of the server.webapp.port property.

    For example, use the following URL if HQ server is running locally using the default listen port:

    http://localhost:7080
  2. At the login screen, enter the administrator login. The default username is hqadmin, with password hqadmin.

    The server administrator username and password are configured in the HQ_SERVER/data/hq-server-install.conf file, where HQ_SERVER is the directory in which you installed the HQ Server. If the default values do not work, search this file for the actual values of the server.admin.username and server.admin.password properties.

    Important: As is true for all default passwords, be sure to change it as soon as possible to ensure maximum security for your installation.

  3. Select a default dashboard for the administration user; this selection affects only the appearance of the HQ user interface, not its functionality. SpringSource recommends you select hqadmin then click OK. You can change the default dashboard after you log in.

  4. The following graphic displays the main HQ dashboard. Highlighted objects are ones that you always use or use when you get started; see the explanation for each object after the graphic.

    • The two Dashboard links return you to this main dashboard console page.

    • The Resources link allows you to browse the full set of resources known by HQ, quickly scan the resources that are currently down, or easily go to the resources you have most recently viewed.

    • The Auto-Discovery Portlet shows resources that HQ has auto-discovered but you have not yet worked with (either adding them to the HQ inventory or skipping them). For example, if you start a tc Runtime instance before logging into HQ, then the instance automatically shows up in the auto-discovery portlet. In the next step you will add these resources to HQ's inventory.

      The HQ UI itself uses a tc Runtime internally called hq-server, which is also listed in the Auto-Discovery portlet.

    • The Help button provides context-sensitive online help, with useful information about what tasks you can perform on each HQ user interface page.

  5. Import your operating system platform, the tc Runtime instance, and other resources running on the platform into the HQ inventory by selecting the appropriate radio buttons next to the resource in the Auto-Discovery portlet and clicking Add to Inventory, as shown in the following graphic.

    The tc Runtime instance shows up as platform-resource tc Runtime catalina-base-dir in the HQ user interface, where platform-resource refers to the computer on which the instance is running and catalina-base-dir refers to the CATALINA_BASE directory of the tc Runtime instance without the leading directory pathnames. For example: my-desktop tc Runtime myserver. The HQ Agent might also show up in the auto-discovery portlet, listed as HQ Agent 4.5.X.X-EE.

    Because of the auto-discovery feature of HQ, your operating system platform should automatically show up in the Auto-Discovery portlet on the main Dashboard screen of the HQ user interface. Other resources running on the operating system, such as other tc Runtime instances, will also show up in the portlet. This is true for all computers running HQ agents that communicate with this HQ Server.

    [Tip]Tip

    It can sometimes take a few minutes for a newly-started resource, such as the tc Runtime instance, to show up in the auto-discovery portlet.

    After you click Add to Inventory, selected resources show up in the Recently Added portlet of the main Dashboard.

  6. Click the Resources > Browse link at the top of the HQ user interface.

    This brings you to a console page from which you can view all the resources in the HQ inventory. You view the tc Runtime instances by clicking on the Servers (X) link, as shown:

  7. Click the Servers (X) link. A list of all the servers in your inventory appears in the table. The tc Runtime instances are listed as platform-resource tc Runtime catalina-base-dir.

  8. In the table, click on the tc Runtime instance you just added to the HQ inventory, as shown in the preceding graphic.

    HQ displays the configuration and management pages of a tc Runtime instance, as shown in the next graphic and ensuing explanation.

    • Monitor tab. Displays monitoring information about a tc Runtime instance and its services, such as the deadlocks detected, available heap memory, and so on. The charts show either graphical or tabular data about the metrics; click Indicators or Metric Data to view each kind of data. Click a particular service in the Services table to view diagnostic information about that particular service that is associated with the tc Runtime instance.

    • Inventory tab. View and manage the tc Runtime instance's general properties, the services hosted by the server, groups containing the server, and the server's monitoring and control configuration.

    • Alert tab. View, configure, and create alerts for a tc Runtime instance.

    • Control tab. Start, stop, and restart this tc Runtime instance, as well as schedule one of these actions for a future date.

    • Views tab. Has two subtabs: Server Configuration and Application Management. Use the Server Configuration tab to configure the tc Runtime instance, such as startup JVM parameters, JSP behavior, and properties of the Catalina service, such as connectors and engines. The application deployment tab allows you to deploy Web applications to the tc Runtime instance, as well as start, stop, reload, and undeploy already deployed Web applications.

  9. Click the Inventory tab.

  10. Scroll down to the Configuration Properties section.

    The HQ user interface uses the values of the fields in this section to connect to the tc Runtime instance, control it, and so on. In particular, the Shared section specifies the JMX properties of the tc Runtime instance; HQ uses JMX to configure and manage tc Runtime instances.

    [Important]Important

    If you have not changed the JMX values in server.xml, HQ will populate these fields automatically, so the tc Runtime instance should work with HQ without change. However, if you have changed the JMX values of your tc Runtime instance by manually updating its server.xml file, then you must change the corresponding fields in the HQ user interface, as described in the following procedure.

    1. Click Edit.

    2. Update the following fields as required:

      • jmx.url: URL that the HQ user interface uses to connect to the JMX server associated with the tc Runtime instance. The format is service:jmx:rmi:///jndi/rmi://host:jmxport/jmxrmi. Be sure the value of host is the name of the computer on which the JMX server is running (you can use localhost if it is the same as the computer hosting HQ server) and that the value of jmxport is the value of the port attribute of the <Listener> element in the tc Runtime instance's server.xml file that corresponds to the com.springsource.tcserver.serviceability.rmi.JmxSocketListener class (default value is 6969).

      • jmx.username: JMX username that HQ uses to connect to the JMX server associated with the tc Runtime instance. The username is stored in the file pointed to by the passwordFile attribute of the <Listener> element in the tc Runtime instance's server.xml file that corresponds to the com.springsource.tcserver.serviceability.rmi.JmxSocketListener class; by default, the name of this file is CATALINA_BASE/conf/jmxremote.password. The default username is admin.

      • jmx.password: Password of jmx.username. The password is stored in the same file as the username, as described in the preceding bullet. The default password is springsource.

    3. Click OK.

You are now ready to monitor and configure the tc Runtime instance using Hyperic HQ. For a tutorial that describes how to perform common management and configuration tasks using HQ, see Tutorial: Using HQ to Configure and Manage tc Runtime Instances.

For detailed conceptual and task information about using HQ, click the Help button on the HQ user interface or consult the vFabric HQ Documentation.

7.6 Deploying Applications to tc Runtime Instances

Deployment refers to the process of installing a Web application into the tc Runtime instance. This section describes two ways to deploy Web applications to the tc Runtime instance.

  • Static deployment: To deploy statically, you simply copy your Web application, either as a packaged WAR file or as an uncompressed directory (also called exploded), to the deployment directory of the tc Runtime instance. This directory is specified by the appBase property of your virtual host; the default value is CATALINA_BASE/webapps. Assuming that the autoDeploy property of your host is enabled (default value), then as soon as you copy your Web application to the deployment directory, the tc Runtime instance deploys and starts it, and users can immediately start using the application. See the procedure below for details.

  • Dynamic deployment using HQ: The HQ user interface is a sophisticated GUI console with which you can deploy Web applications located on local or remote computers. You can also create groups of tc Runtime instances and then deploy a WAR file to the group; the HQ user interface then takes care of deploying the WAR file to each individual member of the group. This feature helps you avoid having to deploy to each tc Runtime instance individually, saving you much time if you have many servers in your environment.

    See Tutorial: Using HQ to Configure and Manage tc Runtime Instances for a tutorial that describes how to deploy applications to single tc Runtime instances, create tc Runtime groups, and deploy an application to the group.

It is assumed in this section that you have already created a Web application and want to deploy it to a tc Runtime instance so you can start using the application. If you do not have a Web application, see Tutorial: Very Simple Web Application Development for a tutorial that describes how to create a very simple HelloWorld application.

To deploy a Web application statically: Copy the WAR or exploded directory to the deployment directory, which by default is CATALINA_BASE/webapps. For example, if your CATALINA_BASE variable is /home/tcserver/vfabric-tc-server-standard/myserver, and your Web application is the exploded directory /home/apps/myApp, then you deploy it statically with the following command:

prompt$ cp /home/apps/myApp /home/tcserver/vfabric-tc-server-standard/myserver/webapps

If you want to use a different deployment directory than the default CATALINA_BASE/webapps, set the appBase attribute of the <Host> element that configures the virtual host for your tc Runtime instance. For additional details about static deployment, see Tomcat Web Application Deployment.

Deploying Applications Using Tomcat Manager (Developer Edition Only)

The tc Server Developer Edition includes Tomcat Manager, an Apache Web application that you can use to deploy your own Web applications and manage their lifecyle, such as starting, stopping, and undeploying them.

The default tc Server Developer Edition configuration does not automatically authorize any user to access Tomcat Manager. The following procedure describes how to authorize a user to access the application, and then how to invoke the Web application in your browser.

  1. Update the CATALINA_BASE/conf/tomcat-users.xml file in the tc Runtime instance by adding a manager role.

    The default tomcat-users.xml file does not include any roles or users, although examples are shown in comments.

    An entry for the manager role looks like this:

    <tomcat-users>
      <role rolename="manager" />
      ...
    </tomcat-users>
  2. In the same file, add a user with role manager. For example, to specify that the tomcat user (with password tomcat) have the manager role, add the <user> element to the tomcat-users.xml file, as follows:

    <tomcat-users>
      <role rolename="manager" />
      <user username="tomcat" password="tomcat" roles="manager" />
    </tomcat-users>
  3. Restart the tc Runtime instance for the changes to take effect.

  4. Invoke Tomcat Manager in your browser using the following URL:

    http://host:8080/manager/html

    where host refers to the computer running the tc Runtime instance.

  5. Enter the user and password you configured in the tomcat-users.xml file, in our example tomcat/tomcat.

The Applications table lists the currently deployed applications. Click the links in the Path column to actually invoke each application. The Commands column includes buttons for starting, stopping, reloading, and undeploying the applications.

From the Deploy section, you can deploy Web applications (either exploded or in a WAR format) from either the host where running the tc Runtime instance or from the local computer running your browser. When deploying from the host, you must specify the context path that users use to invoke the application.

For detailed information about Tomcat Manager, see the Manager App How-To on the Apache Tomcat Web site.

Deploying Multiple Versions of the Same Application

When you create an instance using tc Runtime 7, you can deploy multiple versions of the same web application. This makes it possible to upgrade applications without interruption. Users who have a session in process continue to use the existing version of the application, but new sessions use the latest version of the application.

To deploy a new version of an existing application using static deployment, append a version number to the context name, separated by two hash signs: contextName##version. For example, if you have already statically deployed a WAR file named myapp.war and you want to upgrade to version 2.0, you can deploy the new WAR file myapp##02.0.war.

If you use the Hyperic HQ user interface to deploy a new version, do not rename the WAR file. The tc Server HQ plug-in automatically appends the version number for you.

Users continue to use the same URL to access the application; they do not include the version number. New sessions use the highest version deployed. Existing sessions continue to use the version that is already managing their session. If tc Runtime cannot locate the session in the SessionManager of an earlier version, the newest version is used.

The version number is processed as a string, not as a number. This means that you can use letters in the version number, for example myapp##02b. It also means that you must be careful to ensure that your version numbers compare correctly. If the current version is myapp##9.0, deploying myapp##10.0 will not work as expected because the string "9.0" sorts higher than "10.0".

When all sessions using an earlier version of an application have ended, the older version can be undeployed.

7.7 Uninstalling tc Server: Typical Steps

Uninstall one or more of these components as you wish:

Uninstallation of tc Server mostly entails removing the directories that contain the component files, although a few extra steps might be required, as described below.

Each section covers both Unix and Windows commands. The documentation uses Unix-like forward slashes (/) for directories; if you are on a Windows platform, change these to back slashes (\).

WARNING: The procedures in this section describe how to completely remove the components of tc Server from your computer.

Uninstalling HQ Server

To uninstall the HQ Server component of tc Server:

  1. Start a terminal window (Unix) or Command Prompt (Windows).

  2. If currently running, stop the HQ Server. See Starting and Stopping the HQ Server and Agents.

  3. Windows only. If you installed the HQ Server as a Windows service, change to the HQ_SERVER_INSTALL_DIR\bin directory (where HQ_SERVER_INSTALL_DIR refers to the directory in which you installed the HQ Server, such as c:\home\hyperic\server-4.5.X.X-EE) and uninstall the service using the following command:

    prompt> cd:\home\hyperic\server-4.5.X.X-EE\bin 
    prompt> hq-server.exe -u
  4. Remove the directory in which you installed the HQ Server, such as /home/hyperic/server-4.5.X.X-EE:

    prompt$ cd /home/hyperic
    prompt$ rm -rf server-4.5.X.X-EE

Uninstalling HQ Agent

To uninstall the HQ Agent component of tc Server:

  1. If the agent itself is managed by HQ, remove the platform for the agent using the HQ user interface.

  2. Start a terminal window (Unix) or Command Prompt (Windows).

  3. If currently running, stop the HQ Agent. See Starting and Stopping the HQ Server and Agents.

  4. Windows only. If you installed the HQ Agent as a Windows service, you should now uninstall it. Change to the HQ_AGENT_INSTALL_DIR\bin directory, where HQ_AGENT_INSTALL_DIR refers to the directory in which you installed the HQ Agent, such as c:\home\hyperic\agent-4.5.X.X-EE. Once in this directory, uninstall the service using the hq-agent.bat remove command. For example:

    prompt> cd c:\home\hyperic\agent-4.5.X.X-EE\bin
    prompt> hq-agent.bat remove
  5. Remove the directory in which you installed the HQ Agent. For example:

    prompt$ cd /home/hyperic
    prompt$ rm -rf agent-4.5.X.X-EE

Uninstalling tc Runtime

The following procedure describes how to uninstall the tc Runtime and all its associated instances.

  1. If currently running, stop all tc Runtime instances. See Starting and Stopping tc Runtime Instances.

  2. Start a terminal window (Unix) or Command Prompt (Windows).

  3. Windows only. If you installed any tc Runtime instances as Windows services, change to the CATALINA_BASE\bin directory of each instance (such as c:\home\tcserver\vfabric-tc-server-standard\myserver\bin) and uninstall the service using the following command:

    prompt> c:\home\tcserver\vfabric-tc-server-standard\myserver\bin
    prompt> tcruntime-ctl.bat uninstall
  4. Remove the main tc Server installation directory. For example, if you installed Standard Edition, the delete command might look something like the following:

    prompt$ rm -rf /home/tcserver/vfabric-tc-server-standard

    By default, the home directory of all tc Runtime instances is under the main tc Server installation directory; if you used this default location when you created the tc Runtime instances with the tcruntime-instance script, then the preceding delete command also deleted all tc Runtime instances.

  5. If you created any tc Runtime instances in locations other than the default tc Server installation directory, remove their corresponding home directories.

8. Upgrade and Migration Guide

This chapter describes how to perform the following supported upgrade procedures:

8.1 Upgrading a 2.0.X or 2.1.X tc Server Installation to 2.5

This section describes how to upgrade an existing 2.0.X or 2.1.X tc Server installation to tc Server 2.5.X. The upgrade procedure includes the following tasks:

Upgrade HQ Server to Hyperic 4.5

If you are using an older version of Hyperic HQ Server, Hyperic 4.5 HQ Server includes new features and support for new releases of supported resources. To take advantage of these improvements in Hyperic 4.5, upgrade HQ Server on the computer where it is installed. The Hyperic 4.5 setup has an upgrade mode that updates an existing HQ Server installation. For complete instructions, see the vFabric Hyperic Documentation website.

Install HQ Agent 4.5

After you have upgraded HQ Server to Hyperic 4.5, you can use the HQ user interface to upgrade HQ Agents on computers with tc Runtime instances. Follow the instructions to upgrade Hyperic components on the Hyperic Documentation website.

Install tc Server 2.5

Install tc Server 2.5 in a new installation directory and create any new tc Runtime instances you want. Follow the instructions at Installing tc Server to perform the installation. To avoid overwriting files, be sure to install tc Server 2.5 in a different directory than your current installation. For example, if you have installed tc Server 2.1 in the directory /home/tcserver/springsource-tc-server-2.1, you can install vFabric tc Server 2.5 in the directory /home/tcserver/vfabric-tc-server-2.5.

Upgrade Existing tc Runtime Instances to 2.5

Use the tcruntime-instance.sh|bat upgrade command to upgrade your tc Server 2.0 or 2.1 runtime instances to tc Server 2.5. The upgrade command, new in tc Server 2.5, migrates configuration information and applications from an existing instance to a new 2.5 instance.

By default, the upgrade command creates a new instance that uses the same version of tc Runtime as the current instance. If you want to keep the same tc Runtime version, you must ensure that the corresponding tc Runtime release exists in your tc Server 2.5 installation directory. Otherwise, the upgrade command will display an error message and quit. If necessary, copy the tc Runtime release directory from the previous tc Server installation directory into the tc Server 2.5 installation directory.

The script creates the upgraded instances in your tc Server 2.5 installation directory. For example, to upgrade the tc Server 2.1 instance at /home/tcserver/springsource-tc-server-2.1/myInstance, enter the following command in your tc Server 2.5 directory:

prompt$ ./tcruntime-instance.sh ../springsource-tc-server-2.1/myInstance upgrade

This command creates an upgraded instance with the same name as the original (myInstance) using the same version of tc Runtime.

To change the name of the upgraded instance, include the -i instanceDir option on the command.

To specify a different tc Runtime version, include the -v version option. When upgrading an unpinned instance, you must specify this option. The following example specifies a new instance name and pins the instance to tc Runtime release 7.0.6.A.RELEASE.

prompt$ ./tcruntime-instance.sh ../springsource-tc-server-2.1/myInstance upgrade 
   -i myNewInstance -v 7.0.6.A.RELEASE

See tcruntime-instance.sh Reference for more information about using this command.

8.2 Upgrading a 2.5.X tc Runtime to the Latest Version

The procedure in this section describes how to upgrade a tc Runtime installation (such as 2.5.0) to a later version (such as 2.5.1). The instructions assume your existing tc Runtime environment is the result of following the Quick Start instructions

[Note]Note

This section does not describe in detail how to upgrade your existing Hyperic components because those tasks follow the standard Hyperic upgrade procedures.

[Important]Important

You can follow the instructions in the section to upgrade a tc Runtime 2.5.X release to a later 2.5.X release. If you want to upgrade from an earlier release, for example from 2.1.X to 2.5.X, follow the instructions at Upgrading a 2.1.x tc Server Installation to 2.5.

Understanding the Overall tc Server Upgrade Process

Upgrading a 2.5.X tc Server installation to a later version consists of the following subtasks:

  • Optionally upgrade your existing HQ Server and Agent to a later version than you have currently installed. See the Release Notes for the fully-qualified version of the HQ Server and Agent that a particular version of tc Server supports. The release notes also indicate the version of HQ that contains a particular version of the tc Server HQ plug-in.

    To perform this subtask, you download the HQ EE distribution and use its setup.sh -upgrade (Unix) or setup.bat -upgrade (Windows) command script to perform the upgrade. To upgrade an existing HQ Agent, unzip the latest version alongside the existing one.

    For details, see Upgrade HQ Components.

  • Install the new 2.5.X tc Runtime in a new directory.

    To perform this subtask, unzip the appropriate tc Server distribution into a newly created installation directory. Then, if required, use the tcruntime-instance.sh upgrade command to upgrade each tc Runtime instance.

    For details, see the next section.

Depending on how you have configured your tc Server installation, you might perform different subtasks on different computers. For example, on the computer on which you have installed the HQ Agent and runtime component (called a managed node), you perform only the Agent and Runtime upgrade. On the computer on which you installed the HQ Server (and nothing else), you perform only the HQ Server upgrade. If you installed all components on the same computer, then simply execute all subtasks on the same computer.

Most of the examples in this section use Unix syntax; if you are upgrading on Windows, change the forward slashes to back-slashes and replace the *.sh suffix with *.bat when running a command script. Other changes between the two platforms are called out.

tc Runtime Upgrade Procedure

The examples in this procedure assume you are upgrading a 2.5.0 tc Runtime to version 2.5.1 (unless otherwise noted.) The procedure describes only how to upgrade the tc Runtime and associated instances; for information about upgrading the Hyperic components, see Upgrade Hyperic Components.

To upgrade your 2.5.X tc Runtime to a later 2.5.X version, follow these steps:

  1. Unix only: Read Important Note When Installing on Unix Platforms to ensure your tar command works with tc Server bundles.

  2. Back up your existing tc Runtime installation, including all your tc Runtime instances.

  3. Start a terminal (Unix) or Command Prompt (Windows).

  4. If they are running, stop your tc Runtime instances. For example, if you installed tc Runtime in /home/tcserver/vfabric-tc-server-standard-2.5.0-RELEASE and you have a tc Runtime instance called myserver:

    prompt$ cd /home/tcserver/vfabric-tc-server-standard-2.5.0-RELEASE
    prompt$ ./tcruntime-ctl.sh myserver stop

    If your tc Runtime instance is located in a directory other than the main tc Server installation directory, use the INSTANCE-DIR/bin/tcruntime-ctl.sh script to stop the instance; in this case, you do not specify the name of the instance as a parameter to the script. For example:

    prompt$ cd /home/tcserver/instances/myserver/bin
    prompt$ ./tcruntime-ctl.sh stop
  5. Windows only. If you installed the tc Runtime instances as Windows services, uninstall them. For example, if you installed the runtime in c:\home\tcserver\vfabric-tc-server-standard-2.5.0-RELEASE and you created a tc Runtime instance called myserver:

    prompt> cd c:\home\tcserver\vfabric-tc-server-standard-2.5.0-RELEASE
    prompt> tcruntime-ctl.bat myserver uninstall

    If your tc Runtime instance is located in a directory other than the main tc Server installation directory, use the INSTANCE-DIR\bin\tcruntime-ctl.bat script to stop the instance; in this case, you do not specify the name of the instance as a parameter to the script. For example:

    prompt> cd c:\home\tcserver\instances\myserver\bin
    prompt> tcruntime-ctl.bat uninstall

    See Windows: Starting and Stopping tc Runtime Instances as Windows Services.

  6. Download the appropriate tc Server distribution file from the VMware Download Center.

    Typically, you download the Standard Edition of tc Server in either the compressed TAR or ZIP format; for example:

    • vfabric-tc-server-standard-2.5.1.RELEASE.tar.gz

    • vfabric-tc-server-standard-2.5.1.RELEASE.zip

  7. Unzip or untar the new 2.5.X package into a new directory, parallel to your existing tc Server installation. For example, if your existing tc Server is installed in /home/tcserver/vfabric-tc-server-standard-2.5.0-RELEASE and you downloaded the new package into the /home/Downloads directory:

    prompt$ cd /home/tcserver
    prompt$ unzip /home/Downloads/vfabric-tc-server-standard-2.5.1.RELEASE.zip

    The preceding command creates a new directory alongside the existing tc Server installation directory.

  8. Upgrading tc Runtime instances. This step describes how to upgrade your existing tc Runtime instances to the new version. From your terminal (Unix) or Command Prompt (Windows), change to the new tc Server installation directory. For example:

    prompt$ cd /home/tcserver/vfabric-tc-server-standard-2.5.1.RELEASE

    For each existing tc Runtime instance you want to upgrade, run the following command:

    prompt$ ./tcruntime-instance.sh upgrade instance --instance-directory instanceDir 

    where:

    • instance refers to the name of the subdirectory that contains the tc Runtime instance you want to upgrade, such as myserver

    • instanceDir refers to the full or relative pathname of the directory in which the instance lives.

    For example, to upgrade an instance named myserver from tc Server 2.5.0 to tc Server 2.5.1, issue these commands:

    prompt$ cd /home/tcserver/vfabric/tc-server-standard-2.5.1-RELEASE
    prompt$ ./tcruntime-instance.sh upgrade myserver --instance-directory \
        ../tc-server-standard-2.5.0-RELEASE

    Because you do not specify a specific tc Runtime version, the tcruntime-instance.sh|bat script pins the instance to the latest version of tc Runtime it can find when it starts. Generally, this is the tc Runtime version bundled with the new tc Server distribution you are installing. The upgrade command cannot change the major tc Runtime version (tc Runtime 6 or tc Runtime 7), but it will upgrade the instance to the latest minor version available in the tc Server installation directory.

  9. Start the tc Runtime instances as described in Starting and Stopping tc Runtime Instances. The startup messages should indicate that the instance is now using the latest tc Runtime version (such as 6.0.32.A) as its core. For example:

    prompt$ cd /home/tcserver/vfabric-tc-server-standard-2.5.1-RELEASE
    prompt$ ./tcruntime-ctl.sh myserver start
    
    INFO Instance name:      myserver
    INFO Script directory:   /home/tcserver/vfabric-tc-server-standard-2.5.1-RELEASE
    INFO tc Runtime location:/home/tcserver/vfabric-tc-server-standard-2.5.1-RELEASE
    INFO Instance base:      /home/tcserver/vfabric-tc-server-standard-2.5.1-RELEASE
    INFO Binary dir:         /home/tcserver/vfabric-tc-server-standard-2.5.1-RELEASE/tomcat-6.0.32.A.RELEASE
    INFO Runtime version:    6.0.32.A.RELEASE
    INFO Script version:     2.5.1.RELEASE
    Using CATALINA_BASE:   /home/tcserver/vfabric-tc-server-standard-2.5.1-RELEASE/myserver
    Using CATALINA_HOME:   /home/tcserver/vfabric-tc-server-standard-2.5.1-RELEASE/tomcat-6.0.32.A.RELEASE
    Using CATALINA_TMPDIR: /home/tcserver/vfabric-tc-server-standard-2.5.1-RELEASE/myserver/temp
    Using JRE_HOME:        /home/java/jdk1.6.0_24
    Using CLASSPATH:       /home/tcserver/vfabric-tc-server-standard-2.5.1-RELEASE/myserver/bin/tomcat-juli.jar:
        /home/tcserver/vfabric-tc-server-standard-2.5.1-RELEASE/tomcat-6.0.32.A.RELEASE/bin/bootstrap.jar

When you complete this procedure, you will have successfully upgraded your existing 2.5.X tc Runtime to a later version of 2.5.

9. Tutorial: Using HQ to Configure and Manage tc Runtime Instances

This tutorial describes the basic steps for configuring and monitoring a tc Runtime instance with the HQ user interface and for managing applications deployed to the instance.

9.1 Before You Begin

Install and start the components of vFabric tc Server (HQ Server, HQ Agent, and at least one tc Runtime instance); invoke the HQ user interface in your browser; and log in with the administration username/password (default hqadmin/hqadmin) or with HQ user permissions to configure a tc Runtime instance. To accomplish these tasks, see:

Most HQ user interface pages have a Help link at the top-right corner. On the tc Runtime configuration pages, click the icon

to the right of each field to get information about the field.

For simplicity, it is assumed in this tutorial that you are going to log in to the HQ user interface as the superuser (hqadmin). If, however, you are going to log in as a non-superuser, see "User Permissions Required to Use the tc Server HQ Plugin Features" in tc Server Administration Guide for information about the required HQ user permissions to be able to use all the tc Server HQ plug-in features described in this tutorial.

9.2 Restart a tc Runtime Instance

In this procedure you restart a currently running tc Runtime instance. If you need navigational help for the first few steps, see Getting Started with the HQ user interface.

  1. Click the Resources > Browse link at the top of the HQ user interface

  2. Click the Servers (X) link to see the list of servers known by HQ. To limit the number of displayed servers to only tc Runtime instances, select SpringSource tc Runtime 6.0 or SpringSource tc Runtime 7.0 from the Search drop-down list, then click the green arrow to the far right.

  3. In the table, click the tc Runtime instance you want to restart. The server is listed as platform-resource tc Runtime catalina-base-dir, where

    • platform-resource is the computer hosting the tc Runtime instance.

    • catalina-base-dir is the CATALINA_BASE directory of the tc Runtime instance without the leading directory pathnames, such as myserver.

  4. Click the Control tab. You use this HQ user interface page to stop, start, and restart the current tc Runtime instance, as described in the next step.

  5. In the Quick Control section of the page, select Restart from the Control Action drop-down list, then click the arrow to the right (, as shown in the following graphic.

    After you click the restart button, the Command State field in the Current Status section says In progress until the tc Runtime instance is successfully restarted. The Current Status section always displays information about the last control action; in this case the restart of the tc Runtime instance.

9.3 Reconfigure a tc Runtime Instance

In this procedure you make a few simple configuration changes to the current tc Runtime instance. You change a startup-up JVM option (maximum heap size) and change the working directory of the default virtual host for the tc Runtime instance.

It is assumed in this procedure that you have already browsed to the tc Runtime instance that you want to configure, as described in Restart a tc Runtime Instance.

  1. Click the Views > Server Configuration tab:

    The server configuration pages consist of four tabs:

    • Home: Main Server Configuration page.

      There is also an Advanced group for performing more advanced tasks, such as reloading the settings from the tc Runtime instance server.xml file (in which you lose local changes made with the HQ user interface), reverting to a previous server configuration, and uploading a new server configuration using a server.xml file.

    • Configuration: Configure tc Runtime startup options, JVM options, context information for all deployed Web applications, default behavior of JSPs and static content, and so on.

    • Resources: Create and configure JDBC datasources.

    • Services: Create and configure tc Runtime services such as virtual hosts, connectors, and so on.

  2. Click the Configuration tab, then the Server Start option in the list on the left.

  3. In the General section on the right, enter 1024 in the Max Heap Size (MB) field.

  4. Click Save at the bottom of the page.

    The message Configuration saved successfully appears at the top, as shown in the following graphic. This means that HQ has updated its in-memory cache with your changes. Additionally, a box appears at the top of the page with the heading Changes have been made locally, along with two links to either write (push) the changes to the actual tc Runtime configuration files, such as CATALINA_HOME/bin/setenv.sh (in this case) or CATALINA_BASE/conf/server.xml, or to undo the changes.

    HQ displays this box until you save or undo, although you can make additional changes before you save or undo. In this tutorial, you make another change, and then write the changes to disk.

  5. Click the Services tab. In the table, click the Catalina service. This is the default service of tc Runtime.

  6. In the list on the left, click Hosts, then in the table on the right, click the localhost virtual host.

  7. In the Host Properties section, enter new_work_dir in the Work Directory field. This specifies that the localhost will use a different work directory from the default, which is CATALINA_BASE/work. Relative work directories are created under CATALINA_BASE, such as CATALINA_BASE/new_work_dir. The tc Runtime instance uses the work directory to perform its internal work.

  8. Click Save at the bottom of the page.

    The message Configuration saved successfully appears in the top.

    [Note]Note

    When you update the tc Runtime configuration using the HQ user interface, if the property you are updating was previously specified as a variable (such as ${jmx.port}), tc Runtime replaces that variable with the actual value in the server.xml file. This means, for example, that port="${jmx.port}" would become port="6954". The variable is still set in the catalina.properties file to the old value, but the tc Runtime does not actually use it because the property is now hardcoded in the server.xml file.

  9. In the box at the top titled Changes have been made locally, click Push configuration changes to Tomcat.

  10. Click Push Changes to Server.

  11. In the box at the top, click the restarted link to restart the tc Runtime instance so that the changes take effect.

  12. Click Restart Server.

    The message Server Restarted appears at the top.

9.4 Deploy a Web Application to a tc Server Runtime Instance

In this procedure you deploy a new Web application to a tc Runtime instance, then stop and start it. It is assumed that you already have a Web application WAR file to deploy. If you do not, see Tutorial: Very Simple Web Application Development for a tutorial that shows you how to create a very simple HelloWorld Web application and package it into a WAR file.

It is also assumed that you have already browsed to the tc Runtime instance to which you want to deploy, as described in Restart a tc Runtime Instance.

  1. Click the Views > Application Management tab. You use this page to deploy and manage tc Runtime applications.

  2. If the Web application you want to deploy is physically located on the same computer from which you are running your browser, go to the Deploy Application from Local Machine section. If the Web application is actually located on the computer on which the tc Runtime instance is running, then go to the Deploy Application from Server Machine section. If you are running your browser on the same computer as tc Runtime, then you can go to either section. A typical remote machine use case is machines that use network mounted drives to which they have access.

    Enter the location of the Web application in the corresponding field. Use the Browse button to find a local Web application WAR file; you must already know the full pathname of the WAR file if you are deploying it from the tc Runtime computer. If you are deploying from a remote machine, your local machine must have access to the remote directory that contains the Web application file.

    The following graphic shows deploying from a local computer

  3. Enter hello in the Context path field.

    Optionally, check the Use cold deployment strategy if you want the tc Runtime instance to shutdown, deploy the application, and then start up again. By default (if box is unchecked), the tc Runtime instance hot-deploys the application, which means it does not shutdown then restart but simply deploys the application while the instance is still running. Use the cold deployment strategy if you want to avoid common hot deployment errors, such as running out of PermGen space. The PermGen space holds the metadata about classes that have been loaded/created in the JVM.

  4. Click Upload and deploy (for a local WAR file) or Deploy (for deploying a WAR file on the tc Runtime computer). HQ deploys the WAR file to the current tc Runtime instance. You should see the Web application listed in the Deployed Applications table.

  5. You can start, stop, reload, and undeploy a deployed Web application by selecting it in the Deployed Applications table and clicking the corresponding button.

To invoke the Web application you just deployed, enter the following URL in a browser:

http://host:port/hello

where:

  • host is the name of the computer on which the tc Runtime instance is running. If it is the same computer as your browser, you can enter localhost.

  • port is the TCP/IP port to which the tc Runtime instance listens. The default value is 8080.

For example:

http://localhost:8080/hello

You can get the host and port information of a tc Runtime instance by looking at its HTTP connector configuration from the Views > Server Configuration > Services tab.

9.5 Add tc Runtime Instances to the Favorite Resources Portlet

The main HQ dashboard includes a Favorite Resources portlet that lists the resources you most often manage. When you first install HQ, the portlet is empty. However, as you manage a particular resource, you might decide that you want to add it to your favorites portlet because you return to it frequently. In this procedure you add a tc Runtime instance to the Favorite Resources portlet.

  1. Navigate to the tc Runtime instance, as described in the first three steps of Restart a tc Runtime Instance.

  2. Click the Tools Menu in the top-left corner and choose Add to Dashboard Favorites.

  3. In the box, click the name of the user for whose dashboard the tc Runtime instance will show up as a favorite. Following our tutorial, click hqadmin, although if you logged in as another user you can enter that one.

  4. Click Add.

  5. The tc Runtime instance is displayed in the Favorite Resources portlet on the main dashboard:

9.6 Create an HQ Group of Multiple tc Runtime Instances

In this procedure you create an HQ group of multiple tc Runtime instances. You can then deploy a Web application to the group in a procedure similar to Deploy a Web Application to a tc Server Runtime Instance, and HQ does the work of deploying the Web application to each member of the group. Similarly, you can stop, start, and restart all the servers in the group with a procedure similar to Restart a tc Runtime Instance.

Using HQ groups saves a lot of time if you need to control multiple tc Runtime instances running on many different computers, as well as deploy and manage their applications.

It is assumed in this procedure that you have at least two tc Runtime instances running and that you have added them to the HQ inventory. See Creating a New tc Runtime Instance and Getting Started with the HQ User Interface.

[Tip]Tip

It might take a while for the HQ user interface to auto-detect a new tc Runtime instance after you start it. You can force a new auto-discovery to speed the process.

To force an auto-discovery, browse to the platform resource where you started the new tc Runtime instance. For example, in this tutorial the platform resource is called juliet-desktop. Then click New Auto-Discovery in the Tools Menu. In the Quick Auto-Discovery Scan section, click OK. The new tc Runtime instance should show up in the Auto-Disocvery portlet of the main Dashboard very shortly. You can then add it using the Add to Inventory button as usual.

  1. Click the Resources > Browse link at the top of the HQ user interface.

  2. Click the Servers (X) link to list all the servers in your resource inventory. The tc Runtime instances are listed as Server Type SpringSource tc Runtime 6.0 or SpringSource tc Runtime 7.0.

    If there are many server resources listed in the table, you can narrow down the list by selecting a server type in the Search drop-down list, then clicking the green arrow all the way to the right of the Search line.

  3. For each tc Runtime instance you want to include in the new group, check the box to the left of the instance's entry in the table.

    Note that the HQ UI itself internally uses an instance of tc Runtime (called hq-server); you should not change the configuration of this instance or add it to your groups.

  4. Click Group.

    The following graphic shows how to group together two tc Runtime instances called tc Runtime anotherserver and tc Runtime myserver.

  5. In the Group Manager window, click Add to New Group.

  6. In the General Properties section, enter a name for the group, such as tcserverGroup and an optional description and location, such as San Francisco.

  7. Click OK.

    Depending on the members of the group, HQ creates a Compatible Group/Cluster or Mixed Group. The first type of group consists of a single type of server, such as only tc Runtime instances. The second mixed group consists of different types of servers, such as both tc Runtime instances and Apache Tomcat servers.

To stop or restart the group of servers, and deploy an application to the group:

  1. Click Resources > Browse at the top of the HQ user interface.

  2. Click Compatible Groups/Clusters if your group consists of the same servers, or Mixed Groups if your group consists of different types of servers.

  3. In the table, click on the name of the group.

  4. To stop or start all the servers in the group, click the Control tab, then follow the steps for controlling a single server, as described in Restart a tc Runtime Instance. The breadcrumbs at the top of the console page list the group name (tcserverGroup in this case) rather than the tc Runtime instance name.

  5. To deploy and manage applications on all servers in the group, click the Views > Application Management tab, then follow the steps for deploying or managing the applications of a single server, as described in Deploy a Web Application to a tc Server Instance.

[Note]Note

In this release of tc Server, you cannot update the configuration of a group of tc Runtime instances from the Views > Server Configuration tab. You can update the configurations of servers in a group using the tcsadmin command-line interface. See "Using the tcsadmin Command-Line Interface" in the tc Server Administration Guide.

9.7 Monitoring tc Runtime Instances

As soon as you add a resource (such as a tc Runtime instance) to the HQ inventory, HQ begins collecting a variety of metrics about the resource that you can use to monitor its state and health. HQ displays the values of the metrics over a specified period of time using indicator charts or tables.

Examples of the types of metrics that HQ collects about tc Runtime include:

  • Number of thread deadlocks detected.

  • Size of the free heap memory.

  • JSP count per minute.

  • Number of servlet requests per minute.

The following procedure describes how to view the monitoring metrics for a tc Runtime instance.

  1. Navigate to the tc Runtime instance, as described in the first three steps of Restarting the tc Runtime Instance.

  2. Click the Monitor tab.

    The charts under the Indicator tab show data about the entire tc Runtime instance, such as thread deadlocks detected and size of the free heap memory and the tc Runtime instance up time. Click the Metric Data tab to see the same information in tabular form.

    The Services table to the left lists the services associated with the tc Runtime instance, such as the JSP and servlet monitors.

  3. In the Services table, click SpringSource tc Runtime Servlet Monitor. The chart on the right shows usage metrics about the servlets deployed to the tc Runtime instance.

  4. Click on other services within the Monitoring tab to view more monitoring information for the tc Runtime instance.

You can create an alert for a resource that fires when a specified condition is met, and optionally specify a control action that occurs when the alert is fired. HQ is preconfigured for a deadlock detection alert; see Manage the Preconfigured Deadlock Detected Alert to modify it.

9.8 Manage the Preconfigured Deadlock Detected Alert

HQ includes a preconfigured alert that triggers once if the Deadlocks Detected metric exceeds 0. HQ applies this alert to all auto-discovered tc Runtime instances, enables it by default, and then checks the metric every two minutes to see if the condition has been met. After triggering, HQ disables the alert until an administrator marks it as Fixed.

The following procedure describes how to view this preconfigured alert, modify it so that HQ automatically restarts the tc Runtime instance in which the alert is triggered, and then disable it.

  1. Navigate to the tc Runtime instance, as described in the first three steps of Restart a tc Runtime Instance.

  2. Click the Alert tab at the top of the page.

  3. Click the Configure button. A page is displayed with a table of alerts that have been defined for this tc Runtime instance. You should see the preconfigured Deadlocks Detected alert; by default it is active (enabled.)

  4. In the table, click Deadlocks Detected to display the Alert Definition page.

  5. Click the Control Action tab at the bottom of the page, and then click the EDIT... button.

  6. Select restart from the Control Type drop-down list.

  7. Click OK.

    You have modified the alert so that HQ automatically restarts the affected tc Runtime instance when HQ detects a thread deadlock.

  8. To disable the alert:

    1. Return to the page that contains the Alert Definitions table by clicking the Return to Alert Definitions link at the top left corner of the page.

    2. In the table, select the Deadlocks Detected alert by checking the box to the left of its name.

    3. At the bottom of the table, choose No in the Set Active drop-down list.

    4. Click the arrow to the right of the drop-down list. The Active column for the Deadlocks Detected alert changes to No.

10. Tutorial: Very Simple HelloWorld Web Application

This tutorial is for beginning programmers who want to know the minimal basic information on how to create servlets and JSPs, package them into a deployable WAR file, deploy the application to a tc Runtime instance, and run the application in a browser. The tutorial uses Ant as its build framework. You can also use an IDE, such as SpringSource Tool Suite, to create the application. The tutorial shows you how to create each artifact, from the servlet source to the Ant build.xml file, from scratch.

10.1 Before You Begin

Install vFabric tc Server and Ant. See Installing tc Server and Apache Ant Project.

10.2 Creating and Deploying the HelloWorld Web Application

To create a Web application and deploy it to a tc Runtime instance:

  1. When you install Ant, add or update the following environment variables:

    • ANT_HOME: Set this variable to the location where you installed Ant, such as /usr/local/ant/apache-ant-1.8.2.

    • PATH: Update your PATH variable to include ANT_HOME/bin.

  2. Set the JAVA_HOME environment variable to the directory where the JDK is installed.

  3. Create a project directory structure to contain the HelloWorld Web application source files.

    Create the top-level directory called helloworld. You can create the helloworld directory in any location on your computer that you have permission to update. The helloworld directory will contain the Ant build file (build.xml).

    Create two sub-directories of the helloworld directory: src to contain the Java source file for the HelloWorld servlet and web that will contain the JSP file, static HTML file, images, and deployment descriptor.

    In the src directory, create an examples sub-directory. This directory corresponds to the package that contains the HelloWorld servlet.

    In the web directory, create two subdirectories: images, which will contain any images used by the Web application, and WEB-INF, which is a standard directory that contains the Web application deployment descriptor files.

    The following graphic describes the project directory hierarchy:

    Figure 10.1. meDirectory Hierarchy of the HelloWorld Application

    meDirectory Hierarchy of the HelloWorld Application

  4. Create the Hello.java servlet Java source file and put it in the helloworld/src/examples directory.

    For sample Java code that you can copy and paste into your own Java file and a brief explanation of how to program a simple servlet, see Hello.java.

  5. Create the hello.jsp JSP file and put it in the helloworld/web directory.

    For sample JSP code that you can copy and paste into your own JSP file and a brief explanation of how to program a simple JSP, see hello.jsp.

  6. Create the web.xml Web application deployment descriptor and put it in the helloworld/web/WEB-INF directory.

    For sample XML that you can copy and paste into your own web.xml file and a brief explanation of the elements, see web.xml.

  7. Create the default index.html page and put it in the helloworld/web directory.

    For a sample HTML file that you can copy and paste into your own file, see index.html.

  8. Create the Ant build file (build.xml) that includes targets for compiling and packaging the Web application and put it in the helloworld directory.

    For a sample Ant build file that you can copy and paste into your own file, see build.xml.

  9. In your own build file, update the tcserver.home property to fit your environment; it should point to the CATALINA_HOME of your tc Runtime installation. For example, if you installed tc Server Standard Edition in the /home/tcServer directory, set the tcserver.home property in the build.xml file to something like the following:

    <property name="tcserver.home" value="/home/tcServer/vfabric-tc-server-standard/tomcat-6.0.25.A-RELEASE" />
  10. Right-click the following image and save it with name springsource.png to the helloworld/web/images directory.

    When you finish creating all the artifacts that make up the HelloWorld Web application, your directory structure and contents should look like the following:

    helloworld
    helloworld/build.xml
    helloworld/src
    helloworld/src/examples
    helloworld/src/examples/Hello.java
    helloworld/web
    helloworld/web/hello.jsp
    helloworld/web/images
    helloworld/web/images/springsource.png
    helloworld/web/index.html
    helloworld/web/WEB-INF
    helloworld/web/WEB-INF/web.xml 
  11. Compile and package the HelloWorld Web application by opening a command window, changing to the helloworld directory, and executing the following command:

    prompt> ant all

    This ant command creates a deployable WAR file of the HelloWorld application called hello.war in the helloworld/dist directory. You will see the following output from the ant command if it completes successfully:

    Buildfile: build.xml
    
    clean:
    
    prepare:
        [mkdir] Created dir: /home/samples/helloworld/dist
        [mkdir] Created dir: /home/samples/helloworld/work/WEB-INF/classes
         [copy] Copying 4 files to /home/samples/helloworld/work
    
    compile:
        [javac] Compiling 1 source file to /home/samples/helloworld/work/WEB-INF/classes
    
    dist:
          [jar] Building jar: /home/samples/helloworld/dist/hello.war
    
    all:
    
    BUILD SUCCESSFUL
    Total time: 2 seconds
  12. Start a tc Runtime instance. See Starting and Stopping tc Runtime Instances.

  13. Deploy the Web application JAR file to the tc Runtime instance. See Deploying Applications to tc Runtime Instances.

  14. Invoke the HelloWorld Web application in your browser:

    http://host:port/hello

    where:

    • host is the name of the computer that is hosting the tc Runtime instance. If it is the same as the computer hosting your browser, you can use localhost.

    • port is the port to which the tc Runtime instance listens. The default value is 8080.

    In the example, /hello is the default URL context of the Web application, which in this example is the name of the WAR package without the trailing .war file extension.

    For example:

    http://localhost:8080/hello

10.3 Java Source of the Hello.java Servlet

The following Java source file shows the code for the Hello.java servlet; see Description of the Hello Servlet for information about the relevant parts of the code sample.

package examples;

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


/**
 * Simple Hello servlet.
 */

public final class Hello extends HttpServlet {


    /**
     * Respond to a GET request for the content produced by
     * this servlet.
     *
     * @param request The servlet request we are processing
     * @param response The servlet response we are producing
     *
     * @exception IOException if an input/output error occurs
     * @exception ServletException if a servlet error occurs
     */
    public void doGet(HttpServletRequest request,
                      HttpServletResponse response)
      throws IOException, ServletException {

        response.setContentType("text/html");
        PrintWriter writer = response.getWriter();        
        writer.println("<html>");
        writer.println("<head>");
        writer.println("<title>Sample Application Servlet Page</title>");
        writer.println("</head>");
        writer.println("<body bgcolor=white>");

        writer.println("<table border=\"0\" cellpadding=\"10\">");
        writer.println("<tr>");
        writer.println("<td>");
        writer.println("<img src=\"images/springsource.png\">");
        writer.println("</td>");
        writer.println("<td>");
        writer.println("<h1>Sample Application Servlet</h1>");
        writer.println("</td>");
        writer.println("</tr>");
        writer.println("</table>");

        writer.println("This is the output of a servlet that is part of");
        writer.println("the Hello, World application.");

        writer.println("</body>");
        writer.println("</html>");
    }
} 

Description of the Hello Servlet

In the preceding code:

  • The Hello class extends the javax.servlet.http.HttpServlet abstract class. This abstract class provides a framework for handling the HTTP protocol. When extending the HttpServlet abstract class, a programmer must override at least one method, depending on the type of requests the servlet supports, such as HTTP GET, HTTP POST, and so on.

  • The Hello servlet overrides the doGet method because it supports HTTP GET. The parameters of the method are the HTTP request and response.

  • The response.setContentType method tells the receiver of the response (such as a browser) that the response type is text/html, or simple HTML.

  • The response.getWriter method returns a PrintWriter object used to send character text to the client, in this case a browser. The writer.println lines build an HTML file that will be rendered by the browser that invokes the servlet.

For complete documentation about the Java Servlet technology, including API reference documentation, specifications, and tutorials, see Java Servlet Technology.

10.4 JSP Source for the hello.jsp JSP

The following source shows the JSP code for the hello.jsp JSP; see Description of the hello.jsp for additional information.

  <html>
  <head>
    <title>Sample Application JSP Page</title>
  </head>

  <body bgcolor=white>

  <table border="0" cellpadding="10">
    <tr>
      <td align=center>
        <img src="images/springsource.png">
      </td>
      <td>
         <h1>Sample Application JSP Page</h1>
      </td>
    </tr>
  </table>

  <br />
  <p>This is the output of a JSP page that is part of the HelloWorld application.</p>

  <%= new String("Hello!") %>

  </body>
</html> 

Description of the hello.jsp

The hello.jsp page is a static HTML page embedded with a JSP command. A JSP command is an XML-like snippet that encapsulates logic that dynamically generates content within the static HTML. JSP commands can include directives, declarations, expressions, actions, and blocks of Java code, all enclosed within angle-brackets, like XML elements. At compile-time, the JSP is converted into a servlet, which is what tc Runtime instance actually executes at runtime.

The hello.jsp includes the following simple JSP directive:

<%= new String("Hello!") %>

This JSP directive simply prints out a message to the client (browser): Hello!

For complete documentation about JSPs, including specifications, FAQs, and tutorials, see JavaServer Pages Technology.

10.5 Sample web.xml File

The following sample web.xml deployment descriptor shows how to declare the HelloServlet servlet in the HelloWorld Web application. See also Description of the web.xml File.

<?xml version="1.0" encoding="ISO-8859-1" ?>

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">

    <display-name>HelloWorld Application</display-name>
    <description>
        This is a simple web application with a source code organization
        based on the recommendations of the Application Developer's Guide.
    </description>

    <servlet>
        <servlet-name>HelloServlet</servlet-name>
        <servlet-class>examples.Hello</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>HelloServlet</servlet-name>
        <url-pattern>/hello</url-pattern>
    </servlet-mapping>

</web-app>     

Description of the web.xml File

In the preceding web.xml deployment descriptor file, the <servlet> XML element declares the HelloServlet, the examples.Hello Java class implements the servlet, and the <servlet-mapping> XML element specifies the /hello URL pattern that invokes the servlet in a browser. This URL pattern is used in the index.html file.

10.6 Sample Default index.html File

The following sample index.html file is the default HTML file that appears in a browser when a user invokes the HelloWorld Web application. The index.html file in turn invokes both the hello.jsp JSP and HelloServlet servlet.

The index.html file invokes the JSP by linking to its name (hello.jsp). The HTML file invokes the servlet by linking to its URL pattern (/hello).

<html>
  <head>
    <title>Sample "Hello, World" Application</title>
  </head>
  <body bgcolor=white>

    <table border="0" cellpadding="10">
      <tr>
        <td>
          <img src="images/springsource.png">
        </td>
        <td>
          <h1>Sample "Hello, World" Application</h1>
        </td>
      </tr>
    </table>

    <p>This is the home page for the HelloWorld Web application. </p>
    <p>To prove that they work, you can execute either of the following links:
    <ul>
      <li>To a <a href="hello.jsp">JSP page</a>.
      <li>To a <a href="hello">servlet</a>.
    </ul>

  </body>
</html>

10.7 Ant Build File to Compile and Package the Example

The following sample Ant build.xml file compiles the servlet code and packages all the Web application artifacts into a deployable WAR file; see Description of the build.xml File for additional information.

<project name="My Project" default="help" basedir=".">
  <!-- Define the properties used by the build -->
  <property name="app.name"      value="hello"/>
  <property name="tcserver.home" value="/home/tcServer/vfabric-tc-server-standard/tomcat-6.0.25.A-RELEASE" />
  <property name="work.home"    value="${basedir}/work"/>
  <property name="dist.home"     value="${basedir}/dist"/>
  <property name="src.home"      value="${basedir}/src"/>
  <property name="web.home"      value="${basedir}/web"/>

  <target name="help">
    <echo>You can use the following targets:</echo>
    <echo> </echo>
    <echo>  help    : (default) Prints this message </echo>
    <echo>  all     : Cleans, compiles, and packages application</echo>
    <echo>  clean   : Deletes work directories</echo>
    <echo>  compile : Compiles servlets into class files</echo>
    <echo>  dist    : Packages artifacts into a deployable WAR</echo>
    <echo></echo>
    <echo>For example, to clean, compile, and package all at once, run:</echo>
    <echo>prompt> ant all </echo>
  </target>

  <!-- Define the CLASSPATH -->
  <path id="compile.classpath">
    <fileset dir="${tcserver.home}/bin">
      <include name="*.jar"/>
    </fileset>
    <pathelement location="${tcserver.home}/lib"/>
    <fileset dir="${tcserver.home}/lib">
      <include name="*.jar"/>
    </fileset>
  </path>

  <target name="all" depends="clean,compile,dist"
          description="Clean work dirs, then compile and create a WAR"/>

  <target name="clean"
          description="Delete old work and dist directories">
    <delete dir="${work.home}"/>
    <delete dir="${dist.home}"/>
  </target>

  <target name="prepare" depends="clean"
          description="Create working dirs and copy static files to work dir">
    <mkdir  dir="${dist.home}"/>
    <mkdir  dir="${work.home}/WEB-INF/classes"/>
    <!-- Copy static HTML and JSP files to work dir -->
    <copy todir="${work.home}">
      <fileset dir="${web.home}"/>
    </copy>
  </target>

  <target name="compile" depends="prepare"
          description="Compile Java sources and copy to WEB-INF/classes dir">
    <javac srcdir="${src.home}"
          destdir="${work.home}/WEB-INF/classes">
        <classpath refid="compile.classpath"/>
    </javac>
    <copy  todir="${work.home}/WEB-INF/classes">
      <fileset dir="${src.home}" excludes="**/*.java"/>
    </copy>

  </target>


  <target name="dist" depends="compile"
          description="Create WAR file for binary distribution">
    <jar jarfile="${dist.home}/${app.name}.war"
         basedir="${work.home}"/>
  </target>

</project> 

Description of the build.xml File

The Ant build.xml file defines targets for compiling and packaging the HelloWorld Web application. In preparation, the build process first creates an output directory and creates the required directory hierarchy below it for a standard Web application. This includes the WEB-INF directory that will contain the web.xml file. The build process also sets the build's CLASSPATH value to include the required JAR files in the tc Server distribution.

The compile target uses the Java compiler to compile the Java servlet file into a class and copies it to the output directory. The package target creates a JAR file of the output directory.

11. Troubleshooting

The following sections describe common problems and resolutions.

11.1 HQ: Resources Not Showing up in the HQ User Interface

By default, an HQ Agent checks for new resources only once a day. For example, if you start the HQ Server and HQ Agent, and then create a new tc Runtime instance and start it, you might have to wait 24 hours for the new tc Runtime instance to be auto-discovered by HQ. You can force an auto-discovery of new resources in two ways:

  • Stop and start the HQ Agent on the computer for which you want to force an auto-discovery. When the HQ Agent starts, it automatically checks for new resources. See Starting and Stopping the HQ Server and Agents for details.

  • Use the HQ user interface to force an auto-discovery:

    1. From the main dashboard, click the Resources > Browse link.

    2. Click the Platforms(XX) link.

    3. In the table, click on the name of the platform for which you want to force an auto-discovery.

    4. In the top-right Tools Menu box, click New Auto-Discovery.

    5. In the top section called Quick Auto-Discovery Scan, click OK.

    New resources show up in the Auto-Discovery portlet of the main dashboard as soon as HQ completes the scan of the platform.

11.2 HQ: Errors When Trying to Add an Auto-Discovered Resource

If you get errors when trying to add an auto-discovered resource to the HQ server using the user interface:

  1. Log onto the platform that hosts the resource that is returning errors when you try to add it using the HQ user interface.

  2. Stop the HQ Agent. See Starting and Stopping the HQ Server and Agents for details.

  3. Change to the HQ_AGENT_INSTALL_DIR directory, where HQ_AGENT_INSTALL_DIR refers to the directory in which you installed the HQ Agent, such as /home/hyperic/agent-4.5.X.X-EE.

  4. Remove the data directory.

  5. Start the HQ Agent.

    Because you removed the data directory, the Agent operates as if this is a new installation, so the start script takes you through the configuration process for the Agent again. This step often clears up the auto-discovery errors and allows you to again add all new auto-discovered resources through the HQ user interface.

11.3 HQ Agent: Errors When Starting on Solaris

This section applies to Solaris platforms only.

If you try to start the HQ Agent on Solaris and get errors similar to the following:

prompt$ cd /home/tcserver/agent-4.5.0.7-EE/bin
prompt$ ./hq-agent.sh start

Bad string
Unable to locate any of the following binaries:
/home/tcserver/agent-4.5.0.7-EE/wrapper/sbin/../../wrapper/sbin/wrapper---32
/home/tcserver/agent-4.5.0.7-EE/wrapper/sbin/../../wrapper/sbin/wrapper---64
/home/tcserver/agent-4.5.0.7-EE/wrapper/sbin/../../wrapper/sbin/wrapper
...

make sure that you have set the locale correctly on your Solaris computer. In particular, the locale must not be set to a UTF-8 locale, such as en_US.UTF-8. The following are sample settings for the LC_CTYPE environment variable that resolve the problem:

LC_CTYPE=en_US
LC_CTYPE=en_US.ISO8859-1
LC_CTYPE=en_US.ISO8859-15

11.4 tc Runtime: Hot Redeploy/Stop/Undeploy on Windows Fails

Because of the way that file system locking works on Windows platforms, hot redeployment of a Web application on Windows can sometimes fail. Hot redeployment may also fail when you stop or undeploy a Web application on Windows. The problem can occur when you use the HQ user interface or the tcsadmin command-line interface.

To resolve the problem:

  1. Update the CATALINA_BASE/conf/context.xml file of the tc Runtime instance and set the following two attributes of the <Context> element to true:

    • antiJARLocking: When set to true, the tc Runtime classloader takes extra measures to avoid JAR file locking when resources are accessed inside JARs through URLs. This action affects the startup time of applications, but is useful on platforms (such as Windows) or configurations where file locking can occur.

    • antiResourceLocking: When set to true, tc Runtime prevents any file locking. This action affects startup time of applications significantly, but allows full Web application hot redeploy on platforms (such as Windows) or configurations where file locking can occur.

    The following context.xml snippet shows how to specify the attributes; only the relevant part of the file is shown:

    <Context antiJARLocking="true" antiResourceLocking="true">
    
           <WatchedResource>...
  2. Restart the tc Runtime instance for the change to take effect.

Setting antiJARLocking and antiResourceLocking to true forces tc Runtime to copy files rather than read them in place. Also, if you try to copy in a new .jsp file directly, tc Runtime does not pick it up.

If you prefer, you can set these two properties in the context.xml file of the application itself rather than in the context.xml file for the entire tc Runtime instance.

For more information and warnings about configuring the context.xml file, see The Context Container.

11.5 tc Runtime: Error When Running a Web Application on tc Runtime and Using SpringSource Tool Suite

When you use SpringSource Tool Suite (STS) with tc Server, and you try to run a Web application on the configured tc Runtime, you might get the following error:

Nov 29, 2009 7:47:29 PM com.springsource.tcserver.security.PropertyDecoder <init<
INFO: tcServer property decoder has been initialized.
Nov 29, 2009 7:47:30 PM com.springsource.tcserver.serviceability.rmi.JmxSocketListener init
INFO: Started up JMX registry on 127.0.0.1:6969
Nov 29, 2009 7:47:30 PM org.apache.coyote.http11.Http11Protocol init
SEVERE: Error initializing endpoint
java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(PlainSocketImpl.java :365)
at java.net.ServerSocket.bind(ServerSocket.java:319)
at java.net.ServerSocket.<init<(ServerSocket.java:185 )
at java.net.ServerSocket.<init<(ServerSocket.java:141 )
... and so on

STS might not have write permission to the main tc Server installation path, and the tc Runtime has to create files when it starts. Modify the path of tc Runtime in STS to use the workspace metadata.

11.6 tc Runtime: JVM Performing a Full GC

By default, tc Runtime instances have JMX turned on so that you can use Hyperic HQ to monitor and manage the instances. Specifically, tc Runtime instances enable JMX using the JmxSocketListener in the server.xml configuration file, as shown:

<Listener className="com.springsource.tcserver.serviceability.rmi.JmxSocketListener" 
          port="${jmx.port}"
          ...
/>

When JMX is enabled in this way, some JVMs (such as Sun's) that do distributed garbage collection will periodically invoke System.gc, causing a Full GC. This action can affect the performance of your deployed Web applications.

There are two ways to work around this issue:

Specify that the JVM invoke the System.gc() less often. For example, to configure the Sun JVM to invoke System.gc() at one-hour intervals, use the following JVM options:

-Dsun.rmi.dgc.client.gcInterval=3600000
-Dsun.rmi.dgc.server.gcInterval=3600000

Alternatively, disable explicit GC altogether. For example, to disable GC for the Sun JVM:

-XX:+DisableExplicitGC

In both cases, set these JVM options in the INSTANCE-DIR/bin/setenv.sh|bat file using the JVM_OPTS variable appropriate to your platform.