|
Added
Link Here
|
| 1 |
<?xml version="1.0" encoding="utf-8"?> |
| 2 |
<chapter id="configuring"> |
| 3 |
<title>Configuration</title> |
| 4 |
<titleabbrev>Configuration</titleabbrev> |
| 5 |
<section id="configuring-tomcat"> |
| 6 |
<title>Configuring the Embedded Tomcat Servlet Container</title> |
| 7 |
<para> |
| 8 |
@product.name@ |
| 9 |
embeds an OSGi-enhanced version of the <ulink url="http://tomcat.apache.org/">Tomcat Servlet Container</ulink> |
| 10 |
in order to provide support for deploying Java EE WARs and OSGi <emphasis>Web Application Bundles</emphasis>. |
| 11 |
You configure the embedded Servlet container using the standard Apache Tomcat configuration. |
| 12 |
The main difference is that the configuration file is called <filename>tomcat-server.xml</filename> rather than <literal>server.xml</literal>. |
| 13 |
If you do not want to use the default settings, you can provide the <literal>tomcat-server.xml</literal> file located in the <literal>$GW_HOME/config</literal> directory. |
| 14 |
</para> |
| 15 |
<para>Here's an extract of the default configuration distributed with the @short.product.name@. |
| 16 |
</para> |
| 17 |
<programlisting language="xml"><![CDATA[<?xml version='1.0' encoding='utf-8'?> |
| 18 |
<Server port="8005" shutdown="SHUTDOWN"> |
| 19 |
<Listener className="org.apache.catalina.core.JasperListener" /> |
| 20 |
<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" /> |
| 21 |
|
| 22 |
<Service name="Catalina"> |
| 23 |
|
| 24 |
<Connector port="8080" protocol="HTTP/1.1" |
| 25 |
connectionTimeout="20000" |
| 26 |
redirectPort="8443" /> |
| 27 |
|
| 28 |
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> |
| 29 |
|
| 30 |
<Engine name="Catalina" defaultHost="localhost"> |
| 31 |
|
| 32 |
<Host name="localhost" deployOnStartup="false" autoDeploy="false" |
| 33 |
unpackWARs="true" xmlValidation="false" xmlNamespaceAware="false"> |
| 34 |
|
| 35 |
</Host> |
| 36 |
</Engine> |
| 37 |
</Service> |
| 38 |
</Server>]]></programlisting> |
| 39 |
<section id="overview-tomcat-servlet-container"> |
| 40 |
<title>Description of the Default Apache Tomcat Configuration</title> |
| 41 |
<para> |
| 42 |
The following bullets describe the main elements and attributes in the default <literal>tomcat-server.xml</literal> file; for details about updating this file to further configure the embedded Apache Tomcat server, see the <ulink url="http://tomcat.apache.org/tomcat-6.0-doc/config/index.html">Apache Tomcat Configuration Reference</ulink>. |
| 43 |
</para> |
| 44 |
<tip> |
| 45 |
<title>Relative paths</title> |
| 46 |
<para>If the configured path to a directory or file does not represent an absolute path, @short.product.name@ typically interprets it as a path relative to the <filename>$GW_HOME</filename> directory.</para> |
| 47 |
</tip> |
| 48 |
<itemizedlist> |
| 49 |
<listitem> |
| 50 |
<para>The root element of the <literal>tomcat-server.xml</literal> file is <literal><Server></literal>. The attributes of this element represent the characteristics of the entire embedded Tomcat servlet container. The <literal>shutdown</literal> attribute specifies the command string that the shutdown port number receives via a TCP/IP connection in order to shut down the servlet container. The <literal>port</literal> attribute specifies the TCP/IP port number that listens for a shutdown message.</para> |
| 51 |
</listitem> |
| 52 |
<listitem> |
| 53 |
<para>The <literal><Listener></literal> XML elements specify the list of lifecycle listeners that monitor and manage the embedded Tomcat servlet container. Each listener class is a Java Management Extensions (JMX) MBean that listens to a specific component of the servlet container and has been programmed to do something at certain lifecycle events of the component, such as before starting up, after stopping, and so on.</para> |
| 54 |
</listitem> |
| 55 |
<listitem> |
| 56 |
<para>The <literal><Service></literal> XML element groups together one or more connectors and a single engine. Connectors define a transport mechanism, such as HTTP, that clients use to to send and receive messages to and from the associated service. There are many transports that a client can use, which is why a <literal><Service></literal> element can have many <literal><Connector></literal> elements. The engine then defines how these requests and responses that the connector receives and sends are in turn handled by the servlet container; you can define only a single <literal><Engine></literal> element for any given <literal><Service></literal> element.</para> |
| 57 |
<para>The sample <literal>tomcat-server.xml</literal> file above includes two <literal><Connector></literal> elements: one for the HTTP transport, and one for the AJP transport. The file also includes a single <literal><Engine></literal> element, as required.</para> |
| 58 |
</listitem> |
| 59 |
<listitem> |
| 60 |
<para>The first connector listens for HTTP requests at the <literal>8080</literal> TCP/IP port. The connector, after accepting a connection from a client, waits for a maximum of 20000 milliseconds for a request URI; if it does not receive one from the client by then, the connector times out. If this connector receives a request from the client that requires the SSL transport, the servlet container automatically redirects the request to port <literal>8443</literal>. </para> |
| 61 |
</listitem> |
| 62 |
<listitem> |
| 63 |
<para>The second AJP Connector element represents a Connector component that communicates with a web connector via the AJP protocol. </para> |
| 64 |
</listitem> |
| 65 |
<listitem> |
| 66 |
<para> |
| 67 |
The engine has a logical name of <literal>Catalina</literal>; this is the name used in all log and error messages so you can easily identify problems. |
| 68 |
The value of the <literal>defaultHost</literal> attribute refers to the name of a <literal><Host></literal> child element of <literal><Engine></literal>; this host processes requests directed to host names on this servlet container. |
| 69 |
</para> |
| 70 |
</listitem> |
| 71 |
<listitem> |
| 72 |
<para> |
| 73 |
The <literal><Host></literal> child element represents a virtual host, which is an association of a network name for a server (such as <literal>www.mycompany.com</literal>) with the particular server on which Catalina is running. |
| 74 |
The <literal>xmlValidation</literal> attribute specifies that the servlet container does not validate XML files when parsing them, or in other words, it accepts invalid XML. |
| 75 |
The <literal>xmlNamespaceAware</literal> attribute specifies that the servlet container does not take namespaces into account when reading XML files. |
| 76 |
</para> |
| 77 |
</listitem> |
| 78 |
</itemizedlist> |
| 79 |
</section> |
| 80 |
<section id="configuring-tomcat-connectors"> |
| 81 |
<title>Connector Configuration</title> |
| 82 |
<para>The @product.name@ supports the configuration of any connector supported by Apache Tomcat. |
| 83 |
See the default configuration above for syntax examples, and for further details of the configuration properties supported for various <literal><Connector></literal> implementations, consult the official <ulink url="http://tomcat.apache.org/tomcat-6.0-doc/config/http.html">Tomcat HTTP Connector</ulink> documentation. |
| 84 |
For detailed instructions on how to configure Tomcat's SSL support, consult the official <ulink url="http://tomcat.apache.org/tomcat-6.0-doc/ssl-howto.html">Tomcat SSL Configuration HOW-TO</ulink>. |
| 85 |
</para> |
| 86 |
</section> |
| 87 |
<section id="configuring-tomcat-clustering"> |
| 88 |
<title>Cluster Configuration</title> |
| 89 |
<para> |
| 90 |
@product.name@ supports standard Apache Tomcat cluster configuration. |
| 91 |
By default, clustering of the embedded servlet container is disabled, and the default configuration does not include any clustering information. |
| 92 |
See <ulink url="http://tomcat.apache.org/tomcat-6.0-doc/cluster-howto.html">Tomcat Clustering/Session Replication HOW-TO</ulink> for detailed information about enabling and configuring clustering. |
| 93 |
</para> |
| 94 |
</section> |
| 95 |
<section id="configuring-tomcat-contexts"> |
| 96 |
<title>Context Configuration</title> |
| 97 |
<para> |
| 98 |
@product.name@ supports standard Apache Tomcat web application context configuration. |
| 99 |
The <ulink url="http://tomcat.apache.org/tomcat-6.0-doc/config/index.html">Apache Tomcat Configuration Reference</ulink> has a section on |
| 100 |
<ulink url="http://tomcat.apache.org/tomcat-6.0-doc/config/context.html">The Context Container</ulink> which describes the mechanism that |
| 101 |
is used in @short.product.name@ for searching context configuration files and details the context configuration properties. |
| 102 |
</para> |
| 103 |
<para> |
| 104 |
Context configuration files may be placed in the following locations, |
| 105 |
where <literal>[enginename]</literal> is the name of Tomcat's engine ('Catalina' by default) and <literal>[hostname]</literal> names |
| 106 |
a virtual host ('localhost' by default), both of which are configured in <literal>tomcat-server.xml</literal>: |
| 107 |
<itemizedlist><listitem><para><literal>$GW_HOME/config/context.xml</literal> provides the default context configuration file for all web applications. |
| 108 |
</para></listitem><listitem><para> |
| 109 |
The <literal>$GW_HOME/config/[enginename]/[hostname]</literal> directory may contain: |
| 110 |
<itemizedlist><listitem><para> |
| 111 |
The default context configuration for all web applications of a given virtual host in the file <literal>context.xml.default</literal>. |
| 112 |
</para></listitem><listitem><para> |
| 113 |
Individual web applications' context configuration files as described in the Apache Tomcat Configuration Reference. |
| 114 |
For example, the context for a web application with |
| 115 |
context path <literal>foo</literal> may be configured in <literal>foo.xml</literal>. |
| 116 |
</para></listitem></itemizedlist></para></listitem></itemizedlist></para> |
| 117 |
<para> |
| 118 |
Note that the following context configuration features are not supported in @product.name@: |
| 119 |
<itemizedlist><listitem><para> |
| 120 |
Custom class loaders. |
| 121 |
</para></listitem><listitem><para> |
| 122 |
Specifying the context path. This is specified using the <literal>Web-ContextPath</literal> header in the web application's |
| 123 |
<literal>MANIFEST.MF</literal> file. |
| 124 |
</para></listitem><listitem><para> |
| 125 |
Specifying the document base directory. |
| 126 |
</para></listitem></itemizedlist></para> |
| 127 |
</section> |
| 128 |
</section> |
| 129 |
<section id="configuring-osgi-framework"> |
| 130 |
<title>Configuring the OSGi Framework</title> |
| 131 |
<para> |
| 132 |
This section provides information about configuring the OSGi framework by updating the following files in the |
| 133 |
<literal>$GW_HOME/configuration</literal> directory: |
| 134 |
</para> |
| 135 |
<table id="configuring-osgi-framework-table" colsep="1" frame="all" rowsep="1"> |
| 136 |
<title>OSGi Framework Configuration Files </title> |
| 137 |
<tgroup cols="2"> |
| 138 |
<thead> |
| 139 |
<row> |
| 140 |
<entry>Property File</entry> |
| 141 |
<entry>Description</entry> |
| 142 |
</row> |
| 143 |
</thead> |
| 144 |
<tbody> |
| 145 |
<row> |
| 146 |
<entry> |
| 147 |
<literal>config.ini</literal> |
| 148 |
</entry> |
| 149 |
<entry>Configures the <link linkend="configuring-framework-properties">OSGi framework properties</link>.</entry> |
| 150 |
</row> |
| 151 |
<row> |
| 152 |
<entry> |
| 153 |
<literal>java6-server.profile</literal> |
| 154 |
</entry> |
| 155 |
<entry>Configures the <link linkend="configuring-framework-profile">OSGi framework profile</link>.</entry> |
| 156 |
</row> |
| 157 |
</tbody> |
| 158 |
</tgroup> |
| 159 |
</table> |
| 160 |
<section id="configuring-framework-properties"> |
| 161 |
<title>Configuring OSGi Framework Properties</title> |
| 162 |
<para> |
| 163 |
You specify the framework properties in the <literal>$GW_HOME/configuration/config.ini</literal> file. |
| 164 |
The properties relevant to users are described in the following table. |
| 165 |
</para> |
| 166 |
<table id="configuring-framework-properties-table" colsep="1" frame="all" rowsep="1"> |
| 167 |
<title>Framework Properties</title> |
| 168 |
<tgroup cols="2"> |
| 169 |
<thead> |
| 170 |
<row> |
| 171 |
<entry>Property</entry> |
| 172 |
<entry>Description</entry> |
| 173 |
</row> |
| 174 |
</thead> |
| 175 |
<tbody> |
| 176 |
<row> |
| 177 |
<entry> |
| 178 |
<literal>osgi.bundles</literal> |
| 179 |
</entry> |
| 180 |
<entry> |
| 181 |
The comma-separated list of bundles which are automatically installed and optionally started once the system is up and running. |
| 182 |
</entry> |
| 183 |
</row> |
| 184 |
<row> |
| 185 |
<entry> |
| 186 |
<literal>osgi.java.profile</literal> |
| 187 |
</entry> |
| 188 |
<entry> |
| 189 |
Specifies the profile to use using a <literal>file:</literal> URI with default value |
| 190 |
<literal>file:configuration/java6-server.profile</literal>. |
| 191 |
</entry> |
| 192 |
</row> |
| 193 |
</tbody> |
| 194 |
</tgroup> |
| 195 |
</table> |
| 196 |
</section> |
| 197 |
<section id="configuring-framework-profile"> |
| 198 |
<title>Configuring OSGi Framework Profile</title> |
| 199 |
<para> |
| 200 |
You specify the framework profile in the <literal>$GW_HOME/configuration/java6-server.profile</literal> file. |
| 201 |
The properties relevant to users are described in the following table. |
| 202 |
</para> |
| 203 |
<para> |
| 204 |
<emphasis role="bold">WARNING:</emphasis> We advise you not to change the framework profile unless you are sure you know exactly what |
| 205 |
you are doing; updating the profile could cause @short.product.name@ to fail. |
| 206 |
</para> |
| 207 |
<table id="configuring-framework-profile-table" colsep="1" frame="all" rowsep="1"> |
| 208 |
<title>Framework Profile Properties</title> |
| 209 |
<tgroup cols="2"> |
| 210 |
<thead> |
| 211 |
<row> |
| 212 |
<entry>Property</entry> |
| 213 |
<entry>Description</entry> |
| 214 |
</row> |
| 215 |
</thead> |
| 216 |
<tbody> |
| 217 |
<row> |
| 218 |
<entry> |
| 219 |
<literal>org.osgi.framework.bootdelegation</literal> |
| 220 |
</entry> |
| 221 |
<entry> |
| 222 |
<para> |
| 223 |
This property specifies the packages which are loaded by delegation to the application class loader. |
| 224 |
Bundles can load classes belonging to these packages without importing the packages. |
| 225 |
The <literal>.*</literal> wildcard matches any package suffix. |
| 226 |
<literal>java.*</literal> is always boot delegated and must not be specified in this property. |
| 227 |
</para> |
| 228 |
</entry> |
| 229 |
</row> |
| 230 |
<row> |
| 231 |
<entry> |
| 232 |
<literal>org.osgi.framework.system.packages</literal> |
| 233 |
</entry> |
| 234 |
<entry> |
| 235 |
<para> |
| 236 |
This property specifies the packages which are exported by the system bundle. |
| 237 |
</para> |
| 238 |
<para> |
| 239 |
It is very occasionally necessary to extend the set, for example when configuring email logging appenders since the implementation of <literal>javax.mail</literal> is intimately related to the implementation of <literal>javax.activation</literal>. |
| 240 |
</para> |
| 241 |
</entry> |
| 242 |
</row> |
| 243 |
</tbody> |
| 244 |
</tgroup> |
| 245 |
</table> |
| 246 |
</section> |
| 247 |
</section> |
| 248 |
</chapter> |