JAVA SDK、Tomcat5 インストール

環境
SuSELinux10.1x86_64
java version "1.5.0_12"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_12-b04)
Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_12-b04, mixed mode)
Tomcat5.0.30-27.5.3
mod_jk-ap20 4.1.30-8 x86_64
Apache2.2.0-21.7 x86_64

テストしながら調整中です。この後Tomcatでのバーチャルサーバー予定。
間違ってる可能性があるのであくまでも参考程度に、、、
YaST2で下記を選択、付帯していろんなものが入ります。
java-1_5_0-sun-devel - Java(TM) 5 SDK, Standard Edition
tomcat5 - A servlet container
mod_jk-ap20 - Connectors Between Apache 2.0 and Tomcat Servlet Container

/home/ユーザー/.bashrc

.bashrc

  1. #JAVAのパス
  2. export JAVA_HOME=/usr/lib64/jvm/java-1.5.0-sun
  3. export PATH=$JAVA_HOME/bin:$PATH
  4. #Tomcatのパス
  5. export CATALINA_HOME=/usr/share/tomcat5
  6. #下記の記述は一行で挿入
  7. export_ CLASSPATH=.:$CATALINA_HOME/common/lib/servletapi5.jar:$CATALINA_HOME/common/lib/jspapi.jar:$CATALINA_HOME/webapps/ROOT/WEB-INF/classes:

.bashrcを再読み込み
# source .bashrc

/usr/share/tomcat5/conf/mod_jk.conf

