Configure Apache Tomcat Web Server
You have to ensure that the memory settings and encoding settings (UTF-8) for Tomcat are set up properly according to the needs of ADOIT.
Configure Tomcat Java Settings
To configure the Tomcat Java settings:
- Open the folder “<Tomcat installation>/bin” and execute the file
tomcat10w.exe
.
Modify the values on the Java tab as described here:
In the Java Virtual Machine box, specify the path to
jvm.dll
in the folder “<Java installation>”. For example: "C:\Program Files\Eclipse Adoptium\jdk-17.0.11.9-hotspot\bin\server\jvm.dll".The parameter "-Dfile.encoding=UTF-8" is needed to ensure that write-back functionality to the ADOIT database is working with all characters. Add this parameter within the Java Options box.
An initial memory pool size of 512MB is recommended. A standard maximum memory pool size of at least 2048MB is recommended. The thread stack size should be set to 256KB.
Configure Tomcat's server.xml
A preconfigured server.xml
file is available in the folder "03 Web Application\02 Sample
Configuration" within the ADOIT installation package. You can replace the server.xml
in the
Tomcat installation directory with this file. Alternatively, you have the option to manually adjust
the default server.xml
as described below.
In order to set the encoding of Tomcat to UTF-8:
Open the folder "<Tomcat installation>\conf" and edit the file
server.xml
.Here you will find a line similar to:
<Connector port="8000" ...>
- Add the parameter URIEncoding="UTF-8" if it is not present yet. The line should afterwards look like:
<Connector URIEncoding="UTF-8" port="8000" ...>
- Adapt the “protocol” parameter:
<Connector URIEncoding="UTF-8" port="8000" protocol="org.apache.coyote.http11.Http11NioProtocol"...>
- Enable GZIP compression for performance optimisation. This means that all files that the web server sends to the browser after a request are automatically compressed. This works as follows:
<Connector URIEncoding="UTF-8" port="8000" ... compression="on" compressionMinSize="1024" noCompressionUserAgents="gozilla, traviata" compressibleMimeType="text/html,text/xml,
text/css,text/plain,text/javascript, image/jpeg"/>
- The Tomcat configuration should also contain an Error Report Valve which serves as a basic error
handler for HTTP status codes, responsible for creating and serving HTML error pages. Add the
Error Report Valve within the
<HOST>
element:
<Host ...>
...
<Valve className="org.apache.catalina.valves.ErrorReportValve" showReport="false" showServerInfo="false"/>
</Host>
Are you using an integrated environment in which requests coming to Tomcat are enriched with user authentication data before being forwarded to Tomcat (Identity Management scenario)? In this case it is recommended to restrict the IP addresses that are allowed to connect to the Tomcat instance for security reasons. In order to do this, the following section has to be added to the configuration:
<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="<HOST_IP>"/>
This can be added either directly in the server.xml
file below the definition of the Engine
(<Engine name="Catalina">
) or for a specific Host or Context. <HOST_IP>
has to be changed to the
allowed IP address(es). For more information, please refer to
https://tomcat.apache.org/tomcat-10.0-doc/config/valve.html.
(Optional) Change the Password for the Tomcat Manager
Due to security reasons the default password for the Tomcat Manager page should be changed during installation. Note that this might not be necessary when using an already existing Tomcat installation.
In order to change the password later:
- Open the folder “<Tomcat installation>/conf“ and edit the file
tomcat-users.xml
. Look for the following section:
<tomcat-users>
- If you set a password for the Tomcat Manager during installation, an entry that looks similar to the following is inserted below it. If not, add this entry and adjust the name and password.
<user name="Admin" password="password"
roles="manager-gui" />
The "manager-gui" role is required to operate the Tomcat Manager page.