-
Language:
English
-
Language:
English
Red Hat Training
A Red Hat training course is available for Red Hat JBoss Web Server
Installation Guide
Install and Configure Red Hat JBoss Web Server 2.1.0
Abstract
Chapter 1. Introduction
1.1. Introduction
1.2. Components
- Apache Tomcat is a servlet container in accordance with Java Servlet Specification. JBoss Enterprise Web Server contains Apache Tomcat 6 and Apache Tomcat 7.
- Apache Native is a Tomcat library, which improves Tomcat scalability, performance, and integration with native server technologies. It also contains an implementation of APR (Apache Portable Runtime). APR is a binary protocol for communication of Apache HTTP Server and Apache Tomcat.
- Apache Tomcat Connectors (mod_jk, mod_cluster) are connectors between Apache HTTP Server and Apache Tomcat. Note that mod_cluster is a JBoss native load balancer and is more efficient, reliable, and scalable than mod_jk.
- Apache HTTP Server is an open-source web server developed by the Apache Software Foundation. The implementation follows the current HTTP standards.
Note
The delivered Apache HTTP Server by default provides the support for the Secure Socket Layer (SSL) protocol. To remove it, see the section on removing SSL for your installation. - Hibernate is an object-relational mapping framework. The delivered Hibernate contains Hibernate Core, Hibernate Annotations, Hibernate EntityManager with JPA 1.0 APIs.
1.3. Supported Operating Systems and Configurations
1.4. Installation and Upgrade
Warning
1.5. Product Documentation Locations
- The JBoss Enterprise Web Server Product Documentation. This documentation is available at the Red Hat Customer Support Portal's JBoss Enterprise Web Server page.
- The
jboss-ews-docs-2.1.0.zip
file contains documentation about the following:- httpd
- mod_auth_kerb
- mod_cluster
- mod_jk
- openssl
- tomcat6
- tomcat7
- tomcat-native
- mod_ssl documentation is also available at the location
doc/httpd/mod/
mod_ssl.html
.
Part I. Installation
Chapter 2. Installing Enterprise Web Server on Red Hat Enterprise Linux
- ZIP files.
- RPM files.
2.1. ZIP Installation Files
jboss-ews-application-servers-2.1.0-<platform>-<architecture>.zip
which contains:- Tomcat 6
- Tomcat 7
- Platform specific utilities
jboss-ews-httpd-2.1.0-<platform>-<architecture>.zip
, which contains:- Apache http server.
- All http modules.
2.2. RPM Installation Files
service
command and installs its resources into absolute paths. The RPM installation option is only available for Red Hat Enterprise Linux 5, Red Hat Enterprise Linux 6, and Red Hat Enterprise Linux 7.
Warning
2.3. Prerequisites
- Sufficient disk space for your JBoss Enterprise Web Server installation.
- Sufficient disk space for your applications.
2.3.1. RPM Installation Prerequisites
- A supported version of Java is installed (see Procedure 2.3, “Installing Java”).
- An updated version of the
elinks
package installed.
2.3.2. ZIP Installation Prerequisites
- A supported version of Java is installed (see Section 2.3.3, “Installation Procedures”).
- The following required packages are installed:
- krb5-workstation
- mod_auth_kerb
- elinks (required for the apachectl functionality)
- mailcap. The mailcap package contains
/etc/
mime.types
, which is used by httpd for MIME type mapping extensions. This package is not included in Red Hat Enterprise Linux and must be included.
- The following required packages are installed for Red Hat Enterprise Linux 7:
- The following required packages are installed for Red Hat Enterprise Linux 7:
- apr-util-ldap (required only if you want to use LDAP authentication)
- httpd22 (available in the
jb-ews-2-for-rhel-7-server-rpms
repository) - httpd22-devel (available in the
jb-ews-2-for-rhel-7-server-rpms
repository) - mod_auth_kerb-eap6 (available in the
jb-ews-2-for-rhel-7-server-rpms
repository)
- One of the following packages must be installed as a prerequisite:
apr-devel
orapr-util-devel
.
Note
Procedure 2.1. Removing tomcatjss Package
- At the shell prompt, become the root user.
- Run the following uninstall command:
# yum remove tomcatjss
Procedure 2.2. Installing Required Packages
- Depending on your operating system version, run the respective installation command as the root user:
- On Red Hat Enterprise Linux 6 and 5:
# yum install krb5-workstation mod_auth_kerb elinks
- On Red Hat Enterprise Linux 7:
# yum install httpd22 httpd22-devel mod_auth_kerb-eap6 apr-util-ldap krb5-workstation elinks
- When prompted, press y to proceed.
- When the installation is complete, run the following command to check that the packages are installed:
- On Red Hat Enterprise Linux 6 and 5:
# rpm -q krb5-workstation mod_auth_kerb elinks
- On Red Hat Enterprise Linux 7:
# rpm -q httpd22 httpd22-devel mod_auth_kerb-eap6 apr-util-ldap krb5-workstation elinks
If the packages are installed, the command output shows the package names with their version numbers. - Install JBoss Enterprise Web Server either from a ZIP file (Section 2.4, “Installing Enterprise Web Server from a ZIP File”) or from RPMs (Section 2.5, “Installing Enterprise Web Server from RPM Packages”).
2.3.3. Installation Procedures
Procedure 2.3. Installing Java
- Subscribe your system to the appropriate channel:
- Red Hat Enterprise Linux Server Supplementary for Red Hat Enterprise Linux 7
- Red Hat Enterprise Linux Server Supplementary for Red Hat Enterprise Linux 6
- Red Hat Enterprise Linux Supplementary for Red Hat Enterprise Linux 5
- On the command line, as the root user run the command to install Java 1.6 or 1.7:
- On Red Hat Enterprise Linux 5, Red Hat Enterprise Linux 6, and Red Hat Enterprise Linux 7, execute the
yum install
command to install Java 1.6:# yum install java-1.6.0-<VENDOR>-devel
Substitute <VENDOR> withsun
,ibm
, oropenjdk
.Execute the following variation of the listed command to install Java 1.7:# yum install java-1.7.0-<VENDOR>-devel
Substitute <VENDOR> withoracle
,ibm
, oropenjdk
.
- Run the following commands as the root user (if switching from another user, make sure to run the command
su -
) to make sure the correct JDK is in use:# alternatives --config java
# alternatives --config javac
These commands return lists of available JDK versions with the version in use marked with a plus (+
) sign. If the set JDK is not the desired option, switch to the right JDK as instructed on the command line.Important
Any software that makes use of thejava
andjavac
commands is using the JDK set by alternatives. Switching java alternatives may negatively influence running of such software. - Install the required packages (see Section 2.3.2, “ZIP Installation Prerequisites”)
2.4. Installing Enterprise Web Server from a ZIP File
2.4.1. Downloading and Extracting the ZIP File
Procedure 2.4. Downloading the Enterprise Web Server ZIP File
jboss-ews-application-servers-2.1.0-<platform>-<architecture>.zip
and jboss-ews-httpd-2.1.0-<platform>-<architecture>.zip
) from the Red Hat Customer Portal site:
- Open http://access.redhat.com in your web browser.
- In the upper right corner, click the Log in button.
- Enter your login information and click Log in.
- Hover over the Downloads option in the menu bar at the top of the page and under JBoss Enterprise Middleware in the displayed menu, click Downloads.
- In the Product drop-down box column, click Web Server.
- On the Software Downloads page, select the product version in the Version drop-down box and in the Releases tab below, click the
JBoss EWS
link with the correct version. - On the Software Details page, click the Download button next to the File drop-down box for the
jboss-ews-application-servers-2.1.0-<platform>-<architecture>.zip
andjboss-ews-httpd-2.1.0-<platform>-<architecture>.zip
files.Note
Download the appropriate versions for the target platform and architecture. - Confirm the file downloads have successfully completed.
- Follow Procedure 2.5, “Extracting the ZIP File” to extract the JBoss Enterprise Web Server ZIP files.
Procedure 2.5. Extracting the ZIP File
- On the command line, change to the directory with the ZIP files.
- Run the following
unzip
command, once for each ZIP file:
Substitute FILE_NAME with the name of each downloaded file and TARGET_DIRECTORY with the path to the target directory. After the ZIP files are extracted, configure the environment before running JBoss Enterprise Web Server (see Section 2.4.2, “Configuring the Environment”).unzip <FILE_NAME> -d <TARGET_DIRECTORY>
2.4.2. Configuring the Environment
- create apache and tomcat users to allow a secure and simple user management (see Procedure 2.8, “Setting the apache User” and Procedure 2.7, “Creating tomcat User”);
- remove the SSL support (see Procedure 2.9, “Removing SSL”);
- add log4j logging (see Procedure 2.10, “Configuring log4j”);
- enable mod_jk or mod_cluster (see Procedure 2.11, “Configuring mod_jk” and Procedure 2.12, “Configuring mod_cluster”).
Procedure 2.6. Setting JAVA_HOME
- In the
bin
directory of your Tomcat (either$EWS_HOME/tomcat6/bin
or$EWS_HOME/tomcat7/bin
), create thesetenv.sh
file.For example, run the commandvim tomcat<VERSION>/bin/setenv.sh
- Add the JAVA_HOME path definition into the file.For example
export JAVA_HOME=/usr/lib/jvm/jre-1.6.0-openjdk.x86_64
Procedure 2.7. Creating tomcat User
- At the shell prompt, become the root user.
- Run the following command to create the tomcat user group:
# groupadd -g 91 -r tomcat
- Go to /opt/jboss-ews-2.1.
- From /opt/jboss-ews-2.1, run the following command to create the tomcat user in the tomcat user group:
# useradd -c "Tomcat" -u 91 -g tomcat -s /bin/sh -r tomcat
- From /opt/jboss-ews-2.1, run the following command to assign the ownership of the tomcat directories to the
tomcat
user and allow the user to run the tomcat service:#
chown -R tomcat:tomcat tomcat<VERSION>
Substitute <VERSION> with the respective tomcat version number (6
or7
). - From /opt/jboss-ews-2.1, issue the command
ls -l
and check if the tomcat user is the owner of the Tomcat directory. - Make sure that the
tomcat
user has the execution permission to all parent directories.
Procedure 2.8. Setting the apache User
- Run the following commands as the root user to create the apache user group:
# groupadd -g 48 -r apache
- Run the following command to create the apache user in the apache user group:
# useradd -c "Apache" -u 48 -g apache -s /bin/sh -r apache
- Change to
/opt/jboss-ews-2.1
and run the following command to assign the ownership of the apache directories to theapache
user and allow the user to runhttpd
:# chown -R apache:apache httpd
- From /opt/jboss-ews-2.1, issue the command
ls -l
and check that theapache
user has execution permission to the respective Apache install path. Output is similar to the following:drwxrwxr-- 11 apache apache 4096 Feb 14 06:52 httpd
Procedure 2.9. Removing SSL
- Go to the
/opt/jboss-ews-2.1/httpd/conf.d/
directory. - Rename the SSL configuration file:
- To remove SSL, rename
ssl.conf
tossl.conf.disabled
. - To re-add SSL, rename
ssl.conf.disabled
tossl.conf
.
Procedure 2.10. Configuring log4j
log4j
logging to Tomcat:
- Go to the
/opt/jboss-ews-2.1/extras/
directory. - Copy the
log4j-eap6.jar
,log4j.properties
, andtomcat-juli-adapters.jar
files to thelib
directory of the Tomcat directory.For example:# cp log4j.properties ../tomcat<VERSION>/lib/
# cp log4j-eap6.jar ../tomcat<VERSION>/lib/
# cp tomcat-juli-adapters.jar ../tomcat<VERSION>/lib/
Replace <VERSION> with the respective Tomcat version number (6
or7
). - Replace
tomcat-juli.jar
file in your Tomcatbin
directory with thetomcat-juli.jar
file from/opt/jboss-ews-2.1/extras/
:# cp tomcat-juli.jar ../tomcat<VERSION>/bin/
Procedure 2.11. Configuring mod_jk
- available workers (JBoss instances) in the
workers.properties
file - the mod_jk configuration file
- In the
/opt/jboss-ews-2.1/httpd/conf/
directory, createworkers.properties
. - In the
/opt/jboss-ews-2.1/httpd/conf.d/
directory, createmod_jk.conf
.Note
You can also use the template files from thejboss-ews-docs-2.1.0.zip
file (the file is available at the Red Hat Customer Portal ): after you have downloaded and unzipped the file, copy the sample filesmod_jk.conf.sample
andworkers.properties.sample
from the /opt/jboss-ews-2.1/doc/mod_jk/ to the locations defined in Step 1 and Step 2. Rename them (drop thesample
extension) and modify their content as needed (see Section 2.4.7, “Additional Resources”).
Procedure 2.12. Configuring mod_cluster
- The mod_cluster configuration can be customized in
/opt/jboss-ews-2.1/httpd/conf.d/mod_cluster.conf
.For more information about customizing mod_cluster, see the JBoss HTTP Connector section of the HTTP Connectors and Load Balancing Guide.
Procedure 2.13. Running the Post-Installation Script
- At the shell prompt, become the root user.
- Change to the
/opt/jboss-ews-2.1/httpd
directory. - Run the following command:
# ./.postinstall
2.4.3. Running Tomcat
Procedure 2.14. Running Tomcat on Red Hat Enterprise Linux
- After extracting the zip file, check to see if a user called
tomcat
exists on the system by running the following command:id tomcat
- If the user does not exist, use the following command to add it:
groupadd -g 91 -r tomcat useradd -c "Tomcat" -u 91 -g tomcat -s /bin/sh -r tomcat
- If the
tomcat
user will be running Tomcat, change the ownership of the tomcat directories.- Use the following command for Tomcat 6:
chown -R tomcat:tomcat tomcat6
- Use the following command for Tomcat 7:
chown -R tomcat:tomcat tomcat7
- Test that the
tomcat
user has execution permission to the tomcat install path. - Set the
JAVA_HOME
variable. Use one of the following approaches to set this variable.- Provide the value for
JAVA_HOME
externally by setting the value prior to starting Tomcat.- Set the value for
JAVA_HOME
in thesetenv.sh
file. In Tomcat 6, this file is available attomcat6/bin/
and in Tomcat 7, this file is available attomcat7/bin/
. This value is loaded fromcatalina.sh
and overrides all other set values forJAVA_HOME
.
To start Tomcat, execute the following script as the user tomcat
:
sh startup.sh
To stop Tomcat, execute the following script as the user tomcat
:
sh shutdown.sh
2.4.4. Running the HTTP Server
httpd
directory and run the post install script by executing the following:
./.postinstall
apache
exists on the system by running the following command:
id apache
/usr/sbin/groupadd -g 91 -r apache /usr/sbin/useradd -c "Apache" -u 48 -s /bin/sh -r apache
apache
user will be running the httpd
service, then the ownership of the HTTP directories will need to be changed to reflect this:
chown -R apache:apache httpd
apache
user has execution permission to the HTTP server install path.
httpd
directory and executing:
su -m -c "./sbin/apachectl start"
su -m -c "./sbin/apachectl stop"
2.4.5. Running Enterprise Web Server
- Tomcat (6 or 7, see Section 2.4.5.1, “Running Tomcat”)
- HTTP server (Section 2.4.5.2, “Running HTTP”)
2.4.5.1. Running Tomcat
Important
- The tomcat user is created (see Procedure 2.7, “Creating tomcat User”).
- JAVA_HOME is set correctly (see Procedure 2.6, “Setting JAVA_HOME”).
2.4.5.1.1. Running Tomcat as a Program
startup.sh
scriptRun the following command as the root user with the respective Tomcat version (6
or7
):# sh /opt/jboss-ews-2.1/tomcat<VERSION>/bin/startup.sh
The system reads the configuration file and changes to the user and group to the tomcat user account (that is, Tomcat is always run under the tomcat user). By default,tomcat-native
is automatically added to theLD_LIBRARY_PATH
and-Djava.library.path
during Tomcat startup.catalina.sh
scriptRun the following command with the respective Tomcat version (6
or7
) :# sh /opt/jboss-ews-2.1/tomcat<VERSION>/bin/catalina.sh
- custom script, which calls
catalina.sh
2.4.5.1.2. Running Tomcat as a Service
2.4.5.2. Running HTTP
/opt/jboss-ews-2.1/httpd/sbin/
and run the following command as the root user:
# ./apachectl start
2.4.6. Stopping Enterprise Web Server
2.4.6.1. Stopping Tomcat
# sh /opt/jboss-ews-2.1/tomcat<VERSION>/bin/shutdown.sh
2.4.6.2. Stopping HTTP
/opt/jboss-ews-2.1/httpd/sbin/
and run the following command as the root user:
# apachectl stop
2.4.7. Additional Resources
jboss-ews-docs-2.1.0.zip
file for documentation, jboss-ews-2.1.0-<platform>.src.zip
file for Windows and Solaris platform, and jboss-ews-src-2.1.0.zip
file for Red Hat Enterprise Linux, available at the Red Hat Customer Portal. Extract the files to /opt/jboss-ews-2.1
. On extraction, doc
and src
directories are created, which contain the documentation and examples, and source code.
2.5. Installing Enterprise Web Server from RPM Packages
2.5.1. RPM Installation Methods
- Using the
groupinstall
command. This option installs all the packages required by JBoss Enterprise Web Server or JBoss Enterprise Web Server Plus. This option is recommended for new users. - Installing packages individually using the
yum
command. This option allows the user to select which packages to install and allows the user to exclude packages that are not required for their specific installation. This option is not recommended for new users.
2.5.2. RPM Packages
RPM Packages for Red Hat Enterprise Linux 5, 6, and 7
- Tomcat 7:
- tomcat7tomcat7-webappstomcat7-admin-webapps
- Tomcat 6:
- tomcat6tomcat6-webappstomcat6-admin-webapps
- Tomcat Native:
- tomcat-native
- HTTP Server:
- httpd
- mod_jk:
- mod_jk
- mod_cluster:
- mod_clustermod_cluster-nativemod_cluster-tomcat6mod_cluster-tomcat7
- mod_rt:
- mod_rt
- mod_snmp:
- mod_snmp
- mod_auth_kerb:
- mod_auth_kerb
2.5.3. RHN Channels for JBoss Enterprise Web Server Installation Packages
- on Red Hat Enterprise Linux 6:
- jb-ews-2-i386-server-6-rpm
- jb-ews-2-x86_64-server-6-rpm
- on Red Hat Enterprise Linux 5:
- jb-ews-2-i386-server-5-rpm
- jb-ews-2-x86_64-server-5-rpm
2.5.4. Red Hat Subscription Management Repositories for JBoss Enterprise Web Server Installation Packages
- on Red Hat Enterprise Linux 7:
- jb-ews-2-for-rhel-7-server-rpms
Note
2.5.5. Installing Enterprise Web Server from RPM Files
Note
Procedure 2.15. Removing tomcatjss Package
- At the shell prompt, become the root user.
- Run the following uninstall command:
# yum remove tomcatjss
Procedure 2.16. Subscribing to Red Hat Network Enterprise Channels
- Go to Red Hat Network Enterprise.
- Unsubscribe your system from the
Red Hat Application Stack
channel. - Subscribe to the JBoss Enterprise Web Server channels (see Section 2.5.3, “RHN Channels for JBoss Enterprise Web Server Installation Packages”).
Procedure 2.17. Subscribing to Red Hat Subscription Management Repositories
- Click on the appropriate Units or Subscription Management Applications.
- Subscribe to the JBoss Enterprise Web Server repositories (see Section 2.5.4, “Red Hat Subscription Management Repositories for JBoss Enterprise Web Server Installation Packages”).
Procedure 2.18. Installing Enterprise Web Server from RPM Packages
- At the shell prompt, become the root user.
- To install JBoss Enterprise Web Server as a group of packages, run the installation command:
# yum groupinstall jboss-ews2
- To install all packages in the group individually, on Red Hat Enterprise Linux 7, Red Hat Enterprise Linux 6 and Red Hat Enterprise Linux 5:
# yum install <LIST_OF_PACKAGES>
Substitute the <LIST_OF_PACKAGES> with names of the packages separated with spaces.To install all JBoss Enterprise Web Server packages, run this command:# yum install httpd mod_auth_kerb mod_cluster mod_cluster-native mod_jk-ap22 mod_rt mod_snmp mod_cluster-tomcat6 mod_cluster-tomcat7 tomcat6 tomcat6-admin-webapps tomcat6-webapps tomcat7 tomcat7-admin-webapps tomcat7-webapps tomcat-native
- Verify the system is using the correct javac and java (for details see Procedure 2.3, “Installing Java”).
Run the following command to install the listed optional packages with the JBoss Enterprise Web Server packages:
# yum install httpd-manual mod_jk-manual mod_ssl tomcat6-docs-webapp tomcat7-docs-webapp tomcat6-log4j tomcat7-log4j mod_jk-ap22 mod_cluster-demo hibernate3-commons-annotations-javadoc hibernate-jpa-2.0-api-javadoc tomcat6-javadoc tomcat7-javadoc apache-commons-daemon-jsvc-eap6
2.5.6. Install the JBoss Enterprise Web Server Plus Group
Procedure 2.19. Installing the JBoss Enterprise Web Server Plus Group of Packages
- At the shell prompt, become the root user.
- To install JBoss Enterprise Web Server Plus group of packages, run the installation command:
# yum groupinstall jboss-ews2plus
- To install all packages in the group individually, on Red Hat Enterprise Linux 7, Red Hat Enterprise Linux 6, and Red Hat Enterprise Linux 5:
# yum install <LIST_OF_PACKAGES>
Substitute the <LIST_OF_PACKAGES> with names of the packages separated with spaces.To install all JBoss Enterprise Web Server Plus packages, run this command:# yum install hibernate-jpa-2.0-api hibernate3-commons-annotations hibernate4-eap6 hibernate4-core-eap6 hibernate4-envers-eap6 hibernate4-entitymanager-eap6 hibernate4-c3p0-eap6
2.5.7. Configuring the Environment
- remove SSL (see Procedure 2.20, “Removing SSL”);
- add log4j logging (see Procedure 2.21, “Removing log4j From Tomcat 6”);
- enable mod_jk or mod_cluster (see Procedure 2.22, “Configuring mod_jk” and Procedure 2.23, “Configuring mod_cluster”)
Procedure 2.20. Removing SSL
- At the shell prompt, become the root user.
- Run the respective uninstall command:
- on Red Hat Enterprise Linux 7, Red Hat Enterprise Linux 6, and Red Hat Enterprise Linux 5:
# yum remove mod_ssl
For tomcat6, the log4j support is provided by the tomcat6-log4j package and is enabled on package installation (see Procedure 2.18, “Installing Enterprise Web Server from RPM Packages”).
Procedure 2.21. Removing log4j From Tomcat 6
- At the shell prompt, become the root user.
- Run the respective uninstall command:
- on Red Hat Enterprise Linux 7, Red Hat Enterprise Linux 6, and Red Hat Enterprise Linux 5:
# yum remove tomcat6-log4j
Procedure 2.22. Configuring mod_jk
- Install the template
mod_jk
configuration file:# cp /usr/share/doc/mod_jk-ap22-*/mod_jk.conf.sample /etc/httpd/conf.d/mod_jk.conf
- Install the template
workers.properties
file:# cp /usr/share/doc/mod_jk-ap22-*/workers.properties.sample /etc/httpd/conf/workers.properties
- Add worker mappings to
workers.properties
. For example:# Mount the Servlet context to the ajp20 worker /jmx-console=loadbalancer /jmx-console/*=loadbalancer /web-console=loadbalancer /web-console/*=loadbalancer
Note
The default configuration is adequate for low-traffic web sites. For optimization information for moderate and high-load web sites, see http://kbase.redhat.com/faq/docs/DOC-15836.
Procedure 2.23. Configuring mod_cluster
- In the
/etc/httpd/conf/httpd.conf
file, add the hash (#
) sign at the beginning of the following line to disable mod_proxy_balancer.so:LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
This module is incompatible with the JBoss HTTP Connector. - Configure the server to load the JBoss HTTP Connector modules:
- Create the file
/etc/httpd/conf.d/JBoss_HTTP.conf
. - Add the following lines to the
JBoss_HTTP.conf
file:LoadModule slotmem_module modules/httpd/modules/mod_slotmem.so LoadModule manager_module modules/mod_manager.so LoadModule proxy_cluster_module modules/mod_proxy_cluster.so LoadModule advertise_module modules/mod_advertise.so
2.5.8. Setting the Service Boot Behavior
- From the command line, issue the following command with the <SERVICE_NAME> replaced with the respective service name (
tomcat6
ortomcat7
, andhttpd
orhttpd22
)chkconfig <SERVICE_NAME> on
For details see the chkconfig man page. - To use the Service Configuration tool, issue the command
system-config-services
and change the service setting in the displayed window.
2.5.9. Running Enterprise Web Server
- Tomcat (6 or 7, see Procedure 2.24, “Running Tomcat”)
- HTTP server (Procedure 2.25, “Running HTTP”)
Procedure 2.24. Running Tomcat
Important
tomcat
:
- At the shell prompt, become the root user.
- Run the following
start
command with the <VERSION> substituted with the correct Tomcat version (6
or7
):# service tomcat<VERSION> start
- Go to http://localhost:8080 in your web browser to verify that Tomcat is running. The Apache Software Foundation page appears.
Note
In JBoss Enterprise Web Server installations from the RPM packages, the only supported way of running Tomcat is the running described in this section.
Procedure 2.25. Running HTTP
httpd
:
- At the shell prompt, become the root user.
- Run the following
start
command:- On Red Hat Enterprise Linux 6 or Red Hat Enterprise Linux 5:
# service httpd start
2.5.10. Stopping Enterprise Web Server
Procedure 2.26. Stopping Tomcat
tomcat
:
- At the shell prompt, become the root user.
- Run the following service command with the <VERSION> substituted with the correct Tomcat version (
6
or7
):# service tomcat<VERSION> stop
- Go to http://localhost:8080 in your web browser to verify that Tomcat is no longer running.
Procedure 2.27. Stopping HTTP
httpd
:
- At the shell prompt, become the root user.
- Run the following
stop
command:- On Red Hat Enterprise Linux 6 or Red Hat Enterprise Linux 5:
# service httpd stop
2.5.11. Additional Documentation
yum install
in Red Hat Enterprise Linux 5 and Red Hat Enterprise Linux 6 followed by the list of required documentation packages.
- The following documentation packages are available for Red Hat Enterprise Linux 6 and Red Hat Enterprise Linux 5:
- mod_jk-manual
- httpd-manual
- tomcat6-docs-webapp
- tomcat7-docs-webapp
2.6. SELinux Policies
Table 2.1. RPMs and Default SELinux Policies
Name | Port Information | Policy Information |
---|---|---|
mod_cluster | Two ports (6666 for TCP and 23364 for UDP ) are added for httpd_port_t to allow the httpd process to use them. | A post installation script configures the context mapping for /var/cache/mod_cluster to enable the httpd process to write at this location. |
mod_snmp | The installed mod_snmp policy allows httpd processes to bind to snmp_port_t ports. This allows httpd to use port 161 and 162 (used with both UDP and TCP ). | A post installation script configures the context mapping for /var/cache/mod_snmp to enable the httpd process to write at this location. |
tomcat | Four ports are added to http_port_t (TCP ports 8080 , 8005 , 8009 and 8443 ) to allow the httpd process to use them. | The Tomcat{version} policy is installed, which sets ths appropriate SELinux domain for the process when Tomcat executes. It also sets the appropriate contexts to allow tomcat to write to /var/lib/tomcat{version} , /var/log/tomcat{version} , /var/cache/tomcat{version} and /var/run/tomcat{version}.pid . |
2.6.1. Default SELinux Policies for a ZIP Installation
httpd
and Tomcat processes run in httpd_t
or unconfined_java_t
domains. These domains do not confine the processes, therefore the administrator must take the following security precautions:
- Run
httpd
using theapachectl
script. This ensures that the userapache
owns the processed instead of the userroot
. - Confine file access for users
tomcat
andapache
to files and directories that are not necessary to the JBoss Enterprise Web Server runtime. - Do not run Tomcat as the user
root
.
2.6.2. Compile SELinux policies
Before compiling SELinux policies ensure the following prerequisites:
selinux-policy-devel
package is installed.- Tomcat 6 or 7 is installed using RPM installation method.
# cd /etc/tomcat7/selinux/packages/tomcat7 # make -f /usr/share/selinux/devel/Makefile Compiling targeted tomcat7 module /usr/bin/checkmodule: loading policy configuration from tmp/tomcat7.tmp /usr/bin/checkmodule: policy configuration loaded /usr/bin/checkmodule: writing binary representation (version 10) to tmp/tomcat7.mod Creating targeted tomcat7.pp policy package rm tmp/tomcat7.mod tmp/tomcat7.mod.fc # semodule -i tomcat7.pp
# cd /etc/tomcat6/selinux/packages/tomcat6 # make -f /usr/share/selinux/devel/Makefile Compiling targeted tomcat6 module /usr/bin/checkmodule: loading policy configuration from tmp/tomcat6.tmp /usr/bin/checkmodule: policy configuration loaded /usr/bin/checkmodule: writing binary representation (version 10) to tmp/tomcat6.mod Creating targeted tomcat6.pp policy package rm tmp/tomcat6.mod.fc tmp/tomcat6.mod # semodule -i tomcat6.pp
Chapter 3. Installing Enterprise Web Server on Windows
Important
3.1. Prerequisites
- Sufficient disk space for your JBoss Enterprise Web Server installation.
- Sufficent disk space for your applications.
Procedure 3.1. Installing Java
- Download JDK 1.6 or 1.7 for your operating system and architecture from the web site. (Download JDK)
- Double-click the downloaded file to start the Java installation.
- Proceed as instructed in the displayed installation window.
3.2. Downloading and Extracting Installation File
jboss-ews-application-servers-2.1.0-<platform>.<architecture>.zip
file contains Tomcat 6 and 7, as well as other platform utilities. The jboss-ews-httpd-2.1.0-<platform>.<architecture>.zip
file contains the Apache http server and other http modules.
Procedure 3.2. Downloading the Enterprise Web Service ZIP File
- Open http://access.redhat.com in your web browser.
- In the right upper corner, click the Log in button.
- Enter your login information and click Log in.
- Hover over the Downloads option in the menu bar at the top of the page and click Downloads under JBoss Enterprise Middleware in the displayed menu.
- In the Product drop-down menu, click Web Server.
- On the Releases tab, click the
JBoss EWS
link for Windows with the correct architecture and version. - On the Software Details page, click the Download button next to the File drop-down box.
Note
Make sure the file is intended for your operating system and architecture. - Confirm the file download.
Procedure 3.3. Extracting the ZIP File
- Right-click the file and select
Extract All...
. - Click Next.
- When prompted for the extract location, click Browse and navigate to
C:\Program Files
. - Click Finish.
Note
Files are extracted inC:\Program Files\jboss-ews-2.1
. If you wish to change the httpd configuration (for example, add mod_cluster), edit thehttpd.conf
file in theC:\Program Files\jboss-ews-2.1\etc\httpd\
folder.Note
The mod_auth_kerb package is not supported on the Windows Operating System.
3.3. Configuring the Environment
Procedure 3.4. Setting Environment Variables
- Log in to an account with local administrator permissions.
- Go to Control Panel → System.
- Click on the Advanced tab.
- Click the Environment Variables button.
- Click the New for System Variables.
- Enter the required
JAVA_HOME
,TMP
andTEMP
name-value pairs. - You will also need to add
C:\Program Files\jboss-ews-2.1\bin
to the PATH environment variable of the user the service runs under. This is SYSTEM by default. Without this, the SSL Connector will fail to work.
Procedure 3.5. Running the Post-Installation Script
- Run the Command Prompt as administrator even if you are logged in as the administrator:
- Click the Start button.
- Go to All Programs → Accessories.
- Right-click the Command Prompt and select
Run as administrator
.
- In the Command Prompt, type the following to change to the
etc
folder of your Enterprise Web Server installation:C:\> cd /D "C:\Program Files\jboss-ews-2.1\etc"
- Issue the command
call postinstall.httpd.bat
and then the commandcall postinstall.tomcat.bat
to run the post-installation script.The script creates the required symbolic links (Junction Points) for temporary logging and configuration directories.
Procedure 3.6. Installing Tomcat
- Run the Command Prompt as administrator:
- Click the Start button.
- Go to All Programs → Accessories.
- Right-click the Command Prompt and select
Run as administrator
.Note
On 64-bit Windows, you need to use the 64-bit version of the Command Prompt (cmd.exe
). Running thecmd
command from a 32-bit application launches a 32-bit Command Prompt instance. This causes the service setup script to fail with a File Not Found warning. - Change to the
bin
folder in the JBoss Enterprise Web Server installation folder.For Tomcat 6
For Tomcat 6, the command is:C:\> cd /D "C:\Program Files\jboss-ews-2.1\share\tomcat6\bin"
For Tomcat 7
For Tomcat 7, the command is:C:\> cd /D "C:\Program Files\jboss-ews-2.1\share\tomcat7\bin"
- In the Command Prompt, run the following command :
call service.bat install
Procedure 3.7. Installing HTTP
- Run the Command Prompt as administrator:
- Click the Start button.
- Go to All Programs → Accessories.
- Right-click the Command Prompt and select
Run as administrator
.
- Change to the
bin
folder of your new installation:C:\> cd /D "C:\Program Files\jboss-ews-2.1\bin"
- In the Command Prompt, run the
install
command:httpd -k install
A Firewall security dialog prompt demanding networking access for the Apache HTTP Server service appears. Click Allow if you wish to access this service from the network.Note
By default, Apache HTTP Server is configured to listen on port 80. If you have Microsoft IIS installed, ensure the following:World Wide Web...
service is stopped and the Startup Type is set toManual
World Wide Web...
service is configured to listen on a different port
Alternatively, you can edit thehttpd.conf
file before installing the service and change theListen
directive to a port that does not collide with the Internet Information Service listening ports.
Procedure 3.8. Configuring log4j
log4j
logging in Tomcat:
- Change to
C:\Program Files\jboss-ews-2.1\share\extras\
- Copy the log4j files to the
lib
folder for your Tomcat version:copy log4j-eap6.jar log4j.properties tomcat-juli-adapters.jar ..\tomcat<VERSION>\lib
- Replace
tomcat-juli.jar
file in your Tomcatbin
directory with thetomcat-juli.jar
file fromC:\Program Files\jboss-ews-2.1\share\extras\
:copy tomcat-juli.jar ..\tomcat<VERSION>\bin
Procedure 3.9. Removing SSL
- Go to
C:\Program Files\jboss-ews-2.1\etc\httpd\conf.d
- Rename the SSL configuration file:
- To remove SSL, rename
ssl.conf
tossl.conf.disabled
. - To re-add SSL rename
ssl.conf.disabled
tossl.conf
.
Procedure 3.10. Configuring mod_jk
- available workers (JBoss instances) in the
workers.properties
file - the mod_jk configuration file
mod_jk.conf
- In
C:\Program Files\jboss-ews-2.1\etc\httpd\conf\
create workers.properties (see http://tomcat.apache.org/connectors-doc/reference/apache.html). - In
C:\Program Files\jboss-ews-2.1\etc\httpd\conf.d\
create mod_jk.conf (see http://tomcat.apache.org/connectors-doc/reference/apache.html)Note
You can also use the sample filesmod_jk.conf.sample
andworkers.properties.sample
available inC:\Program Files\jboss-ews-2.1\etc\httpd\conf
: modify their content as needed and rename them tomod_jk.conf
andworkers.properties
.
Procedure 3.11. Configuring mod_cluster
- In the
C:\Program Files\jboss-ews-2.1\etc\httpd\conf\httpd.conf
file, add the hash (#
) sign at the beginning of the following line to disable mod_proxy_balancer.so:LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
This module is incompatible with the JBoss HTTP Connector. - Configure the server to load the JBoss HTTP Connector modules:
- Create the file
C:\Program Files\jboss-ews-2.1\etc\httpd\conf.d\mod_cluster.conf
. - Add the following lines to the
mod_cluster.conf
file:LoadModule proxy_cluster_module modules/mod_proxy_cluster.so LoadModule slotmem_module modules/mod_slotmem.so LoadModule manager_module modules/mod_manager.so LoadModule advertise_module modules/mod_advertise.so
Procedure 3.12. Setting Security
C:\Program Files\jboss-ews-2.1
folder and all of its subfolders:
- Right-click the
C:\Program Files\jboss-ews-2.1
folder and clickProperties
. - Select the
Security
tab. - Click the Edit button.
- Click the Add button.
- In the text box, enter
LOCAL SERVICE
. - Select the
Full Control
check box for the newLOCAL SERVICE
account. - Click
OK
. - Click the Advanced button.
- Inside the Advanced Security Settings dialog, select
LOCAL SERVICE
and click Edit. - Select the check box next to the Replace all existing inheritable permissions on all descendants with inheritable permissions from this object option.
- Click OK.
- Click OK again.
- Click OK a third time to apply the settings.
3.4. Running Enterprise Web Server
Procedure 3.13. Running Enterprise Web Server from the Command Prompt
- Run the Command Prompt as administrator:
- Click the Start button.
- Go to All Programs → Accessories.
- Right-click the Command Prompt and select
Run as administrator
.
- On the Command Prompt, issue the following command to run the tomcat service:
net start tomcat<VERSION>
- On the Command Prompt, run the following command to run the httpd service:
net start Apache2.2
Right click to select the name of the desired service in the Services Menu. Options include Apache 2.2, Apache Tomcat 6 and Apache Tomcat 7.
Procedure 3.14. Running Enterprise Web Server from the Computer Management Tool
- Run the Command Prompt as administrator:
- Click the Start button.
- Go to All Programs → Accessories.
- Right-click the Command Prompt and select
Run as administrator
.
- Go to Start → Administrative Tools → Services
- In the Services dialog, right-click the name of the service (
httpd
ortomcat
) and click Start or Stop.
Note
catalina.bat run
.
C:\windows\System32\
directory and PATH directories, and check for DLLs library conflicting with those shipped with Enterprise Web Server. In particular, look for libeay32.dil
, ssleay32.dll
, and libssl32.dll
.
3.5. Stopping Enterprise Web Server
Procedure 3.15. Stopping Enterprise Web Server from the Command Prompt
- Run the Command Prompt as administrator:
- Click the Start button.
- Go to All Programs → Accessories.
- Right-click the Command Prompt and select
Run as administrator
.
- On the Command Prompt, issue the following command to run the tomcat service:
net stop tomcat<VERSION>
- On the Command Prompt, run the following command to run the httpd service:
net stop Apache2.2
Right click to select the name of the desired service in the Services Menu. Options include Apache 2.2, Apache Tomcat 6 and Apache Tomcat 7.
Procedure 3.16. Stopping Enterprise Web Server from the Computer Management Tool
- Run the Command Prompt as administrator:
- Click the Start button.
- Go to All Programs → Accessories.
- Right-click the Command Prompt and select
Run as administrator
.
- Go to Start → Administrative Tools → Services
- In the Services dialog, right-click the name of the service (
httpd
ortomcat
) and click Stop.
3.6. Directory Structure
postinstall.tomcat.bat
postinstall.http.bat
) run after a successful installation:
jboss-ews-2.1 | |-- etc |-- httpd |-- logs |-- modules '-- run |-- share |-- tomcat6 |-- tomcat7 |-- apache-tomcat-6.0.41 |-- logs |-- temp '-- work |-- apache-tomcat-7.0.54 |-- logs |-- temp '-- work |-- doc |-- extras |-- java |-- var |-- JBossEULA |-- LICENSE.txt
- The
etc
folder contains configuration files for Apache HTTP Server and the post-installation script. - The
share
folder contains Apache Tomcat 6 and 7 installations and shared Java JARs.
Chapter 4. Installing Enterprise Web Server on Solaris
4.1. Prerequisites
- Sufficient disk space for your JBoss Enterprise Web Server installation.
- Sufficent disk space for your applications.
Procedure 4.1. Installing Java
- Download JDK 1.6 or 1.7 and the corresponding architecture from the web site (Download JDK).
- Go to the download location.
- Run the Java installation file.
- Go to
usr
. - Issue the following command to display the current Java symbolic link:
ls -lad java
- Remove the link:
rm java
- Create a java symbolic link to the JDK 1.6.0:
ln -sf /usr/jdk/<JDK>
4.2. Downloading Installation Files
jboss-ews-application-servers-2.1.0-<platform>.<architecture>.zip
file contains Tomcat 6 and 7, as well as other platform utilities. The jboss-ews-httpd-2.1.0-<platform>.<architecture>.zip
file contains the Apache http server and other http modules.
Procedure 4.2. Downloading ZIP Files for Solaris
- Open https://access.redhat.com in your web browser.
- In the right upper corner, click the Log in button.
- Enter your login information and click Log in.
- Hover over the Downloads option in the menu bar at the top of the page and click Downloads under JBoss Enterprise Middleware in the displayed menu.
- In the Product drop-down box column of the displayed page, select Web Server wait for the page to refresh.
- On the Releases tab, click the JBoss EWS link for your operating system and architecture.
- On the Software Details page, click the Download button next to the File drop-down box.
Note
Make sure the file is intended for your operating system and architecture. - Confirm the file download.
4.3. Extracting and Installing Enterprise Web Server
Procedure 4.3. Extracting and Installing EWS from a ZIP File
- At the shell prompt, become the root user.
- Change to the directory with the ZIP file.
- Run the following command to extract the package to
opt
:# unzip <FILE_NAME> -d /opt
Substitute the <FILE_NAME> with the name of the downloaded ZIP file.Note
The system uses theopt
directory as a default directory for installing JBoss Enterprise Web Server on Solaris. Make sure theopt
directory is present during installation. - Issue the following commands to run the post-installation scripts:
cd /opt/jboss-ews-2.1/etc sh .postinstall.httpd sh .postinstall.tomcat
The post-installation process creates the tomcat and apache users and groups, and directories:- The users and groups
apache
with an ID of 48 andtomcat
with an ID of 91. Theapache
runshttpd
, while thetomcat
user runstomcat
. - Additional directories the
tomcat
group has write permissions to:/var/logs/tomcat7
/var/logs/tomcat6
4.4. Configuring the Environment
- remove SSL (see Procedure 4.5, “Removing SSL”);
- add log4j logging (see Procedure 4.6, “Configuring log4j”);
- enable mod_jk or mod_cluster (see Procedure 4.7, “Configuring mod_jk” and Procedure 4.8, “Configuring mod_cluster”).
Procedure 4.4. Configuring Tomcat
JAVA_HOME
variable to point to a supported JDK (1.6.0):
- Locate the
tomcat
configuration file:- For Tomcat 7:
/opt/jboss-ews-2.1/etc/sysconfig/tomcat7
- For Tomcat 6:
/opt/jboss-ews-2.1/etc/sysconfig/tomcat6
- Open the configuration file and delete the hash (#) sign at the beginning of the following line:
# JAVA_HOME="/usr/java"
Procedure 4.5. Removing SSL
- Go to
/opt/jboss-ews-2.1/etc/httpd/conf.d
- Rename the SSL configuration file:
- To remove SSL, rename
ssl.conf
tossl.conf.disabled
. - To re-enable the SSL, rename
ssl.conf.disabled
tossl.conf
.
Procedure 4.6. Configuring log4j
log4j
logging to Tomcat:
- Go to the
/opt/jboss-ews-2.1/share/extras
directory. - Copy the
log4j-eap6.jar
,log4j.properties
, andtomcat-juli-adapters.jar
files to thelib
directory of the Tomcat directory.For example:extras]# cp log4j.properties ../tomcat<VERSION>/lib/
extras]# cp log4j-eap6.jar ../tomcat<VERSION>/lib/
extras]# cp tomcat-juli-adapters.jar ../tomcat<VERSION>/lib/
Replace <VERSION> with the respective Tomcat version number (6
or7
). - Replace
tomcat-juli.jar
file in your Tomcatbin
directory with thetomcat-juli.jar
file from/opt/jboss-ews-2.1/share/extras
:extras]# cp tomcat-juli.jar ../tomcat<VERSION>/bin/
Procedure 4.7. Configuring mod_jk
- available workers (JBoss instances) in the
workers.properties
file - the mod_jk configuration file mod_jk.conf
- Create a workers.properties file in
/opt/jboss-ews-2.1/etc/httpd/conf
(see http://tomcat.apache.org/connectors-doc/reference/workers.html). - Create a mod_jk.conf in
/opt/jboss-ews-2.1/etc/httpd/conf.d/
, (see http://tomcat.apache.org/connectors-doc/reference/apache.html).Note
You can also copy and modify the sample filesmod_jk.conf.sample
andworkers.properties.sample
available in /opt/jboss-ews-2.1/etc/httpd/conf/: modify their content as needed and rename them tomod_jk.conf
andworkers.properties
.
Procedure 4.8. Configuring mod_cluster
- Mod_cluster is part of the JBoss Enterprise Web Server 2.1 installation.
- In
/opt/jboss-ews-2.1/httpd/conf/httpd.conf
add a hash (#
) sign at the beginning of the following line to disable the mod_proxy_balancer module:LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
This module is incompatible with the JBoss HTTP Connector. - Configure the server to load the JBoss HTTP Connector modules:
- Create the file
/opt/jboss-ews-2.1/httpd/conf.d/mod_cluster.conf
. - Add the following lines to the file
/opt/jboss-ews-2.1/httpd/conf.d/
mod_cluster.conf
:LoadModule slotmem_module modules/mod_slotmem.so LoadModule manager_module modules/mod_manager.so LoadModule proxy_cluster_module modules/mod_proxy_cluster.so LoadModule advertise_module modules/mod_advertise.so
4.5. Running Enterprise Web Server
4.5.1. Running Tomcat
Important
4.5.1.1. Running Tomcat as a Program
tomcat[6,7]
script in the sbin
directory or the catalina
script in the lib
directory:
- To start Tomcat with the tomcat script, run the following command as the root user with the respective Tomcat version (
6
or7
):/opt/jboss-ews-2.1/sbin/tomcat<VERSION> start
The system reads the configuration file and changes to the user and group of the tomcat user account (that is, Tomcat is always run under the tomcat user). By default,tomcat-native
is automatically added to theLD_LIBRARY_PATH
and-Djava.library.path
during Tomcat startup. - To start Tomcat with the
catalina.sh
script, run the following command with the respective Tomcat version (6
or7
) :/opt/jboss-ews-2.1/share/tomcat<VERSION>/bin/catalina.sh
Thecatalina.sh
script detects the running JVM version and adds the/opt/jboss-ews-2.1/lib/
path (/opt/jboss-ews-2.1/lib64
for 64 bit JVM) to the library path.
4.5.1.2. Running Tomcat as a Service
jsvc
:
- In Tomcat 6, use the script
daemon.sh
located in/opt/jboss-ews-2.1/share/apache-tomcat-6.x/bin/
. - In Tomcat 7, use the script
daemon.sh
located in/opt/jboss-ews-2.1/share/apache-tomcat-7.x/bin/
.
scm
as follows:
Procedure 4.9. Use SCM to Run Tomcat as a Service
- At the shell prompt, become the
root
user. - Create a new file named
tomcat.xml
at the location/var/svc/manifest/application/web/
. - Copy and paste the following contents into the newly created
tomcat.xml
file.<?xml version='1.0'?> <!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'> <!-- Service manifest for Apache Tomcat --> <service_bundle type='manifest' name='tomcat6:tomcat6'> <service name='network/tomcat6' type='service' version='1'> <create_default_instance enabled='false' /> <single_instance /> <dependency name='fs' grouping='require_all' restart_on='none' type='service'> <service_fmri value='svc:/system/filesystem/local' /> </dependency> <dependency name='net' grouping='require_all' restart_on='none' type='service'> <service_fmri value='svc:/network/loopback' /> </dependency> <exec_method type='method' name='start' exec='/opt/jboss-ews-2.0/sbin/tomcat6 start' timeout_seconds='-1'> </exec_method> <exec_method type='method' name='stop' exec='/opt/jboss-ews-2.0/sbin/tomcat6 stop' timeout_seconds='-1'> </exec_method> <exec_method type='method' name='restart' exec='/opt/jboss-ews-2.0/sbin/tomcat6 restart' timeout_seconds='-1'> </exec_method> </service> </service_bundle>
- Run the following command to import the new file:
# /usr/sbin/svccfg import /var/svc/manifest/application/web/tomcat.xml
- Use the following command to start tomcat:
# /usr/sbin/svcadm enable tomcat6
4.5.2. Running HTTP Server
apachectl
script, which is located inside the /opt/jboss-ews-2.1/sbin
directory. The apachectl
script uses the configuration file /opt/jboss-ews-2.1/etc/sysconfig/httpd
. In this file you can edit and select startup parameters, such as the running of mpm
.
httpd
configuration files are located inside the /opt/jboss-ews-2.1/etc/httpd
directory. By default all supported modules are loaded and enabled (see Appendix A, Supported HTTP Modules for a full list). To disable some of the modules, comment out the respective modules in the httpd.conf
file (for module description see http://httpd.apache.org/docs/2.2/mod/).
Procedure 4.10. Running HTTP Server
- Run the command line as the root user.
- Run the following command to start the HTTP Server:
sbin/apachectl start
If you want your server to continue running automatically after a system reboot, add a call to theapachectl
script to your system startup files.Note
For complete documentation on how to start and stop the HTTP Server, see the files,http://localhost/manual/invoking.html
andhttp://localhost/manual/stopping.html
respectively.
4.6. Stopping Enterprise Web Server
Procedure 4.11. Stopping Tomcat Running a Service
- At the shell prompt, become the root user.
- Execute the following command with the respective Tomcat version (
6
or7
) to stop Tomcat started from with the Tomcat script in thebin
directory:sbin/tomcat<VERSION> stop
Procedure 4.12. Stopping Tomcat Running a Program
- At the shell prompt, change to
/opt/jboss-ews-2.1/share/tomcat<VERSION>/bin
. - Execute the following command with the respective Tomcat version (
6
or7
) to stop Tomcat started from with the Tomcat script in thebin
directory:sh shutdown.sh
Procedure 4.13. Stopping HTTP Server
- Run the command line as the root user.
- Run the following command to stop the HTTP Server:
sbin/apachectl stop
4.7. Solaris Directory Structure
. |- /opt/jboss-ews-2.1/ |- bin |- etc |- lib |- lib64 (present only for x86_64 systems platforms) |- sbin |- share |- apache-tomcat-6.0.41 |- apache-tomcat-7.0.54 |- tomcat6 |- tomcat7 |- doc |- extras |- java |- var |- JBossEULA.txt |- LICENSE.txt
- Native Solaris packages require the absolute location
- Solaris (and other non-Red Hat Enterprise Linux platforms) must ship and build all the dependent components such as
openldap
,openssl
,db4
andcyrus-sasl
.
Chapter 5. Hibernate on Enterprise Web Server
context.xml
. However, persistence.xml
and web.xml
are required. The example below shows a setting with tomcat connection pooling mechanism.
/META-INF/context.xml
defines the connection pools Tomcat should create.Example 5.1. context.xml
<Context> <Resource name="jdbc/DsWebAppDB" auth="Container" type="javax.sql.DataSource" username="sa" password="" driverClassName="org.h2.Driver" url="jdbc:h2:mem:target/test/db/h2/hibernate maxActive="8" maxIdle="4"/> </Context>
/WEB-INF/classes/META-INF/persistence.xml
is a JPA configuration file. It defines how the application configures Hibernate to consume connections from the Tomcat pool. If you are using Hibernate API directly, use a similar configuration inhibernate.cfg.xml
.Example 5.2. persistence.xml
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"> <persistence-unit name="dswebapp"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect" /> <property name="hibernate.connection.datasource" value="java:comp/env/jdbc/DsWebAppDB"/> </properties> </persistence-unit> </persistence>
/WEB-INF/web.xml
is a regular web application deployment file, which tells Tomcat which datasource it consumes. In Example 5.3, “web.xml” the datasource isjdbc/DsWebAppDB
.Example 5.3. web.xml
<?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <resource-env-ref> <resource-env-ref-name>jdbc/DsWebAppDB</resource-env-ref-name> <resource-env-ref-type>javax.sql.DataSource</resource-env-ref-type> </resource-env-ref> </web-app>
Chapter 6. Monitoring Enterprise Web Server with JBoss Operations Network
Procedure 6.1. Download Installation Files
- Open http://access.redhat.com in a web browser.
- Click Downloads in the menu across the top of the page.
- Click Downloads in the list under JBoss Enterprise Middleware.
- Enter your login information.You are taken to the Software Downloads page.
Download the JBoss Operations Network Plugin
If you intend to use the JBoss Operations Network plugin for JBoss Enterprise Web Server, selectJBoss ON for EWS
from either the Software Downloads drop-down box, or the menu on the left.- Click the
JBoss Operations Network VERSION Base Distribution
download link. - Click the Download link to start the Base Distribution download.
- Repeat the steps to download the
EWS Plugin Pack for JBoss ON VERSION
Procedure 6.2. Configuring User Permissions on a Unix Operating System
Note
httpd
and Tomcat directories.
- As a user with root privileges, run the following command to add the user, under which JON Agent runs to the tomcat and apache user groups:
# usermod -aG tomcat,apache <RHQ_AGENT_USER>
Procedure 6.3. Configuring Monitoring
- Open the
startup
file of the respective JBoss Enterprise Web Server instance for editing:- on Red Hat Enterprise Linux installed from a ZIP file open
/opt/jboss-ews-2.1/tomcat<VERSION>/bin/startup.sh
- on Red Hat Enterprise Linux installed from a RPM files open
/usr/sbin/tomcat<VERSION>
- on Solaris open
/opt/jboss-ews-2.1/tomcat<VERSION>/bin/startup.sh
- on Windows open
C:\Program Files\jboss-ews-2.1\share\tomcat<VERSION>\bin\startup.bat
. - on Red Hat Enterprise Linux and on Solaris when running by
daemon.sh
open/opt/jboss-ews-2.1/tomcat<VERSION>/bin/setenv.sh
- Define an available port for JMX monitoring. Ensure the port is not blocked by any firewall. To ensure the port is not blocked, in the startup file, add the following line and substitute PORT_NUMBER with the number of the port dedicated to monitoring to the JAVA_OPTS variable:
- on Red Hat Enterprise Linux and Solaris:
JAVA_OPTS="${JAVA_OPTS} -Dcom.sun.management.jmxremote.port=PORT_NUMBER -Djava.rmi.server.hostname=IP_ADDRESS"
- on Windows:
set "JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote.port=PORT_NUMBER -Djava.rmi.server.hostname=IP_ADDRESS"
- If you want to disable authentication and SSL for development purposes, add the following lines to the JAVA_OPTS variable in the startup file:
JAVA_OPTS="${JAVA_OPTS} -Dcom.sun.management.jmxremote.ssl=false" JAVA_OPTS="${JAVA_OPTS} -Dcom.sun.management.jmxremote.authenticate=false"
Important
In production environments, add the following lines to the JAVA_OPTS variable in the startup file to secure JMX with SSL and restrict the access with a firewall:- on Red Hat Enterprise Linux and Solaris
JAVA_OPTS="${JAVA_OPTS} -Dcom.sun.management.jmxremote.access.file=/opt/jboss-ews-2.1/jmxremote.access" JAVA_OPTS="${JAVA_OPTS} -Dcom.sun.management.jmxremote.password.file=/opt/jboss-ews-2.1/jmxremote.password"
- on Windows:
set "JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote.access.file=C:\Program Files\jboss-ews-2.1\jmxremote.access" set "JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote.password.file=C:\Program Files\jboss-ews-2.1\jmxremote.password"
- Once the Tomcat server resource is discovered and imported into JBoss Operations Network inventory, it may be necessary to update the new resource's connection settings.
- Click Connection Settings in the JBoss Operations Network interface for the newly imported Tomcat Server resource.
- Verify the value of the Manager URL property to the RMI URL at which uses the correct JMX host name and port number as defined in the Tomcat server startup file. An example for this value is as follows:
service:jmx:rmi:///jndi/rmi://$IP_ADDRESS:$PORT/jmxrmi
Procedure 6.4. To configure JON monitoring for managing JBoss Enterprise Web Server Tomcat installed from RPMs:
- On the shell prompt become the root user.
- Set up JMX JAVA_OPTS properties in the
/usr/sbin/tomcat<VERSION>
file in the start and start-security sections.if [ "$1" = "start" ]; then JAVA_OPTS="${JAVA_OPTS} -Dcom.sun.management.jmxremote.port=8100 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=true -Dcom.sun.management.jmxr emote.access.file="/etc/tomcat<VERSION>/jmxremote.access" -Dcom.sun.management.jmxremote.password.file="/etc/tomcat<VERSION>/jmxremote.password"" ${JAVACMD} $JAVA_OPTS $LOGGING_CONFIG $CATALINA_OPTS \ -classpath "$CLASSPATH" \ -Dcatalina.base="$CATALINA_BASE" \ -Dcatalina.home="$CATALINA_HOME" \ -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" \ -Djava.io.tmpdir="$CATALINA_TMPDIR" \ org.apache.catalina.startup.Bootstrap start \ >> ${CATALINA_BASE}/logs/catalina.out 2>&1 & if [ ! -z "$CATALINA_PID" ]; then echo $! > $CATALINA_PID fi elif [ "$1" = "start-security" ]; then JAVA_OPTS="${JAVA_OPTS} -Dcom.sun.management.jmxremote.port=8100 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=true -Dcom.sun.management.jmxr emote.access.file="/etc/tomcat<VERSION>/jmxremote.access" -Dcom.sun.management.jmxremote.password.file="/etc/tomcat<VERSION>/jmxremote.password"" ${JAVACMD} $JAVA_OPTS $LOGGING_CONFIG $CATALINA_OPTS \ -classpath "$CLASSPATH" \ -Dcatalina.base="$CATALINA_BASE" \
- Set tomcat to run as root user in the
/etc/tomcat<VERSION>/tomcat<VERSION>.conf
file.TOMCAT_USER="root"
- On the shell prompt, run the following command to start tomcat.
service tomcat<VERSION> start
- Start the JON agent.
- From the JBoss Operations Network Web UI, import JON agent and tomcat to JON.
- On the JBoss Operations Network Web UI, setup Tomcat connection configuration (principal and credentials).
- On the JBoss Operations Network Web UI, setup Tomcat Control method configuration to RPM System V init script.
Note
Start and Shutdown script may not be set because Tomcat plugin always runsservice tomcat<VERSION> start/stop
command for RPM System V init script configuration setting.
Procedure 6.5. JBoss Operations Network managing Tomcat installed as Windows service
- Install Tomcat as Windows service using the following command.
jboss-ews-2.1\share\tomcat6\bin\service.bat install
- Create
jmxremote.access
file withcontrolRole readwrite
in theC:\jmx
directory. - Create
jmxremote.password
file withcontrolRole pwd
in theC:\jmx
directory.Note
Set owner ofjmxremote.access
andjmxremote.password
to SYSTEM and restrict access ofjmxremote.password
file only to user SYSTEM. The user SYSTEM must have only read access. - Enable JMX for Tomcat windows service.
jboss-ews-2.1\sbin\tomcat6.exe //US//Tomcat6 ++JvmOptions="-Dcom.sun.management.jmxremote.port=8100;-Dcom.sun.management.jmxremote.access.file="C:\jmx\jmxremote.access";-Dcom.sun.management.jmxremote.password.file="C:\jmx\jmxremote.password";-Dcom.sun.management.jmxremote.ssl=false;-Dcom.sun.management.jmxremote.authenticate=true"
- Start Tomcat win service by Windows services application
Note
See the tomcat logs in logs directory to check if Tomcat win service has started. - Install and configure JON agent. Type discovery in agent prompt to discover Tomcat windows service.
- On the JBoss Operations Network Web UI, click Inventory and then, click Discovery Queue to select import Tomcat and RHQ agent.
- On the JBoss Operations Network Web UI, go to platforms and search the agent name. Click on your agent.
- On the Agent page, Tomcat Servers are listed.
- Select your Tomcat server by clicking it.
- On the JBoss Operations Network Web UI, click on the Inventory tab and then configure the Tomcat Server in the Connection settings.
- Enter the Principal and Credentials information. use the
controlRole
and password set injmxremote
files. - Set Control Method to RPM System V init script.
Note
You can not set Start and Shutdown Script fields. - Click Save.
- Update the connection settings of Tomcat Server JVM and set Principal and Credentials.
Appendix A. Supported HTTP Modules
- core_module (static)
- mpm_prefork_module (static)
- http_module (static)
- so_module (static)
- auth_basic_module (shared)
- auth_digest_module (shared)
- authn_file_module (shared)
- authn_alias_module (shared)
- authn_anon_module (shared)
- authn_dbm_module (shared)
- authn_default_module (shared)
- authz_host_module (shared)
- authz_user_module (shared)
- authz_owner_module (shared)
- authz_groupfile_module (shared)
- authz_dbm_module (shared)
- authz_default_module (shared)
- ldap_module (shared)
- authnz_ldap_module (shared)
- include_module (shared)
- log_config_module (shared)
- logio_module (shared)
- env_module (shared)
- ext_filter_module (shared)
- mime_magic_module (shared)
- mime_magic_module (shared)
- expires_module (shared)
- deflate_module (shared)
- headers_module (shared)
- usertrack_module (shared)
- setenvif_module (shared)
- mime_module (shared)
- dav_module (shared)
- status_module (shared)
- autoindex_module (shared)
- info_module (shared)
- dav_fs_module (shared)
- negotiation_module (shared)
- dir_module (shared)
- actions_module (shared)
- speling_module (shared)
- userdir_module (shared)
- alias_module (shared)
- rewrite_module (shared)
- proxy_module (shared)
- proxy_ftp_module (shared)
- proxy_http_module (shared)
- proxy_connect_module (shared)
- cache_module (shared)
- suexec_module (shared)
- disk_cache_module (shared)
- cgi_module (shared)
- auth_kerb_module (shared)
- proxy_cluster_module (shared)
- slotmem_module (shared)
- manager_module (shared)
- advertise_module (shared)
- rt_module (shared)
- snmpcommon_module (shared)
- snmpagt_module (shared)
- proxy_ajp_module (shared)
- ssl_module (shared)
Appendix B. Revision History
Revision History | |||||||||
---|---|---|---|---|---|---|---|---|---|
Revision 2.1.0-7 | Wed May 13 2015 | Lucas Costi | |||||||
| |||||||||
Revision 2.1.0-6.1 | Wed Feb 11 2015 | Lucas Costi | |||||||
| |||||||||
Revision 2.1.0-6 | Tue Oct 07 2014 | Misha Husnain Ali | |||||||
| |||||||||
Revision 2.1.0-5 | Tue Aug 19 2014 | Mandar Joshi | |||||||
| |||||||||
Revision 2.1.0-3 | Tue Aug 05 2014 | Mandar Joshi | |||||||
| |||||||||
Revision 2.1.0-2 | Mon Jul 14 2014 | Mandar Joshi | |||||||
| |||||||||
Revision 2.1.0-1 | Fri Jul 11 2014 | Mandar Joshi | |||||||
|