mod_jk.conf

  1. <IfModule !mod_jk.c>
  2. #mod_jk.soへのパス
  3.   LoadModule jk_module "/usr/lib64/apache2-prefork/mod_jk.so"
  4. </IfModule>

  5. JkWorkersFile "/usr/share/tomcat5/conf/workers.properties"
  6. JkLogFile     "/usr/share/tomcat5/logs/mod_jk.log"
  7. JkLogLevel warn

  8. JkMount /webdav ajp13
  9. JkMount /webdav/* ajp13

  10. # 今回テスト中のグループウェア
  11. JkMount /gsession2 ajp13
  12. JkMount /gsession2/* ajp13

  13. JkMount /servlets-examples ajp13
  14. JkMount /servlets-examples/* ajp13

  15. JkMount /jsp-examples ajp13
  16. JkMount /jsp-examples/* ajp13

  17. JkMount /balancer ajp13
  18. JkMount /balancer/* ajp13

  19. JkMount /tomcat-docs ajp13
  20. JkMount /tomcat-docs/* ajp13

/usr/share/tomcat5/conf/workers.properties

workers.properties

  1. # workers.properties -
  2. #
  3. # This file provides jk derived plugins with the needed information to
  4. # connect to the different tomcat workers.  Note that the distributed
  5. # version of this file requires modification before it is usable by a
  6. # plugin.
  7. #
  8. # As a general note, the characters $( and ) are used internally to define
  9. # macros. Do not use them in your own configuration!!!
  10. #
  11. # Whenever you see a set of lines such as:
  12. # x=value
  13. # y=$(x)\something
  14. #
  15. # the final value for y will be value\something
  16. #
  17. # Normaly all you will need to do is un-comment and modify the first three
  18. # properties, i.e. workers.tomcat_home, workers.java_home and ps.
  19. # Most of the configuration is derived from these.
  20. #
  21. # When you are done updating workers.tomcat_home, workers.java_home and ps
  22. # you should have 3 workers configured:
  23. #
  24. # - An ajp12 worker that connects to localhost:8007
  25. # - An ajp13 worker that connects to localhost:8009
  26. # - A jni inprocess worker.
  27. # - A load balancer worker
  28. #
  29. # However by default the plugins will only use the ajp12 worker. To have
  30. # the plugins use other workers you should modify the worker.list property.
  31. #
  32. #

  33. # OPTIONS ( very important for jni mode )

  34. #
  35. # workers.tomcat_home should point to the location where you
  36. # installed tomcat. This is where you have your conf, webapps and lib
  37. # directories.
  38. #
  39. #workers.tomcat_home=/var/tomcat3
  40. workers.tomcat_home=/usr/share/tomcat5

  41. #
  42. # workers.java_home should point to your Java installation. Normally
  43. # you should have a bin and lib directories beneath it.
  44. #
  45. #workers.java_home=/opt/IBMJava2-13
  46. workers.java_home=/usr/lib64/jvm/java-1.5.0-sun

  47. #
  48. # You should configure your environment slash... ps=\ on NT and / on UNIX
  49. # and maybe something different elsewhere.
  50. #
  51. ps=/

  52. #
  53. #------ ADVANCED MODE ------------------------------------------------
  54. #---------------------------------------------------------------------
  55. #

  56. #
  57. #------ DEFAULT worket list ------------------------------------------
  58. #---------------------------------------------------------------------
  59. #
  60. #
  61. # The workers that your plugins should create and work with
  62. #
  63. # Add 'inprocess' if you want JNI connector
  64. #worker.list=ajp12, ajp13
  65. worker.list=ajp13
  66. # , inprocess


  67. #
  68. #------ DEFAULT ajp12 WORKER DEFINITION ------------------------------
  69. #---------------------------------------------------------------------
  70. #

  71. #
  72. # Defining a worker named ajp12 and of type ajp12
  73. # Note that the name and the type do not have to match.
  74. #
  75. worker.ajp12.port=8007
  76. worker.ajp12.host=localhost
  77. worker.ajp12.type=ajp12
  78. #
  79. # Specifies the load balance factor when used with
  80. # a load balancing worker.
  81. # Note:
  82. #  ----> lbfactor must be > 0
  83. #  ----> Low lbfactor means less work done by the worker.
  84. worker.ajp12.lbfactor=1

  85. #
  86. #------ DEFAULT ajp13 WORKER DEFINITION ------------------------------
  87. #---------------------------------------------------------------------
  88. #

  89. #
  90. # Defining a worker named ajp13 and of type ajp13
  91. # Note that the name and the type do not have to match.
  92. #
  93. worker.ajp13.port=8009
  94. worker.ajp13.host=localhost
  95. worker.ajp13.type=ajp13
  96. #
  97. # Specifies the load balance factor when used with
  98. # a load balancing worker.
  99. # Note:
  100. #  ----> lbfactor must be > 0
  101. #  ----> Low lbfactor means less work done by the worker.
  102. worker.ajp13.lbfactor=1

  103. #
  104. # Specify the size of the open connection cache.
  105. #worker.ajp13.cachesize

  106. #
  107. #------ DEFAULT LOAD BALANCER WORKER DEFINITION ----------------------
  108. #---------------------------------------------------------------------
  109. #

  110. #
  111. # The loadbalancer (type lb) workers perform wighted round-robin
  112. # load balancing with sticky sessions.
  113. # Note:
  114. #  ----> If a worker dies, the load balancer will check its state
  115. #        once in a while. Until then all work is redirected to peer
  116. #        workers.
  117. worker.loadbalancer.type=lb
  118. #worker.loadbalancer.balanced_workers=ajp12, ajp13
  119. worker.loadbalancer.balanced_workers=ajp13


  120. #
  121. #------ DEFAULT JNI WORKER DEFINITION---------------------------------
  122. #---------------------------------------------------------------------
  123. #

  124. #
  125. # Defining a worker named inprocess and of type jni
  126. # Note that the name and the type do not have to match.
  127. #
  128. worker.inprocess.type=jni

  129. #
  130. #------ CLASSPATH DEFINITION -----------------------------------------
  131. #---------------------------------------------------------------------
  132. #

  133. #
  134. # Additional class path components.
  135. #
  136. #worker.inprocess.class_path=$(workers.tomcat_home)$(ps)lib$(ps)tomcat.jar

  137. #
  138. # Setting the command line for tomcat.
  139. # Note: The cmd_line string may not contain spaces.
  140. #
  141. worker.inprocess.cmd_line=start

  142. # Not needed, but can be customized.
  143. #worker.inprocess.cmd_line=-config
  144. #worker.inprocess.cmd_line=$(workers.tomcat_home)$(ps)conf$(ps)server.xml
  145. #worker.inprocess.cmd_line=-home
  146. #worker.inprocess.cmd_line=$(workers.tomcat_home)

  147. #
  148. # The JVM that we are about to use
  149. #
  150. # This is for Java2
  151. #
  152. # Windows
  153. #worker.inprocess.jvm_lib=$(workers.java_home)$(ps)jre$(ps)bin$(ps)classic$(ps)jvm.dll
  154. # IBM JDK1.3
  155. #worker.inprocess.jvm_lib=$(workers.java_home)$(ps)jre$(ps)bin$(ps)classic$(ps)libjvm.so
  156. # Unix - Sun VM or blackdown
  157. #worker.inprocess.jvm_lib=$(workers.java_home)$(ps)jre$(ps)lib$(ps)i386$(ps)classic$(ps)libjvm.so
  158. worker.inprocess.jvm_lib=$(workers.java_home)$(ps)jre$(ps)lib$(ps)i386$(ps)server$(ps)libjvm.so

  159. #
  160. # And this is for jdk1.1.X
  161. #
  162. #worker.inprocess.jvm_lib=$(workers.java_home)$(ps)bin$(ps)javai.dll


  163. #
  164. # Setting the place for the stdout and stderr of tomcat
  165. #
  166. worker.inprocess.stdout=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stdout
  167. worker.inprocess.stderr=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stderr

  168. #
  169. # Setting the tomcat.home Java property
  170. #
  171. #worker.inprocess.sysprops=tomcat.home=$(workers.tomcat_home)

  172. #
  173. # Java system properties
  174. #
  175. # worker.inprocess.sysprops=java.compiler=NONE
  176. # worker.inprocess.sysprops=myprop=mypropvalue

  177. #
  178. # Additional path components.
  179. #
  180. # worker.inprocess.ld_path=d:$(ps)SQLLIB$(ps)bin
  181. #

/etc/apache2/httpd.conf最終行に追加

httpd.conf

  1. Include /usr/share/tomcat5/conf/mod_jk.conf

/etc/java/java.conf

java.conf

  1. # System-wide Java configuration file                                -*- sh -*-
  2. #
  3. # JPackage Project <http://www.jpackage.org/>
  4. # Location of jar files on the system
  5. JAVA_LIBDIR=/usr/share/java

  6. # Location of arch-specific jar files on the system
  7. JNI_LIBDIR=/usr/lib64/java

  8. # Location of 32 bit arch-specific jar files on the system
  9. JNI_LIBDIR32=/usr/lib/java

  10. # Root of all native JVM installations
  11. JVM_ROOT=/usr/lib64/jvm

  12. # Root of all 32 bit JVM installations
  13. JVM_ROOT32=/usr/lib/jvm

  14. # You can define a system-wide JVM root here if you're not using the default one
  15. JAVA_HOME=$JVM_ROOT/java-1.5.0-sun

  16. # Options to pass to the java interpreter
  17. JAVACMD_OPTS=

/usr/share/tomcat5/conf/server.xml

server.xml

  1. <!-- Example Server Configuration File -->
  2. <!-- Note that component elements are nested corresponding to their
  3.      parent-child relationships with each other -->

  4. <!-- A "Server" is a singleton element that represents the entire JVM,
  5.      which may contain one or more "Service" instances.  The Server
  6.      listens for a shutdown command on the indicated port.

  7.      Note:  A "Server" is not itself a "Container", so you may not
  8.      define subcomponents such as "Valves" or "Loggers" at this level.
  9.  -->

  10. <Server port="8005" shutdown="SHUTDOWN" debug="0">


  11.   <!-- Comment these entries out to disable JMX MBeans support -->
  12.   <!-- You may also configure custom components (e.g. Valves/Realms) by
  13.        including your own mbean-descriptor file(s), and setting the
  14.        "descriptors" attribute to point to a ';' seperated list of paths
  15.        (in the ClassLoader sense) of files to add to the default list.
  16.        e.g. descriptors="/com/myfirm/mypackage/mbean-descriptor.xml"
  17.   -->
  18.   <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"
  19.             debug="0"/>
  20.   <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
  21.             debug="0"/>
  22. <!-- /usr/share/tomcat5/conf/auto/mod_jk.conf自動作成20070713 -->
  23.   <Listener className="org.apache.jk.config.ApacheConfig"
  24.           modJk="/usr/lib64/apache2-prefork/mod_jk.so"
  25.           workersConfig="/usr/share/tomcat5/conf/workers.properties"/>

  26.   <!-- Global JNDI resources -->
  27.   <GlobalNamingResources>

  28.     <!-- Test entry for demonstration purposes -->
  29.     <Environment name="simpleValue" type="java.lang.Integer" value="30"/>

  30.     <!-- Editable user database that can also be used by
  31.          UserDatabaseRealm to authenticate users -->
  32.     <Resource name="UserDatabase" auth="Container"
  33.               type="org.apache.catalina.UserDatabase"
  34.        description="User database that can be updated and saved">
  35.     </Resource>
  36.     <ResourceParams name="UserDatabase">
  37.       <parameter>
  38.         <name>factory</name>
  39.         <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
  40.       </parameter>
  41.       <parameter>
  42.         <name>pathname</name>
  43.         <value>conf/tomcat-users.xml</value>
  44.       </parameter>
  45.     </ResourceParams>

  46.   </GlobalNamingResources>

  47.   <!-- A "Service" is a collection of one or more "Connectors" that share
  48.        a single "Container" (and therefore the web applications visible
  49.        within that Container).  Normally, that Container is an "Engine",
  50.        but this is not required.

  51.        Note:  A "Service" is not itself a "Container", so you may not
  52.        define subcomponents such as "Valves" or "Loggers" at this level.
  53.    -->

  54.   <!-- Define the Tomcat Stand-Alone Service -->
  55.   <Service name="Catalina">

  56.     <!-- A "Connector" represents an endpoint by which requests are received
  57.          and responses are returned.  Each Connector passes requests on to the
  58.          associated "Container" (normally an Engine) for processing.

  59.          By default, a non-SSL HTTP/1.1 Connector is established on port 8080.
  60.          You can also enable an SSL HTTP/1.1 Connector on port 8443 by
  61.          following the instructions below and uncommenting the second Connector
  62.          entry.  SSL support requires the following steps (see the SSL Config
  63.          HOWTO in the Tomcat 5 documentation bundle for more detailed
  64.          instructions):
  65.          * If your JDK version 1.3 or prior, download and install JSSE 1.0.2 or
  66.            later, and put the JAR files into "$JAVA_HOME/jre/lib/ext".
  67.          * Execute:
  68.              %JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA (Windows)
  69.              $JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA  (Unix)
  70.            with a password value of "changeit" for both the certificate and
  71.            the keystore itself.

  72.          By default, DNS lookups are enabled when a web application calls
  73.          request.getRemoteHost().  This can have an adverse impact on
  74.          performance, so you can disable it by setting the
  75.          "enableLookups" attribute to "false".  When DNS lookups are disabled,
  76.          request.getRemoteHost() will return the String version of the
  77.          IP address of the remote client.
  78.     -->

  79.     <!-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8080 -->
  80.     <!-- <Connector port="8080"
  81.                maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
  82.                enableLookups="false" redirectPort="8443" acceptCount="100"
  83.                debug="0" connectionTimeout="20000"
  84.                disableUploadTimeout="true" /> -->
  85.     <!-- Note : To disable connection timeouts, set connectionTimeout value
  86.      to 0 -->
  87.    
  88.     <!-- Note : To use gzip compression you could set the following properties :
  89.    
  90.                compression="on"
  91.                compressionMinSize="2048"
  92.                noCompressionUserAgents="gozilla, traviata"
  93.                compressableMimeType="text/html,text/xml"
  94.     -->

  95.     <!-- Define a SSL Coyote HTTP/1.1 Connector on port 8443 -->
  96.     <!--
  97.     <Connector port="8443"
  98.                maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
  99.                enableLookups="false" disableUploadTimeout="true"
  100.                acceptCount="100" debug="0" scheme="https" secure="true"
  101.                clientAuth="false" sslProtocol="TLS" />
  102.     -->

  103.     <!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 -->
  104.     <Connector port="8009"
  105.                enableLookups="false" redirectPort="8443" debug="0"
  106.                protocol="AJP/1.3" />

  107.     <!-- Define a Proxied HTTP/1.1 Connector on port 8082 -->
  108.     <!-- See proxy documentation for more information about using this. -->
  109.     <!--
  110.     <Connector port="8082"
  111.                maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
  112.                enableLookups="false"
  113.                acceptCount="100" debug="0" connectionTimeout="20000"
  114.                proxyPort="80" disableUploadTimeout="true" />
  115.     -->

  116.     <!-- An Engine represents the entry point (within Catalina) that processes
  117.          every request.  The Engine implementation for Tomcat stand alone
  118.          analyzes the HTTP headers included with the request, and passes them
  119.          on to the appropriate Host (virtual host). -->

  120.     <!-- You should set jvmRoute to support load-balancing via JK/JK2 ie :
  121.     <Engine name="Standalone" defaultHost="localhost" debug="0" jvmRoute="jvm1">        
  122.     -->
  123.         
  124.     <!-- Define the top level container in our container hierarchy -->
  125.     <Engine name="Catalina" defaultHost="localhost" debug="0">

  126.       <!-- The request dumper valve dumps useful debugging information about
  127.            the request headers and cookies that were received, and the response
  128.            headers and cookies that were sent, for all requests received by
  129.            this instance of Tomcat.  If you care only about requests to a
  130.            particular virtual host, or a particular application, nest this
  131.            element inside the corresponding <Host> or <Context> entry instead.

  132.            For a similar mechanism that is portable to all Servlet 2.4
  133.            containers, check out the "RequestDumperFilter" Filter in the
  134.            example application (the source for this filter may be found in
  135.            "$CATALINA_HOME/webapps/examples/WEB-INF/classes/filters").

  136.            Request dumping is disabled by default.  Uncomment the following
  137.            element to enable it. -->
  138.       <!--
  139.       <Valve className="org.apache.catalina.valves.RequestDumperValve"/>
  140.       -->

  141.       <!-- Global logger unless overridden at lower levels -->
  142.       <Logger className="org.apache.catalina.logger.FileLogger"
  143.               prefix="catalina_log" suffix=".txt"
  144.               timestamp="false"/>

  145.       <!-- Because this Realm is here, an instance will be shared globally -->

  146.       <!-- This Realm uses the UserDatabase configured in the global JNDI
  147.            resources under the key "UserDatabase".  Any edits
  148.            that are performed against this UserDatabase are immediately
  149.            available for use by the Realm.  -->
  150.       <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
  151.                  debug="0" resourceName="UserDatabase"/>

  152.       <!-- Comment out the old realm but leave here for now in case we
  153.            need to go back quickly -->
  154.       <!--
  155.       <Realm className="org.apache.catalina.realm.MemoryRealm" />
  156.       -->

  157.       <!-- Replace the above Realm with one of the following to get a Realm
  158.            stored in a database and accessed via JDBC -->

  159.       <!--
  160.       <Realm  className="org.apache.catalina.realm.JDBCRealm" debug="99"
  161.              driverName="org.gjt.mm.mysql.Driver"
  162.           connectionURL="jdbc:mysql://localhost/authority"
  163.          connectionName="test" connectionPassword="test"
  164.               userTable="users" userNameCol="user_name" userCredCol="user_pass"
  165.           userRoleTable="user_roles" roleNameCol="role_name" />
  166.       -->

  167.       <!--
  168.       <Realm  className="org.apache.catalina.realm.JDBCRealm" debug="99"
  169.              driverName="oracle.jdbc.driver.OracleDriver"
  170.           connectionURL="jdbc:oracle:thin:@ntserver:1521:ORCL"
  171.          connectionName="scott" connectionPassword="tiger"
  172.               userTable="users" userNameCol="user_name" userCredCol="user_pass"
  173.           userRoleTable="user_roles" roleNameCol="role_name" />
  174.       -->

  175.       <!--
  176.       <Realm  className="org.apache.catalina.realm.JDBCRealm" debug="99"
  177.              driverName="sun.jdbc.odbc.JdbcOdbcDriver"
  178.           connectionURL="jdbc:odbc:CATALINA"
  179.               userTable="users" userNameCol="user_name" userCredCol="user_pass"
  180.           userRoleTable="user_roles" roleNameCol="role_name" />
  181.       -->

  182.       <!-- Define the default virtual host
  183.            Note: XML Schema validation will not work with Xerces 2.2.
  184.        -->
  185.       <Host name="localhost" debug="0" appBase="webapps"
  186.        unpackWARs="true" autoDeploy="true"
  187.        xmlValidation="false" xmlNamespaceAware="false">

  188.         <!-- Defines a cluster for this node,
  189.              By defining this element, means that every manager will be changed.
  190.              So when running a cluster, only make sure that you have webapps in there
  191.              that need to be clustered and remove the other ones.
  192.              A cluster has the following parameters:

  193.              className = the fully qualified name of the cluster class

  194.              name = a descriptive name for your cluster, can be anything

  195.              debug = the debug level, higher means more output

  196.              mcastAddr = the multicast address, has to be the same for all the nodes

  197.              mcastPort = the multicast port, has to be the same for all the nodes
  198.             
  199.              mcastBindAddr = bind the multicast socket to a specific address
  200.             
  201.              mcastTTL = the multicast TTL if you want to limit your broadcast
  202.             
  203.              mcastSoTimeout = the multicast readtimeout

  204.              mcastFrequency = the number of milliseconds in between sending a "I'm alive" heartbeat

  205.              mcastDropTime = the number a milliseconds before a node is considered "dead" if no heartbeat is received

  206.              tcpThreadCount = the number of threads to handle incoming replication requests, optimal would be the same amount of threads as nodes

  207.              tcpListenAddress = the listen address (bind address) for TCP cluster request on this host,
  208.                                 in case of multiple ethernet cards.
  209.                                 auto means that address becomes
  210.                                 InetAddress.getLocalHost().getHostAddress()

  211.              tcpListenPort = the tcp listen port

  212.              tcpSelectorTimeout = the timeout (ms) for the Selector.select() method in case the OS
  213.                                   has a wakup bug in java.nio. Set to 0 for no timeout

  214.              printToScreen = true means that managers will also print to std.out

  215.              expireSessionsOnShutdown = true means that

  216.              useDirtyFlag = true means that we only replicate a session after setAttribute,removeAttribute has been called.
  217.                             false means to replicate the session after each request.
  218.                             false means that replication would work for the following piece of code:
  219.                             <%
  220.                             HashMap map = (HashMap)session.getAttribute("map");
  221.                             map.put("key","value");
  222.                             %>
  223.              replicationMode = can be either 'pooled', 'synchronous' or 'asynchronous'.
  224.                                * Pooled means that the replication happens using several sockets in a synchronous way. Ie, the data gets replicated, then the request return. This is the same as the 'synchronous' setting except it uses a pool of sockets, hence it is multithreaded. This is the fastest and safest configuration. To use this, also increase the nr of tcp threads that you have dealing with replication.
  225.                                * Synchronous means that the thread that executes the request, is also the
  226.                                thread the replicates the data to the other nodes, and will not return until all
  227.                                nodes have received the information.
  228.                                * Asynchronous means that there is a specific 'sender' thread for each cluster node,
  229.                                so the request thread will queue the replication request into a "smart" queue,
  230.                                and then return to the client.
  231.                                The "smart" queue is a queue where when a session is added to the queue, and the same session
  232.                                already exists in the queue from a previous request, that session will be replaced
  233.                                in the queue instead of replicating two requests. This almost never happens, unless there is a
  234.                                large network delay.
  235.         -->            
  236.         <!--
  237.             When configuring for clustering, you also add in a valve to catch all the requests
  238.             coming in, at the end of the request, the session may or may not be replicated.
  239.             A session is replicated if and only if all the conditions are met:
  240.             1. useDirtyFlag is true or setAttribute or removeAttribute has been called AND
  241.             2. a session exists (has been created)
  242.             3. the request is not trapped by the "filter" attribute

  243.             The filter attribute is to filter out requests that could not modify the session,
  244.             hence we don't replicate the session after the end of this request.
  245.             The filter is negative, ie, anything you put in the filter, you mean to filter out,
  246.             ie, no replication will be done on requests that match one of the filters.
  247.             The filter attribute is delimited by ;, so you can't escape out ; even if you wanted to.

  248.             filter=".*\.gif;.*\.js;" means that we will not replicate the session after requests with the URI
  249.             ending with .gif and .js are intercepted.
  250.            
  251.             The deployer element can be used to deploy apps cluster wide.
  252.             Currently the deployment only deploys/undeploys to working members in the cluster
  253.             so no WARs are copied upons startup of a broken node.
  254.             The deployer watches a directory (watchDir) for WAR files when watchEnabled="true"
  255.             When a new war file is added the war gets deployed to the local instance,
  256.             and then deployed to the other instances in the cluster.
  257.             When a war file is deleted from the watchDir the war is undeployed locally
  258.             and cluster wide
  259.         -->
  260.        
  261.         <!--
  262.         <Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
  263.                  managerClassName="org.apache.catalina.cluster.session.DeltaManager"
  264.                  expireSessionsOnShutdown="false"
  265.                  useDirtyFlag="true">

  266.             <Membership
  267.                 className="org.apache.catalina.cluster.mcast.McastService"
  268.                 mcastAddr="228.0.0.4"
  269.                 mcastPort="45564"
  270.                 mcastFrequency="500"
  271.                 mcastDropTime="3000"/>

  272.             <Receiver
  273.                 className="org.apache.catalina.cluster.tcp.ReplicationListener"
  274.                 tcpListenAddress="auto"
  275.                 tcpListenPort="4001"
  276.                 tcpSelectorTimeout="100"
  277.                 tcpThreadCount="6"/>

  278.             <Sender
  279.                 className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
  280.                 replicationMode="pooled"/>

  281.             <Valve className="org.apache.catalina.cluster.tcp.ReplicationValve"
  282.                    filter=".*\.gif;.*\.js;.*\.jpg;.*\.htm;.*\.html;.*\.txt;"/>
  283.                   
  284.             <Deployer className="org.apache.catalina.cluster.deploy.FarmWarDeployer"
  285.                       tempDir="/tmp/war-temp/"
  286.                       deployDir="/tmp/war-deploy/"
  287.                       watchDir="/tmp/war-listen/"
  288.                       watchEnabled="false"/>
  289.         </Cluster>
  290.         -->       



  291.         <!-- Normally, users must authenticate themselves to each web app
  292.              individually.  Uncomment the following entry if you would like
  293.              a user to be authenticated the first time they encounter a
  294.              resource protected by a security constraint, and then have that
  295.              user identity maintained across *all* web applications contained
  296.              in this virtual host. -->
  297.         <!--
  298.         <Valve className="org.apache.catalina.authenticator.SingleSignOn"
  299.                    debug="0"/>
  300.         -->

  301.         <!-- Access log processes all requests for this virtual host.  By
  302.              default, log files are created in the "logs" directory relative to
  303.              $CATALINA_HOME.  If you wish, you can specify a different
  304.              directory with the "directory" attribute.  Specify either a relative
  305.              (to $CATALINA_HOME) or absolute path to the desired directory.
  306.         -->
  307.         <!--
  308.         <Valve className="org.apache.catalina.valves.AccessLogValve"
  309.                  directory="logs"  prefix="localhost_access_log." suffix=".txt"
  310.                  pattern="common" resolveHosts="false"/>
  311.         -->

  312.         <!-- Logger shared by all Contexts related to this virtual host.  By
  313.              default (when using FileLogger), log files are created in the "logs"
  314.              directory relative to $CATALINA_HOME.  If you wish, you can specify
  315.              a different directory with the "directory" attribute.  Specify either a
  316.              relative (to $CATALINA_HOME) or absolute path to the desired
  317.              directory.-->
  318.         <Logger className="org.apache.catalina.logger.FileLogger"
  319.                  directory="logs"  prefix="localhost_log" suffix=".txt"
  320.             timestamp="false"/>

  321.       </Host>

  322.     </Engine>

  323.   </Service>

  324. </Server>
  325.  

  326. /usr/share/tomcat5/conf/web.xml

web.xml

  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
  3.     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4.     xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
  5.     version="2.4">

  6.   <!-- ======================== Introduction ============================== -->
  7.   <!-- This document defines default values for *all* web applications      -->
  8.   <!-- loaded into this instance of Tomcat.  As each application is         -->
  9.   <!-- deployed, this file is processed, followed by the                    -->
  10.   <!-- "/WEB-INF/web.xml" deployment descriptor from your own               -->
  11.   <!-- applications.                                                        -->
  12.   <!--                                                                      -->
  13.   <!-- WARNING:  Do not configure application-specific resources here!      -->
  14.   <!-- They should go in the "/WEB-INF/web.xml" file in your application.   -->


  15.   <!-- ================== Built In Servlet Definitions ==================== -->


  16.   <!-- The default servlet for all web applications, that serves static     -->
  17.   <!-- resources.  It processes all requests that are not mapped to other   -->
  18.   <!-- servlets with servlet mappings (defined either here or in your own   -->
  19.   <!-- web.xml file.  This servlet supports the following initialization    -->
  20.   <!-- parameters (default values are in square brackets):                  -->
  21.   <!--                                                                      -->
  22.   <!--   debug               Debugging detail level for messages logged     -->
  23.   <!--                       by this servlet.  [0]                          -->
  24.   <!--                                                                      -->
  25.   <!--   input               Input buffer size (in bytes) when reading      -->
  26.   <!--                       resources to be served.  [2048]                -->
  27.   <!--                                                                      -->
  28.   <!--   listings            Should directory listings be produced if there -->
  29.   <!--                       is no welcome file in this directory?  [true]  -->
  30.   <!--                                                                      -->
  31.   <!--   output              Output buffer size (in bytes) when writing     -->
  32.   <!--                       resources to be served.  [2048]                -->
  33.   <!--                                                                      -->
  34.   <!--   readonly            Is this context "read only", so HTTP           -->
  35.   <!--                       commands like PUT and DELETE are               -->
  36.   <!--                       rejected?  [true]                              -->
  37.   <!--                                                                      -->
  38.   <!--   readmeFile          File name to display with the directory        -->
  39.   <!--                       contents. [null]                               -->
  40.   <!--                                                                      -->
  41.   <!--  For directory listing customization. Checks localXsltFile, then     -->
  42.   <!--  globalXsltFile, then defaults to original behavior.                 -->
  43.   <!--                                                                      -->
  44.   <!--   localXsltFile       Make directory listings an XML doc and         -->
  45.   <!--                       pass the result to this style sheet residing   -->
  46.   <!--                       in that directory. This overrides              -->
  47.   <!--                        globalXsltFile[null]                          -->
  48.   <!--                                                                      -->
  49.   <!--   globalXsltFile      Site wide configuration version of             -->
  50.   <!--                       localXsltFile This argument is expected        -->
  51.   <!--                       to be a physical file. [null]                  -->
  52.   <!--                                                                      -->
  53.   <!--                                                                      -->

  54.     <servlet>
  55.         <servlet-name>default</servlet-name>
  56.         <servlet-class>
  57.           org.apache.catalina.servlets.DefaultServlet
  58.         </servlet-class>
  59.         <init-param>
  60.             <param-name>debug</param-name>
  61.             <param-value>0</param-value>
  62.         </init-param>
  63.         <init-param>
  64.             <param-name>listings</param-name>
  65.             <param-value>false</param-value>
  66.         </init-param>
  67.         <load-on-startup>1</load-on-startup>
  68.     </servlet>


  69.   <!-- The "invoker" servlet, which executes anonymous servlet classes      -->
  70.   <!-- that have not been defined in a web.xml file.  Traditionally, this   -->
  71.   <!-- servlet is mapped to the URL pattern "/servlet/*", but you can map   -->
  72.   <!-- it to other patterns as well.  The extra path info portion of such a -->
  73.   <!-- request must be the fully qualified class name of a Java class that  -->
  74.   <!-- implements Servlet (or extends HttpServlet), or the servlet name     -->
  75.   <!-- of an existing servlet definition.     This servlet supports the     -->
  76.   <!-- following initialization parameters (default values are in square    -->
  77.   <!-- brackets):                                                           -->
  78.   <!--                                                                      -->
  79.   <!--   debug               Debugging detail level for messages logged     -->
  80.   <!--                       by this servlet.  [0]                          -->

  81. <!--
  82.     <servlet>
  83.         <servlet-name>invoker</servlet-name>
  84.         <servlet-class>
  85.           org.apache.catalina.servlets.InvokerServlet
  86.         </servlet-class>
  87.         <init-param>
  88.             <param-name>debug</param-name>
  89.             <param-value>0</param-value>
  90.         </init-param>
  91.         <load-on-startup>2</load-on-startup>
  92.     </servlet>
  93. -->


  94.   <!-- The JSP page compiler and execution servlet, which is the mechanism  -->
  95.   <!-- used by Tomcat to support JSP pages.  Traditionally, this servlet    -->
  96.   <!-- is mapped to the URL pattern "*.jsp".  This servlet supports the     -->
  97.   <!-- following initialization parameters (default values are in square    -->
  98.   <!-- brackets):                                                           -->
  99.   <!--                                                                      -->
  100.   <!--   checkInterval       If development is false and reloading is true, -->
  101.   <!--                       background compiles are enabled. checkInterval -->
  102.   <!--                       is the time in seconds between checks to see   -->
  103.   <!--                       if a JSP page needs to be recompiled. [300]    -->
  104.   <!--                                                                      -->
  105.   <!--   compiler            Which compiler Ant should use to compile JSP   -->
  106.   <!--                       pages.  See the Ant documentation for more     -->
  107.   <!--                       information. [javac]                           -->
  108.   <!--                                                                      -->
  109.   <!--   classdebuginfo      Should the class file be compiled with         -->
  110.   <!--                       debugging information?  [true]                 -->
  111.   <!--                                                                      -->
  112.   <!--   classpath           What class path should I use while compiling   -->
  113.   <!--                       generated servlets?  [Created dynamically      -->
  114.   <!--                       based on the current web application]          -->
  115.   <!--                                                                      -->
  116.   <!--   development         Is Jasper used in development mode (will check -->
  117.   <!--                       for JSP modification on every access)?  [true] -->
  118.   <!--                                                                      -->
  119.   <!--   enablePooling       Determines whether tag handler pooling is      -->
  120.   <!--                       enabled  [true]                                -->
  121.   <!--                                                                      -->
  122.   <!--   fork                Tell Ant to fork compiles of JSP pages so that -->
  123.   <!--                       a separate JVM is used for JSP page compiles   -->
  124.   <!--                       from the one Tomcat is running in. [true]      -->
  125.   <!--                                                                      -->
  126.   <!--   ieClassId           The class-id value to be sent to Internet      -->
  127.   <!--                       Explorer when using <jsp:plugin> tags.         -->
  128.   <!--                       [clsid:8AD9C840-044E-11D1-B3E9-00805F499D93]   -->
  129.   <!--                                                                      -->
  130.   <!--   javaEncoding        Java file encoding to use for generating java  -->
  131.   <!--                       source files. [UTF8]                           -->
  132.   <!--                                                                      -->
  133.   <!--   keepgenerated       Should we keep the generated Java source code  -->
  134.   <!--                       for each page instead of deleting it? [true]   -->
  135.   <!--                                                                      -->
  136.   <!--   mappedfile          Should we generate static content with one     -->
  137.   <!--                       print statement per input line, to ease        -->
  138.   <!--                       debugging?  [true]                            -->
  139.   <!--                                                                      -->
  140.   <!--   trimSpaces          Should white spaces in template text between   -->
  141.   <!--                       actions or directives be trimmed?  [false]     -->
  142.   <!--                                                                      -->
  143.   <!--   reloading           Should Jasper check for modified JSPs?  [true] -->
  144.   <!--                                                                      -->
  145.   <!--   suppressSmap        Should the generation of SMAP info for JSR45   -->
  146.   <!--                       debugging be suppressed?  [false]              -->
  147.   <!--                                                                      -->
  148.   <!--   dumpSmap            Should the SMAP info for JSR45 debugging be    -->
  149.   <!--                       dumped to a file? [false]                      -->
  150.   <!--                       False if suppressSmap is true                  -->
  151.   <!--                                                                      -->
  152.   <!--   genStrAsCharArray   Should text strings be generated as char       -->
  153.   <!--                       arrays, to improve performance in some cases?  -->
  154.   <!--                       [false]                                        -->
  155.   <!--                                                                      -->
  156.   <!--   errorOnUseBeanInvalidClassAttribute                                -->
  157.   <!--                       Should Jasper issue an error when the value of -->
  158.   <!--                       the class attribute in an useBean action is    -->
  159.   <!--                       not a valid bean class?  [true]                -->
  160.   <!--                                                                      -->
  161.   <!--   scratchdir          What scratch directory should we use when      -->
  162.   <!--                       compiling JSP pages?  [default work directory  -->
  163.   <!--                       for the current web application]               -->
  164.   <!--                                                                      -->
  165.   <!--   xpoweredBy          Determines whether X-Powered-By response       -->
  166.   <!--                       header is added by generated servlet  [false]  -->
  167.   <!--                                                                      -->
  168.   <!-- If you wish to use Jikes to compile JSP pages:                       -->
  169.   <!--   Set the init parameter "compiler" to "jikes".  Define              -->
  170.   <!--   the property "-Dbuild.compiler.emacs=true" when starting Tomcat    -->
  171.   <!--   by adding the above to your CATALINA_OPTS environment variable.    -->
  172.   <!--   If you get an error reporting that jikes can't use UTF8 encoding,  -->
  173.   <!--   try setting the init parameter "javaEncoding" to "ISO-8859-1".     -->

  174.     <servlet>
  175.         <servlet-name>jsp</servlet-name>
  176.         <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
  177.         <init-param>
  178.             <param-name>fork</param-name>
  179.             <param-value>false</param-value>
  180.         </init-param>
  181.         <init-param>
  182.             <param-name>xpoweredBy</param-name>
  183.             <param-value>false</param-value>
  184.         </init-param>
  185.         <load-on-startup>3</load-on-startup>
  186.     </servlet>


  187.   <!-- Server Side Includes processing servlet, which processes SSI         -->
  188.   <!-- directives in HTML pages consistent with