Apache Software Foundation | Jakarta Project | Apache Tomcat
Introduction


はじめに

This document describes the configuration files used by JK2 on the Tomcat and Web Server side:

  • jk2.properties is used on the Tomcat side. It's installation path in the $TOMCAT_HOME/conf directory.
  • workers2.properties is used on the webserver side. For the Apache servers the default path is in the ServerRoot/conf directory.
Although JK2 has many things in common with mod_jk, the configuration is quite different, and all the directives should be inside the workers2.properties. This enables JK2 to have the same configuration file no mater what the web server it's connected to.


この文書では、JK2 が使用する Tomcat と Web サーバの設定ファイルについて説明します。

  • jk2.properties は、Tomcat 側で使われるファイルです。インストールパスは、 $TOMCAT_HOME/conf ディレクトリです。
  • workers2.properties は、Web サーバ側で使われるファイルです。Apache サーバのデフォルトのパスは、 ServerRoot/conf ディレクトリです。
JK2 では、mod_JK と多く共通点がありますが、設定に関してはまったく違います。 すべての指示子は、workers2.properties 内にあります。このため JK2 は、 同じ設定ファイルを使用して、どんな Web サーバにでも問題無く接続する事ができます。


Minimum Configuration


最小限の設定

Minimum configuration is the simplest one to make the JK2 working. The used channel will be socket, and lot of options are used by default. Both the Tomcat and web server are on the same computer.


ここで紹介する最小限の設定は、JK2 が動作するための一番単純な設定です。 チャンネルとしてはソケットを使い、多くのオプションはデフォルトのまま使います。 Tomcat と Web サーバはどちらも同じコンピュータ上にあるとします。

jk2.properties:

# The default port is 8009 but you can use another one
# channelSocket.port=8019
That is all needed on the Tomcat side to configure the JK2.


jk2.properties:

# デフォルトのポート番号は 8009 ですが、違うポート番号を使うなら指定
# channelSocket.port=8019
Tomcat 側で必要な JK2 の設定はこれだけです。

workers2.properties:

# Define the communication channel 
[channel.socket:localhost:8009]
info=Ajp13 forwarding over socket
tomcatId=localhost:8009

# Map the Tomcat examples webapp to the Web server uri space
[uri:/examples/*]
info=Map the whole webapp


workers2.properties:

# 通信チャンネルの定義
[channel.socket:localhost:8009]
info=Ajp13 forwarding over socket
tomcatId=localhost:8009

# Tomcat の examples Web アプリケーションを Web サーバ URI 空間にマップ(関連付け)
[uri:/examples/*]
info=Map the whole webapp

Start the Tomcat and Web server and browse to the http://localhost/examples/


Tomcat と Web サーバを起動し、ブラウザで http://localhost/examples/ をアクセスしましょう。


Minimum JNI Configuration


最小限の JNI の設定

Minimum JNI configuration is the simplest one to make the Tomcat working from inside the web server as inprocess. The only comunication channel used is JNI. The JK2 will register all the native calls by itself, so there is no need to specify the native library on Java side.


ここで紹介する最小限の JNI の設定は、Web サーバのプロセス内で Tomcat を動作させる一番単純な設定です。 通信チャンネルは JNI だけを使います。JK2 はすべてのネイティブ呼出を自分自身で登録するので、 Java 側でネイティブライブラリを指定する必要はありません。

jk2.properties:

# Add the apr and channelJni to the list of handlers
handler.list=apr,request,container,channelJni
# The native libraries will be registered by JK2
apr.jniModeSo=inprocess


jk2.properties:

# ハンドラのリストに apr と channelJni を追加
handler.list=apr,request,container,channelJni
# ネイティブライブラリは JK2 によって登録される
apr.jniModeSo=inprocess

workers2.properties:

# Define the comunication channel 
[channel.jni:jni]
info=The jni channel, used if tomcat is started inprocess

# Define the parameters for the Java Virtual Machine
[vm:]
info=Parameters used to load a JVM in the server process
OPT=-Djava.class.path=${TOMCAT_HOME}/lib/tomcat-jni.jar;${TOMCAT_HOME}/lib/tomcat.jar
OPT=-Dtomcat.home=${TOMCAT_HOME}
OPT=-Dcatalina.home=${TOMCAT_HOME}
OPT=-Xmx128M

# JNI worker startup handler
[worker.jni:onStartup]
info=Command to be executed by the VM on startup. This one will start tomcat.
class=org/apache/jk/apr/TomcatStarter
ARG=start
stdout=${serverRoot}/logs/stdout.log
stderr=${serverRoot}/logs/stderr.log

# JNI worker shutdown handler
[worker.jni:onShutdown]
info=Command to be executed by the VM on shutdown. This one will stop tomcat.
class=org/apache/jk/apr/TomcatStarter
ARG=stop

# Map the Tomcat examples webapp to the Web server uri space
[uri:/examples/*]
info=Map the whole webapp


workers2.properties:

# 通信チャンネルの定義
[channel.jni:jni]
info=The jni channel, used if tomcat is started inprocess

# Java バーチャルマシンのパラメータの定義
[vm:]
info=Parameters used to load a JVM in the server process
OPT=-Djava.class.path=${TOMCAT_HOME}/lib/tomcat-jni.jar;${TOMCAT_HOME}/lib/tomcat.jar
OPT=-Dtomcat.home=${TOMCAT_HOME}
OPT=-Dcatalina.home=${TOMCAT_HOME}
OPT=-Xmx128M

# JNI ワーカの起動時ハンドラ
[worker.jni:onStartup]
info=Command to be executed by the VM on startup. This one will start tomcat.
class=org/apache/jk/apr/TomcatStarter
ARG=start
stdout=${serverRoot}/logs/stdout.log
stderr=${serverRoot}/logs/stderr.log

# JNI ワーカの終了時ハンドラ
[worker.jni:onShutdown]
info=Command to be executed by the VM on shutdown. This one will stop tomcat.
class=org/apache/jk/apr/TomcatStarter
ARG=stop

# Tomcat の examples Web アプリケーションを Web サーバ URI 空間にマップ(関連付け)
[uri:/examples/*]
info=Map the whole webapp

Start the Web server and browse to the http://localhost/examples/


Tomcat と Web サーバを起動し、ブラウザで http://localhost/examples/ をアクセスしましょう。


[訳注: これは鰈崎 義之が翻訳しました。日本語訳に対するコメントがあれば、こちらに送って下さい。]