-
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 3.
Red Hat Customer Content Services
Abstract
Chapter 1. Introduction
1.1. Introduction
1.2. Components
- Apache Tomcat is a servlet container in accordance with Java Servlet Specification. JBoss Web Server contains Apache Tomcat 7 and Apache Tomcat 8.
- 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 the default is mod_cluster, as it is the 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
By default, the delivered Apache HTTP Server provides support for Secure Socket Layer (SSL). To remove it, see the procedure on removing SSL in the Configuring the JBoss Web Server Installation section for your installation platform. - Hibernate is an object-relational mapping framework. The delivered Hibernate contains Hibernate Core, Hibernate Annotations, Hibernate EntityManager with JPA 1.0 APIs.
Note
1.3. Supported Operating Systems and Configurations
1.4. Installation Methods
jws-application-servers-3.0.0-<platform>-<architecture>.zip
- Tomcat 7
- Tomcat 8
- Platform-specific utilities
jws-httpd-3.0.0-<platform>-<architecture>.zip
- Apache HTTP Server
- Apache HTTP Server modules
1.5. Upgrading JBoss Web Server
Important
1.6. Migrating from Apache HTTP Server 2.2 to Apache HTTP Server 2.4
1.7. Component Documentation Bundle
jws-docs-3.0.0.zip
, is available at the Red Hat Customer Portal, and contains additional documentation for the following:
- httpd
- mod_auth_kerb
- mod_cluster
- mod_jk
- openssl
- tomcat7
- tomcat8
- tomcat-native
- mod_ssl documentation is also available at the location
doc/httpd/mod/mod_ssl.html
.
Chapter 2. Installing JBoss Web Server on Red Hat Enterprise Linux
- ZIP files
- RPM packages
2.1. Prerequisites
2.1.1. Installing a Java Development Kit (JDK)
Procedure 2.1. Installing a Java Development Kit (JDK)
- Subscribe your Red Hat Enterprise Linux system to the appropriate supplementary channel:
- Red Hat Enterprise Linux Server Supplementary for Red Hat Enterprise Linux 6
- Red Hat Enterprise Linux Server Supplementary for Red Hat Enterprise Linux 7
- As the root user, execute the command to install a 1.7 or 1.8 JDK:
# yum install java-1.7.0-<VENDOR>-devel
Replace <VENDOR> withoracle
,ibm
, oropenjdk
.# yum install java-1.8.0-<VENDOR>-devel
Replace <VENDOR> withoracle
,ibm
, oropenjdk
.
- Run the following commands as the root user to ensure the correct JDK is in use:
# alternatives --config java
# alternatives --config javac
These commands return lists of available JDK versions with the selected version marked with a plus (+
) sign. If the selected JDK is not the desired one, change to the desired JDK as instructed in the shell prompt.Important
All software that use thejava
andjavac
commands uses the JDK set byalternatives
. Changing Java alternatives may impact on the running of other software.
2.1.2. Red Hat Enterprise Linux Package Prerequisites
- A supported version of Java is installed. See Section 2.1.1, “Installing a Java Development Kit (JDK)”.
- The following required packages are installed for Red Hat Enterprise Linux 6:
- krb5-workstation
- elinks
- 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:
- apr
- apr-devel
- apr-util
- apr-util-devel
- apr-util-ldap
- elinks
- krb5-workstation
- mailcap
- You must remove the tomcatjss package before installing the tomcat-native package. The tomcatjss package uses an underlying NSS security model rather than the OpenSSL security model.
Procedure 2.2. Removing the tomcatjss Package
- As the root user, run the following command to remove tomcatjss:
# yum remove tomcatjss
Procedure 2.3. Installing Required Packages
- For your version of Red Hat Enterprise Linux, run the install command below as the root user:
- For Red Hat Enterprise Linux 6:
# yum install krb5-workstation elinks mailcap
- For Red Hat Enterprise Linux 7:
# yum install apr apr-devel apr-util apr-util-devel apr-util-ldap elinks krb5-workstation mailcap
2.2. ZIP Installation
2.2.1. Download and Extract JBoss Web Server
Procedure 2.4. Downloading JBoss Web Server
- Open a browser and log in to the Customer Portal at http://access.redhat.com.
- Click Downloads.
- Click Red Hat JBoss Web Server in the Product Downloads list.
- Select the correct JBoss Web Server version from the Version drop-down menu.
- Click Download for each of the following files, ensuring that you select the correct platform and architecture for your system:
- Red Hat JBoss Web Server 3.0 Application Server (
jws-application-servers-3.0.0-<platform>-<architecture>.zip
) - Red Hat JBoss Web Server 3.0 Apache HTTP Server (
jws-httpd-3.0.0-<platform>-<architecture>.zip
)
Procedure 2.5. Extract JBoss Web Server
- Unzip the downloaded ZIP files to your installation directory.
Note
We recommend that you install JBoss Web Server in the/opt/
directory.
2.2.2. Configuring the JBoss Web Server Installation
- Creating Tomcat and Apache users for simple and secure user management: Procedure 2.7, “Creating a Tomcat User” and Procedure 2.8, “Creating an Apache User”.
Procedure 2.6. Setting the JAVA_HOME
Environment Variable
JAVA_HOME
environment variable for Tomcat before running JBoss Web Server.
- In the
bin
directory of Tomcat (eitherJWS_HOME/tomcat7/bin
orJWS_HOME/tomcat8/bin
), create a file namedsetenv.sh
, and insert theJAVA_HOME
path definition.For example:export JAVA_HOME=/usr/lib/jvm/jre-1.7.0-openjdk.x86_64
Procedure 2.7. Creating a Tomcat User
tomcat
user and its parent group:
- In a shell prompt as the root user, change directory to
JWS_HOME
. - Run the following command to create the
tomcat
user group:# groupadd -g 91 -r tomcat
- Run the following command to create the
tomcat
user in thetomcat
user group:# useradd -c "Tomcat" -u 91 -g tomcat -s /bin/sh -r tomcat
- From
JWS_HOME
, run the following command to assign the ownership of the Tomcat directories to thetomcat
user to allow the user to run the Tomcat service:# chown -R tomcat:tomcat tomcat<VERSION>
Replace <VERSION> with the respective Tomcat version number (7
or8
).You can usels -l
to verify that thetomcat
user is the owner of the directory. - Ensure that the
tomcat
user has execute permissions to all parent directories. For example:# chmod -R u+X tomcat<VERSION>
Procedure 2.8. Creating an Apache User
apache
user and its parent group:
- In a shell prompt as the root user, change directory to
JWS_HOME
. - Run the following command to create the
apache
user group:# groupadd -g 48 -r apache
- Run the following command to create the
apache
user in theapache
user group:# useradd -c "Apache" -u 48 -g apache -s /bin/sh -r apache
- From
JWS_HOME
, run the following command to assign the ownership of the Apache directories to theapache
user to allow the user to runhttpd
:# chown -R apache:apache httpd
You can usels -l
to verify that theapache
user is the owner of the directory.
Procedure 2.9. Removing/Re-Adding SSL Support
- Go to the
JWS_HOME/httpd/conf.d/
directory and 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. Enabling log4j Logging for Tomcat
- Open a shell prompt and change directory to
JWS_HOME/extras/
. - 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 (7
or8
). - Replace
tomcat-juli.jar
file in your Tomcatbin
directory with thetomcat-juli.jar
file fromJWS_HOME/extras/
:# cp tomcat-juli.jar ../tomcat<VERSION>/bin/
Procedure 2.11. Configuring mod_jk
Note
JWS_HOME/httpd/conf.d/
. The sample configuration files are: mod_jk.conf.sample
, workers.properties.sample
, and uriworkermap.properties.sample
. To use these samples instead of creating your own configuration files, remove the .sample
extension, and modify their content as needed.
- In
JWS_HOME/httpd/conf.d/
, create a file namedworkers.properties
.This file should contain the available workers (JBoss instances). - In
JWS_HOME/httpd/conf.d/
, create a file namedmod_jk.conf
.This file contains general mod_jk configuration. - In
JWS_HOME/httpd/conf.d/
, create a file nameduriworkermap.properties
.This file contains request mapping rules that map requests to workers.
Procedure 2.12. Configuring mod_cluster
- mod_cluster can be configured in
JWS_HOME/httpd/conf.d/mod_cluster.conf
.For more information about customizing mod_cluster, see the mod_cluster Connector section of the HTTP Connectors and Load Balancing Guide.
Procedure 2.13. Running the Apache HTTP Server Post-Installation Script
- In a shell prompt as the root user, change directory to
JWS_HOME/httpd
. - Run the following command:
# ./.postinstall
2.2.3. Starting JBoss Web Server
- Tomcat (7 or 8).
- Apache HTTP Server.
- The Tomcat user is created. See Procedure 2.7, “Creating a Tomcat User”.
- JAVA_HOME is set correctly. See Procedure 2.6, “Setting the
JAVA_HOME
Environment Variable”.
Procedure 2.14. Starting Tomcat
- Run the following command as the
tomcat
user with your respective Tomcat version (7
or8
):$ sh JWS_HOME/tomcat<VERSION>/bin/startup.sh
Important
Although there are multiple methods of starting Tomcat, it is recommended that you use thestartup.sh
script. To start Tomcat as a service using Jsvc, see Chapter 5, Using Jsvc to Start Tomcat.
Procedure 2.15. Starting Apache HTTP Server
- To start Apache HTTP Server (httpd), in a terminal as the root, change to
JWS_HOME/httpd/sbin/
and run the following command:# ./apachectl start
2.2.4. Stopping JBoss Web Server
- Tomcat (7 or 8).
- Apache HTTP Server.
Procedure 2.16. Stopping Tomcat
- To stop Tomcat, run the following command as the root user with your respective Tomcat version (
7
or8
):# sh JWS_HOME/tomcat<VERSION>/bin/shutdown.sh
Procedure 2.17. Stopping Apache HTTP Server
- To stop Apache HTTP Server (httpd), in a shell prompt as the root user change to
JWS_HOME/httpd/sbin/
, and run the following command:# ./apachectl stop
2.3. RPM Installation
Note
- For Red Hat Enterprise Linux 6:
- jws-3-x86_64-server-6-rpm
- jws-3-i386-server-6-rpm
- For Red Hat Enterprise Linux 7:
- jws-3-x86_64-server-7-rpm
Warning
2.3.1. Installing JBoss Web Server from RPM Packages
Prerequisites
- Ensure that the tomcatjss package is removed. See Section 2.1.2, “Red Hat Enterprise Linux Package Prerequisites”
Procedure 2.18. Installing JBoss Web Server from RPM Packages
- Log in to Red Hat Subscription Manager.
- Click on Systems in the Subscriber Inventory.
- Subscribe to the JBoss Web Server CDN repositories for your operating system version and architecture:
- For Red Hat Enterprise Linux 6:
- jws-3-for-rhel-6-server-rpms
- For Red Hat Enterprise Linux 7:
- jws-3-for-rhel-7-server-rpms
- Run the following command as the root user to install JBoss Web Server:
# yum groupinstall jws3
Note
Although not recommended, instead of using the group install, you can install each of the packages and their dependencies individually.
2.3.2. Installing the JBoss Web Server Plus Group
Procedure 2.19. Installing the Red Hat JBoss Web Server Plus Group of Packages
- To install the JBoss Web Server Plus group of packages, run the following command as the root user:
# yum groupinstall jws3plus
2.3.3. Configuring the JBoss Web Server Installation (RPM Installation)
Procedure 2.20. Removing SSL Support
- At a shell prompt, run the following command as the root user:
# yum remove mod_ssl24
Procedure 2.21. Configuring mod_jk
Note
/etc/httpd24/conf.d/
. The sample configuration files are: mod_jk.conf.sample
, workers.properties.sample
, and uriworkermap.properties.sample
. To use these samples instead of creating your own configuration files, remove the .sample
extension, and modify their content as needed.
- In
/etc/httpd24/conf.d/
, create a file namedworkers.properties
.This file should contain the available workers (JBoss instances). - In
/etc/httpd24/conf.d/
, create a file namedmod_jk.conf
.This file contains general mod_jk configuration. - In
/etc/httpd24/conf.d/
, create a file nameduriworkermap.properties
.This file contains request mapping rules that map requests to workers.
Procedure 2.22. Configuring Apache HTTP Server to Use mod_cluster
- In
/etc/httpd24/conf.modules.d/00-proxy.conf
, ensure that there is a#
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 mod_cluster. - Configure the server to load the mod_cluster modules:
- Create the file
/etc/httpd24/conf.d/mod_cluster.conf
. - Add the following lines to
mod_cluster.conf
:LoadModule cluster_slotmem_module modules/mod_cluster_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.3.4. Starting JBoss Web Server
- Tomcat (7 or 8). See Procedure 2.23, “Starting Tomcat”.
- Apache HTTP Server. See Procedure 2.24, “Starting Apache HTTP Server”.
Procedure 2.23. Starting Tomcat
- In a shell prompt as the root user, start the Tomcat service. Replace <VERSION> with the desired Tomcat version (
7
or8
):- For Red Hat Enterprise Linux 6:
# service tomcat<VERSION> start
- For Red Hat Enterprise Linux 7:
# systemctl start tomcat<VERSION>.service
- Go to http://localhost:8080 in your web browser to verify that Tomcat is running.
Note
The only supported method of starting Tomcat is using the services shown above.
Procedure 2.24. Starting Apache HTTP Server
- In a shell prompt as the root user, start the Apache HTTP Server service:
- For Red Hat Enterprise Linux 6:
# service httpd24 start
- For Red Hat Enterprise Linux 7:
# systemctl start httpd24.service
2.3.5. Stopping JBoss Web Server
Procedure 2.25. Stopping Tomcat
- In a shell prompt as the root user, stop the Tomcat service. Replace <VERSION> with the desired Tomcat version (
7
or8
):- For Red Hat Enterprise Linux 6:
# service tomcat<VERSION> stop
- For Red Hat Enterprise Linux 7:
# systemctl stop tomcat<VERSION>.service
- Go to http://localhost:8080 in your web browser to verify that Tomcat is no longer running.
Procedure 2.26. Stopping Apache HTTP Server
- In a shell prompt as the root user, stop the Apache HTTP Server service:
- For Red Hat Enterprise Linux 6:
# service httpd24 stop
- For Red Hat Enterprise Linux 7:
# systemctl stop httpd24.service
2.3.6. Configuring JBoss Web Server Services to Start at Boot
tomcat7
or tomcat8
) and Apache HTTP Server (httpd24
) services.
- For Red Hat Enterprise Linux 6:
# chkconfig <SERVICE_NAME> on
- For Red Hat Enterprise Linux 7:
# systemctl enable <SERVICE_NAME>.service
2.4. SELinux Policies
2.4.1. Default SELinux Policies for an RPM Installation
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. |
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 the 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.4.1.1. Compile SELinux Policies
Before compiling SELinux policies ensure the following prerequisites:
selinux-policy-devel
package is installed.- Tomcat 7 or 8 is installed using the 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/tomcat8/selinux/packages/tomcat8 # make -f /usr/share/selinux/devel/Makefile Compiling targeted tomcat8 module /usr/bin/checkmodule: loading policy configuration from tmp/tomcat8.tmp /usr/bin/checkmodule: policy configuration loaded /usr/bin/checkmodule: writing binary representation (version 10) to tmp/tomcat8.mod Creating targeted tomcat8.pp policy package rm tmp/tomcat8.mod.fc tmp/tomcat8.mod # semodule -i tomcat8.pp
2.4.2. SELinux Policies for a ZIP Installation
httpd_t
or unconfined_java_t
domains. These domains do not confine the processes, and it is recommended that you undertake the following security precautions:
- Always start
httpd
using theapachectl
script. This ensures that theapache
user owns the process instead of theroot
user . - Restrict file access for the
tomcat
andapache
users to only the files and directories that are necessary to the JBoss Web Server runtime. - Do not run Tomcat as the
root
user.
Chapter 3. Installing JBoss Web Server on Microsoft Windows
3.1. Installing a Java Development Kit (JDK)
Important
Procedure 3.1. Installing Java Development Kit (JDK) for Microsoft Windows
- Download the Oracle JDK 1.7 or 1.8 for your operating system and architecture. You can download the JDK installation file from the Oracle website: http://www.oracle.com/technetwork/java/javase/downloads/index.html.
- Double-click the downloaded file to start the Java installation.
- Proceed as instructed in the installation window.
3.2. Download and Extract JBoss Web Server
Procedure 3.2. Downloading JBoss Web Server
- Open a browser and log in to the Customer Portal at http://access.redhat.com.
- Click Downloads.
- Click Red Hat JBoss Web Server in the Product Downloads list.
- Select the correct JBoss Web Server version from the Version drop-down menu.
- Click Download for each of the following files, ensuring that you select the correct platform and architecture for your system:
- Red Hat JBoss Web Server 3.0 Application Server (
jws-application-servers-3.0.0-<platform>-<architecture>.zip
) - Red Hat JBoss Web Server 3.0 Apache HTTP Server (
jws-httpd-3.0.0-<platform>-<architecture>.zip
)
Procedure 3.3. Extract JBoss Web Server
- Unzip the downloaded ZIP files to your installation directory.
Note
We recommend that you install JBoss Web Server inC:\Program Files
.
3.3. Configuring the JBoss Web Server Installation
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.
- For
JAVA_HOME
,TMP
andTEMP
, enter the appropriate name-value pairs for your system. - For the SSL Connector to work, you will also need to add
JWS_HOME\bin
to the PATH environment variable of the user that the services will run under. This is SYSTEM by default.
Procedure 3.5. Running the Post-Installation Scripts
- Open a Command Prompt with administrator privileges.
- Change to the
etc
folder of your JBoss Web Server installation:cd /D "JWS_HOME\etc"
- Run the Apache HTTP Server and Tomcat post-installation scripts with the following commands:
call postinstall.httpd.bat
call postinstall.tomcat.bat
The scripts create the required symbolic links (Junction Points) for temporary logging and configuration directories.
Procedure 3.6. Installing the Tomcat Service
- Open a Command Prompt with administrator privileges.
- Change to the
bin
folder for your Tomcat version:cd /D "JWS_HOME\share\tomcat<VERSION>\bin"
- Install the Tomcat service with the following command:
call service.bat install
Procedure 3.7. Installing the Apache HTTP Server Service
Note
- Stop the
World Wide Web...
service, and change the Startup Type toManual
- Configure IIS to use different ports.
httpd.conf
before installing the Apache HTTP Server service and change Listen
to a port that does not conflict with the IIS ports.
- Open a Command Prompt with administrator privileges.
- Change to the
bin
folder of your JBoss Web Server installation:cd /D "JWS_HOME\bin"
- Install the Apache HTTP Server service with the following command:
httpd -k install
A Firewall security dialog prompt may appear asking for networking access for the Apache HTTP Server. Click Allow to access this service from the network.
Procedure 3.8. Enabling log4j Logging for Tomcat
- Open a Command Prompt with administrator privileges.
- Change to
JWS_HOME\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 fromJWS_HOME\share\extras\
:copy tomcat-juli.jar ..\tomcat<VERSION>\bin
Procedure 3.9. Removing/Re-Adding SSL Support
- Open a file browser and go to
JWS_HOME\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
Note
JWS_HOME\etc\httpd\conf.d\
. The sample configuration files are: mod_jk.conf.sample
, workers.properties.sample
, and uriworkermap.properties.sample
. To use these samples instead of creating your own configuration files, remove the .sample
extension, and modify their content as needed.
- In
JWS_HOME\etc\httpd\conf.d\
, create a file namedworkers.properties
.This file should contain the available workers (JBoss instances). - In
JWS_HOME\etc\httpd\conf.d\
, create a file namedmod_jk.conf
.This file contains general mod_jk configuration. - In
JWS_HOME\etc\httpd\conf.d\
, create a file nameduriworkermap.properties
.This file contains request mapping rules that map requests to workers.
Procedure 3.11. Configuring mod_cluster
- In
JWS_HOME\etc\httpd\conf.modules.d\00-proxy.conf
, ensure that there is a#
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 mod_cluster. - Configure the server to load the mod_cluster modules:
- Create the file
JWS_HOME\etc\httpd\conf.d\mod_cluster.conf
. - Add the following lines to
mod_cluster.conf
:LoadModule proxy_cluster_module modules/mod_proxy_cluster.so LoadModule cluster_slotmem_module modules/mod_cluster_slotmem.so LoadModule manager_module modules/mod_manager.so LoadModule advertise_module modules/mod_advertise.so
Procedure 3.12. Configuring Folder Permissions for JBoss Web Server Services
JWS_HOME
folder and all of its subfolders:
- Right-click the
JWS_HOME
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 theLOCAL 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 through all the open folder property windows to apply the settings.
3.4. Starting JBoss Web Server
- Tomcat
- Apache HTTP Server
Procedure 3.13. Starting JBoss Web Server from the Command Prompt
- Open a Command Prompt with administrator privileges.
- Start the Tomcat service:
net start tomcat<VERSION>
- Start the Apache HTTP Server (httpd) service:
net start Apache2.4
Procedure 3.14. Starting JBoss Web Server from the Computer Management Tool
- Go to Start → Administrative Tools → Services
- In the Services list, right-click the name of each service (
httpd
andtomcat
) and click Start.
Note
catalina.bat run
.
C:\windows\System32\
directory and other PATH directories, and ensure that there are no DLLs conflicting with those delivered with JBoss Web Server. In particular, look for libeay32.dll
, ssleay32.dll
, and libssl32.dll
.
3.5. Stopping JBoss Web Server
- Tomcat
- Apache HTTP Server
Procedure 3.15. Stopping JBoss Web Server from the Command Prompt
- Open a Command Prompt with administrator privileges.
- Stop the Tomcat service:
net stop tomcat<VERSION>
- Stop the Apache HTTP Server (httpd) service:
net stop Apache2.4
Procedure 3.16. Stopping JBoss Web Server from the Computer Management Tool
- Go to Start → Administrative Tools → Services
- In the Services list, right-click the name of each service (
httpd
andtomcat
) and click Stop.
Chapter 4. Installing JBoss Web Server on Solaris
4.1. Installing a Java Development Kit (JDK)
Important
Procedure 4.1. Installing Java
- Download the Oracle JDK 1.7 or 1.8 for your operating system and architecture. You can download the JDK installation file from the Oracle website: http://www.oracle.com/technetwork/java/javase/downloads/index.html.
- Run the Java installation file.
- Open
/usr
at a shell prompt, and run 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 newly installed JDK:
ln -sf /usr/jdk/<JDK>
4.2. Download and Extract JBoss Web Server
Procedure 4.2. Downloading JBoss Web Server
- Open a browser and log in to the Customer Portal at http://access.redhat.com.
- Click Downloads.
- Click Red Hat JBoss Web Server in the Product Downloads list.
- Select the correct JBoss Web Server version from the Version drop-down menu.
- Click Download for each of the following files, ensuring that you select the correct platform and architecture for your system:
- Red Hat JBoss Web Server 3.0 Application Server (
jws-application-servers-3.0.0-<platform>-<architecture>.zip
) - Red Hat JBoss Web Server 3.0 Apache HTTP Server (
jws-httpd-3.0.0-<platform>-<architecture>.zip
)
Procedure 4.3. Extract JBoss Web Server
- Unzip the downloaded ZIP files to your installation directory.
Note
We recommend that you install JBoss Web Server in the/opt/
directory.
4.3. Configuring the JBoss Web Server Installation
Procedure 4.4. Running the Post-Installation Scripts
- Open a shell prompt, and change directory to
JWS_HOME/etc
. - Issue the following commands to run the post-installation scripts:
sh .postinstall.httpd sh .postinstall.tomcat
The post-installation scripts create the Apache and Tomcat users and groups.
Procedure 4.5. Setting the JAVA_HOME
Environment Variable
JAVA_HOME
environment variable for Tomcat before running JBoss Web Server.
- Open the Tomcat configuration file:
- For Tomcat 7:
JWS_HOME/etc/sysconfig/tomcat7
- For Tomcat 8:
JWS_HOME/etc/sysconfig/tomcat8
- Remove the hash (#) sign at the beginning of the following line:
# JAVA_HOME="/usr/java"
Procedure 4.6. Removing/Re-Adding SSL Support
- Go to
JWS_HOME/etc/httpd/conf.d
and rename the SSL configuration file:- To remove SSL, rename
ssl.conf
tossl.conf.disabled
. - To re-add the SSL, rename
ssl.conf.disabled
tossl.conf
.
Procedure 4.7. Enabling log4j Logging for Tomcat
- Open a shell prompt and change directory to
JWS_HOME/share/extras/
. - 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 (7
or8
). - Replace
tomcat-juli.jar
file in your Tomcatbin
directory with thetomcat-juli.jar
file fromJWS_HOME/share/extras/
:extras]# cp tomcat-juli.jar ../tomcat<VERSION>/bin/
Procedure 4.8. Configuring mod_jk
Note
JWS_HOME/etc/httpd/conf.d/
. The sample configuration files are: mod_jk.conf.sample
, workers.properties.sample
, and uriworkermap.properties.sample
. To use these samples instead of creating your own configuration files, remove the .sample
extension, and modify their content as needed.
- In
JWS_HOME/etc/httpd/conf.d/
, create a file namedworkers.properties
.This file should contain the available workers (JBoss instances). - In
JWS_HOME/etc/httpd/conf.d/
, create a file namedmod_jk.conf
.This file contains general mod_jk configuration. - In
JWS_HOME/etc/httpd/conf.d/
, create a file nameduriworkermap.properties
.This file contains request mapping rules that map requests to workers.
Procedure 4.9. Configuring Apache HTTP Server to Use mod_cluster
- mod_cluster can be configured in
JWS_HOME/httpd/conf.d/mod_cluster.conf
.For more information about customizing mod_cluster, see the mod_cluster Connector section of the HTTP Connectors and Load Balancing Guide.
4.4. Starting JBoss Web Server
- Tomcat (7 or 8).
- Apache HTTP Server.
Procedure 4.10. Starting Tomcat
- Run the following command with your respective Tomcat version (
7
or8
):$ sh JWS_HOME/share/apache-tomcat-<VERSION>/bin/daemon.sh
Important
Although there are multiple methods of starting Tomcat, it is recommended that you use thedaemon.sh
script. To start Tomcat as a service using Jsvc, see Chapter 5, Using Jsvc to Start Tomcat.
Procedure 4.11. Starting Apache HTTP Server
- To start Apache HTTP Server (httpd), in a terminal as the root, change to
JWS_HOME/sbin/
and run the following command:# ./apachectl start
4.5. Stopping JBoss Web Server
- Tomcat (7 or 8).
- Apache HTTP Server.
Procedure 4.12. Stopping Tomcat
- To stop Tomcat, in a shell prompt as the root user change to
JWS_HOME/sbin/
and run the following command with your respective Tomcat version (7
or8
):tomcat<VERSION> stop
Procedure 4.13. Stopping Apache HTTP Server
- To stop Apache HTTP Server, in a shell prompt as the root user change to
JWS_HOME/sbin/
and run the following command:apachectl stop
Chapter 5. Using Jsvc to Start Tomcat
For Red Hat Enterprise Linux:
JWS_HOME/extras/jsvc
JWS_HOME/tomcat<VERSION>/bin/jsvc
Note
JWS_HOME/tomcat<VERSION>/bin/jsvc
is a symlink to JWS_HOME/extras/jsvc
.
For Solaris:
JWS_HOME/sbin/jsvc
JWS_HOME/share/apache-tomcat-<VERSION>/bin/jsvc
Note
JWS_HOME/share/apache-tomcat-<VERSION>/bin/jsvc
is a symlink to JWS_HOME/sbin/jsvc
.
5.1. Starting Tomcat Using Jsvc
Procedure 5.1. Start Tomcat Using Jsvc on Red Hat Enterprise Linux
- Run the following command to start Tomcat using Jsvc on Red Hat Enterprise Linux:
JWS_HOME/tomcat<VERSION>/bin/daemon.sh start
Procedure 5.2. Start Tomcat Using Jsvc on Solaris
- Run the following command to start Tomcat using Jsvc on Solaris:
JWS_HOME/share/tomcat<VERSION>/bin/daemon.sh start
5.2. Stopping Tomcat Using Jsvc
Procedure 5.3. Stop Tomcat Using Jsvc on Red Hat Enterprise Linux
- Run the following command to stop Tomcat that was started using Jsvc on Red Hat Enterprise Linux:
JWS_HOME/tomcat<VERSION>/bin/daemon.sh stop
Procedure 5.4. Stop Tomcat Using Jsvc on Solaris
- Run the following command to stop Tomcat that was started using Jsvc on Solaris:
JWS_HOME/share/tomcat<VERSION>/bin/daemon.sh stop
5.3. Jsvc Parameters
daemon.sh
script:
Table 5.1. daemon.sh
Startup Parameters
Parameter Name | Environment Variable | Default Value | Description |
---|---|---|---|
--java-home | JAVA_HOME | Based on the value of the PATH variable. | The Java home directory location. |
--catalina-home | CATALINA_HOME | Determined by the location of the script. | The Tomcat installation directory location. |
--catalina-base | CATALINA_BASE | Based on the value of the PATH variable. | The directory that contains the specific configuration and set up information if multiple servers are using the same installation. |
--catalina-pid | - | $CATALINA_BASE/logs/catalina-daemon.pid | The file where the process ID (PID) for the running instance of Tomcat is stored. |
--tomcat-user | - | tomcat | The user Tomcat uses. |
--service-start-wait-time | - | This is a wrapper to the --wait parameter. The --wait parameter accepts values in seconds. |
Chapter 6. Hibernate on JBoss Web Server
context.xml
. However, persistence.xml
and web.xml
are also required. The example below shows a configuration with the Tomcat connection pooling mechanism.
/META-INF/context.xml
defines the connection pools Tomcat should create.Example 6.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 the Hibernate API directly, use a similar configuration to that shown inhibernate.cfg.xml
.Example 6.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 instructs Tomcat which datasource to consume. In the example below, the datasource isjdbc/DsWebAppDB
.Example 6.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 7. Monitoring JBoss Web Server with JBoss Operations Network (ON)
Web Server Plugin Pack
on your JBoss ON server, and then configure Apache HTTP Server and Tomcat in JBoss Web Server to be monitored.
7.1. Download the Web Server Plugin Pack for JBoss ON
Web Server Plugin Pack
on your JBoss ON server.
Procedure 7.1. Download the Web Server Plugin Pack for JBoss ON
- Open a web browser, and log in to the Red Hat Customer Portal: http://access.redhat.com
- Click Downloads.
- Click Red Hat JBoss Web Server in the Product Downloads list.
- Select JBoss ON for Web Server in the Product drop-down menu.
- Click Download for each of the following files:
- Web Server Plugin Pack for Red Hat JBoss Operations Network
7.2. Configuring Apache HTTP Server for JBoss ON Monitoring
Procedure 7.2. Configuring Apache HTTP Server for JBoss ON Monitoring
- As the
apache
user, enable the mod_bmx modules. Create the fileJWS_HOME/httpd/conf.d/mod_bmx.conf
with the following contents:LoadModule bmx_module modules/mod_bmx.so LoadModule bmx_status_module modules/mod_bmx_status.so LoadModule bmx_vhost_module modules/mod_bmx_vhost.so
- Add a handler for mod_bmx. In
JWS_HOME/httpd/conf/httpd.conf
, append your handler definition. For example:<Location /bmx> SetHandler bmx-handler </Location>
You may want to restrict access to this URL to a specific virtual host or use password authentication. - Restart the Apache HTTP Server. You can access http://SERVER_ADDRESS:PORT/bmx in a web browser to verify that mod_bmx is working correctly.
- The Apache HTTP Server in your JBoss Web Server installation will now be discoverable for JBoss ON. In JBoss ON, you can import it from the Discovery Queue.Consult the JBoss ON documentation for further details on monitoring and managing Apache HTTP Server.
7.3. Configuring Tomcat for JBoss ON Monitoring
Procedure 7.3. Configuring User Permissions on a Linux Operating System
Note
httpd
and Tomcat directories.
- As a user with root privileges, run the following command to add the user which runs the JBoss ON Agent to the
tomcat
andapache
user groups:# usermod -aG tomcat,apache <JBOSSON_AGENT_USER>
Procedure 7.4. Configuring Tomcat for JBoss ON Monitoring
- Open the
startup
file of the respective JBoss Web Server instance for editing:- On Red Hat Enterprise Linux installed from a ZIP file, open
JWS_HOME/tomcat<VERSION>/bin/startup.sh
- On Red Hat Enterprise Linux installed from RPM, open
/usr/sbin/tomcat<VERSION>
- On Microsoft Windows open
JWS_HOME\share\tomcat<VERSION>\bin\startup.bat
. - On Solaris using
daemon.sh
to start Tomcat, openJWS_HOME/tomcat<VERSION>/bin/setenv.sh
- Define an available port for JMX monitoring. Ensure the port is not blocked by any firewall.
- 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 Microsoft Windows:
set "JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote.port=PORT_NUMBER -Djava.rmi.server.hostname=IP_ADDRESS"
- 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=JWS_HOME/jmxremote.access" JAVA_OPTS="${JAVA_OPTS} -Dcom.sun.management.jmxremote.password.file=JWS_HOME/jmxremote.password"
- On Microsoft Windows:
set "JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote.access.file=JWS_HOME\jmxremote.access" set "JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote.password.file=JWS_HOME\jmxremote.password"
Note
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"
- Once the Tomcat server resource is discovered and imported into the JBoss ON inventory, it may be necessary to update the new resource's connection settings.
- In the JBoss ON interface, click Connection Settings for the newly imported Tomcat server resource.
- Verify the value of the Manager URL property to the RMI URL, to ensure it uses the correct JMX host name and port number as defined in the Tomcat server startup file. An example for this value is shown below:
service:jmx:rmi:///jndi/rmi://$IP_ADDRESS:$PORT/jmxrmi
7.3.1. Configuring JBoss ON Monitoring for Tomcat Installed from RPMs
Procedure 7.5. Configuring JBoss ON Monitoring for Tomcat Installed from RPMs
- In a shell prompt become the root user.
- Set up JMX JAVA_OPTS properties in the
/usr/sbin/tomcat<VERSION>/startup
file in thestart
andstart-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" \
- In
/etc/tomcat<VERSION>/tomcat<VERSION>.conf
, configure Tomcat to run as the root user.TOMCAT_USER="root"
- Run the following command to start Tomcat.
service tomcat<VERSION> start
- Start the JBoss ON agent.
- In the JBoss ON Web UI, import the JBoss ON agent and Tomcat.
- In the JBoss ON Web UI, setup the Tomcat connection configuration (principal and credentials).
- In the JBoss ON Web UI, set the Tomcat Control method configuration to
RPM System V init script
.Note
Start and Shutdown script may not be set because the Tomcat plugin always runs theservice tomcat<VERSION> start/stop
command for theRPM System V init script
configuration setting.
7.3.2. Configuring JBoss ON Monitoring for Tomcat Installed as a Windows Service
Procedure 7.6. Configuring JBoss ON for JBoss Web Server with Tomcat Installed as a Windows Service
- Create the
jmxremote.access
file withcontrolRole readwrite
in theC:\jmx
directory. - Create the
jmxremote.password
file withcontrolRole pwd
in theC:\jmx
directory.Note
Set the owner ofjmxremote.access
andjmxremote.password
to SYSTEM, and restrict the access ofjmxremote.password
only to SYSTEM. The SYSTEM user must only have read access. - Enable JMX for the Tomcat Windows service.
JWS_HOME\sbin\tomcat<VERSION>.exe //US//Tomcat<VERSION> ++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 the Tomcat Windows service, and verify that it is running.
- Install and configure the JBoss ON agent. Type
discovery
in the agent prompt to discover the Tomcat Windows service. - In the JBoss ON Web UI, click Inventory and then, click Discovery Queue and select import Tomcat and RHQ agent.
- In the JBoss ON Web UI, go to Platforms and search for the agent name. Click on your agent.
- On the Agent page, Tomcat Servers are listed. Select your Tomcat server by clicking it.
- In the JBoss ON Web UI, click on the Inventory tab and then configure the Tomcat Server in Connection Settings.
- Enter the Principal and Credentials information. use the
controlRole
and password set in thejmxremote
files. - Set the 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 the Tomcat Server JVM and set Principal and Credentials.
Appendix A. Supported Apache HTTP Server Modules
- Red Hat Enterprise Linux:
JWS_HOME/httpd/modules
- Microsoft Windows:
JWS_HOME\lib64\httpd\modules
- Solaris:
JWS_HOME/etc/httpd/modules
Appendix B. Revision History
Revision History | |||||
---|---|---|---|---|---|
Revision 3.0.3-22 | Monday 4 July 2016 | Lucas Costi | |||
| |||||
Revision 3.0.1-18 | Tuesday 22 September 2015 | Lucas Costi | |||
| |||||
Revision 3.0.1-17 | Friday 4 September 2015 | Lucas Costi | |||
| |||||
Revision 3.0.0-14 | Tue 28 July 2015 | Lucas Costi | |||
| |||||
Revision 3.0.0-12 | Tue 5 May 2015 | Lucas Costi | |||
|