リンク ユーザガイド リファレンス Tomcat開発 | Tomcat5 サーブレット/JSP コンテナDeployer HOW-TOデプロイヤの使い方 |  印刷用 バージョン
|
| はじめに |
The deployer, which as its name imply, allows deploying and undeploying web
applications to the Tomcat server, either statically (the application is
setup before the server is started), or dynamically (in conjunction with the
Tomcat Manager web application or manipulating already deployed applications).
デプロイヤはその名の通り、Tomcat サーバに対して
Web アプリケーションの配備 (デプロイ) や配備解除 (アンデプロイ) を行います。
これらの処理は静的にも行えます
(サーバが起動する前にアプリケーションがセットアップされます) し、
動的にも行えます (Tomcat Manager Web アプリケーションと連動したり、
配備済みのアプリケーションを操作したりします)。
|
| コンテキスト記述子 |
A Context XML descriptor is a fragment of XML data which contains a valid
Context element which would normally be found in the main server configuration
file (conf/server.xml), and allows easy and automated manipulation
of web applications by the various management tools available in Tomcat.
For a given host, the Context descriptors are located in
$CATALINA_HOME/conf/[enginename]/[hostname]/foo.xml. Note that
while the name of the file is not tied to the webapp name, Tomcat will create
Context descriptors which match the webapp name whenever it will generate a
Context descriptor.
コンテキスト XML 記述子は、妥当なコンテキスト要素をもつ XML データの一部で、
通常はメインのサーバ設定ファイル (conf/server.xml) にあり、これによって、
Tomcat で使われる様々な管理ツールでの
Web アプリケーションの容易な操作や自動化を実現しています。
特定のホストに関しては、コンテキスト記述子は
$CATALINA_HOME/conf/[enginename]/[hostname]/foo.xml
で設定されます [foo は任意の名前]。
ファイル名は Web アプリ名に紐づいてはいませんが、
Tomcat がコンテキスト記述子を生成する場合はいつも
Web アプリ名に合わせた名前でファイルを作成することに注意して下さい。
Context descriptors allow defining all aspects and configuration parameters
of a Context, such as namign resources and session manager configuration.
It should be noted that the docBase specified in the Context element can
refer to either the .WAR or the directory which will be created when the
.WAR is expanded or the .WAR itself.
コンテキスト記述子を使うと、
ネーミングリソースやセッションマネージャ設定といった、
コンテキストのあらゆる側面と設定パラメータの全てを定義できます。
コンテキスト要素で指定された docBase の参照先は、WAR ファイルそのものか、
WAR ファイルが展開される際に作成されるディレクトリのどちらかです。
[訳者コメント: namign(誤)→naming(正)?]
|
| Tomcat 起動時の配備 |
The webapps which are present in the host appBase will be deployed if the
host "deployOnStartup" property is true. The deployment process is
the following:
- The Context XML declarations will be deployed first
- Expanded web applications not referenced by Context XML declarations
will then be deployed; if they have an associated .WAR file and it is
newer than the expanded web application, the expanded directory will
be removed and the webapp will be redeployed from the .WAR
- .WAR files will be deployed
For each deployed web application, a matching Context XML descriptor will be
created unless one exists already.
ホストの appBase にある Web アプリは、ホストの "deployOnStartup"
プロパティが true の場合に配備されます。配備の実行順序は以下の通りです。
- まず、コンテキスト XML の宣言 [で参照される Web アプリ] が配備される。
- 次に、コンテキスト XML の宣言で参照されない、
展開済みの Web アプリケーションが配備される。関連する
WAR ファイルがあって、展開済みの Web アプリケーションより新しければ、
展開済みのディレクトリは削除され、
Web アプリは WAR ファイルから再配備される。
- WAR ファイルが配備される。
既に作成されている場合を除き、
配備された各 Web アプリケーションには対応するコンテキスト XML 記述子が作成されます。
|
| Tomcat サーバ実行中の配備 |
If the host "autoDeploy" property is true, the host will attempt to deploy
and update web applications dynamically, as needed. The host will need to
have background processing enabled for automatic reloading to work, which
is the default.
ホストの "autoDeploy" プロパティが true の場合ホストは、
Web アプリケーションの配備や更新を必要に応じて動的に行おうとします。
(デフォルトの) 自動リロードを動作させるためには、
そのホストでバックグラウンド処理が可能である必要があります。
This includes:
- Deployment of WARs which are copied to the host appBase.
- Deployment of expanded web applications which are copied to the host
appBase.
- Redeployment of a web application which has been deployed from a WAR
when the WAR is updated: the expanded web application is removed,
and the WAR is expanded again. This will not happen if the host is
configured so that WARs are not expanded, in which case the webapp
will be simply redeployed.
- Redeployment of the web application if the /WEB-INF/web.xml file is
updated.
- Redeployment of the web application if the context XML file from which
the web application has been deployed is updated.
- Redeployment of the web application if a context XML file (with a
name corresponding to the context path of the previously deployed
application) is added in the
$CATALINA_HOME/conf/[enginename]/[hostname]/ folder.
Note: Web application reloading can also be configured in the loader, in which
case loaded classes will be tracked for changes.
その内容は以下の通りです。
- ホストの appBase にコピーされた WAR ファイルを配備。
- ホストの appBase にコピーされた 展開済み Web アプリケーションを配備。
- WAR ファイルが更新された場合、 WAR ファイルで配備された
Web アプリケーションを再配備。つまり、展開された
Web アプリケーションが削除され、WAR ファイルの展開が再び行われる。
WAR ファイルが展開されないように設定されている場合にはこの処理は行われず、
単に Web アプリが再配備されるだけである。
- /WEB-INF/web.xml ファイルが更新された場合、
Web アプリケーションを再配備。
- Web アプリケーションの配備で使用したコンテキスト XML
ファイルが更新された場合、Web アプリケーションを再配備。
- (以前に配備されたアプリケーションのコンテキストパスに対応した名前の)
コンテキスト XML ファイルが
$CATALINA_HOME/conf/[enginename]/[hostname]/
フォルダに追加された場合、Web アプリケーションを再配備。
注意: Web アプリケーションの再ロードは、ローダでも設定できます。
その場合は、ロードされたクラスの変更が監視されます。
|
| クライアントデプロイヤパッケージを使った配備 |
The client deployer is a package which can be used to validate, compile,
and deploy a web application to a production or development server. It should
be noted that this feature uses the Tomcat manager for automatic deployment.
クライアントデプロイヤは、Web アプリケーションの検証、コンパイル、
本番または開発サーバへの配備に使用できるパッケージです。
この機能では、自動配備のために Tomcat マネージャを使うことに注意して下さい。
The deployer includes the Catalina manager Ant tasks, the Jasper page
compiler for JSP compilation before deployment, as well as a task which
validates the webapp's deployment descriptor. The validator task (class
org.apache.catalina.ant.ValidatorTask) allows only one parameter:
the base path of an expanded web application.
デプロイヤに含まれているのは、Catalina マネージャの Ant タスク、
配備前に JSP のコンパイルを行う Jasper ページコンパイラ、
そしてWeb アプリの配備記述子を検証するタスクです。
検証タスク(org.apache.catalina.ant.ValidatorTask クラス)
で指定できるパラメータはただ一つ、
展開された Web アプリケーションの基底パスだけです
The deployer uses an unpacked web application as input (see the list of the
properties used by the deployer below). A web application which
is programatically deployed with the deployer may include Tomcat specific
deployment configuration, by including a Context configuration XML file in
/META-INF/context.xml.
パックされていない [WAR ファイルになっていない]
Web アプリケーションをデプロイヤは入力として使います
(デプロイヤで使用するプロパティ一覧 (後述) を参照)。
/META-INF/context.xml にコンテキスト設定
XML ファイルをインクルードすることで、
デプロイヤで自動的に配備される Web アプリケーションに
Tomcat 特有の配備設定を含めることができます。
The deployer package includes a ready to use Ant script, with the following
targets:
compile (default): Compile and validate the web
application. This can be used standalone, and does not need a running
Tomcat server. The compiled application will only run on the associated
Tomcat 5.0.x server release, and is not guaranteed to work on another
Tomcat release, as the code generated by Jasper depends on its runtime
component. It should also be noted that this target will also compile
automatically any Java source file located in the
/WEB-INF/classes folder of the web application.
deploy: Deploy a web application (compiled or not) to
a Tomcat server
undeploy: Undeploy a web application
start: Start web application
reload: Reload web application
stop: Stop web application
The following properties can be specified, either as system properties, or by
using a deployer.properties file located in the root folder of the
deployer package:
build: The build folder used will be, by default,
${build}/webapp${path}. After the end of the execution
of the compile target, the web application WAR will be
located at ${build}/webapp${path}.war.
webapp: Folder containing the expanded web application
which will be compiled and validated. By default, the folder is
myapp.
path: Deployed context path of the web application,
by default /myapp.
url: Absolute URL to the manager web application of a
running Tomcat server, which will be used to deploy and undeploy the
web application. By default, the deployer will attempt to access
a Tomcat instance running on localhost, at
http://localhost:8080/manager.
username: Username to be used to connect to the Tomcat
manager.
password: Password to be used to connect to the Tomcat
manager.
デプロイヤパッケージにはすぐに使える Ant スクリプトが入っており、
以下のようなターゲットがあります。
compile (デフォルト):
Web アプリケーションのコンパイルと検証を行います。
このタスクは単独で使用可能で、Tomcat
サーバが起動している必要はありません。
コンパイルされたアプリケーションは関連する Tomcat 5.0.x
サーバでのみ動作し、他の Tomcat リリースでの動作は保証されません。
Jasper が生成するコードがその実行時コンポーネントに依存するためです。
また、このターゲットでは Web アプリケーションの
/WEB-INF/classes フォルダにある
Java ソースファイルをすべて自動コンパイルすることにも注意して下さい。
deploy: Web アプリケーションを
(コンパイル済かどうかに関係なく) Tomcat サーバに配備します。
undeploy: Web アプリケーションの配備解除を行います。
start: Web アプリケーションを起動します。
reload: Web アプリケーションを再ロードします。
stop: Web アプリケーションを停止します。
システムプロパティあるいはデプロイヤパッケージのルートフォルダにある
deployer.properties ファイルで以下のプロパティを指定できます。
|
|