Building a Tomcat/Apache solution over Linux on IBM System z

towerdevelopmentΔιαχείριση Δεδομένων

16 Δεκ 2012 (πριν από 4 χρόνια και 8 μήνες)

319 εμφανίσεις



Building a Tomcat/Apache solution

for

Linux on
IBM System z









This document can be found on the web,
www.ibm.com/support/techdocs










Version Date:
April 16th, 2009




IBM


Mathieu Dalbin,
IT Specialist

Mathieu.dalbin@fr.ibm.com









© IBM Copyright, 200
9


16
-
04
-
2009

Web location of document (
www.ibm.com/support/techdocs
)

Page
2

of
23

Building a Tomcat/Apache solution for Linux on I
BM System z

Trademarks
:



The following terms are trademarks of International Business Machines Corporation in the United
States and/or other countries: zSeries. A full list of U.S. trademarks owned by IBM may be found
at
http://iplswww.nas.ibm.com/wpts/trademarks/trademar.htm
.

"Apache Tomcat" and "Tomcat" are trademarks of the Apache Software Foundation.

RedHat

is a
registered trademark of Red Hat
, Inc. in the United States and/or other countries.

UNIX is a registered trademark in the United States and other countries licensed exclusively through
The Open Group.

LINUX is a registered trademark of Linus Torvalds.

Java and all Java
-
based trademarks a
nd logos are trademarks of Sun Microsystems, Inc. in the United
States and/or other countries.

Other company, product and service names may be trademarks or service marks of others.

© IBM Copyright, 200
9


16
-
04
-
2009

Web location of document (
www.ibm.com/support/techdocs
)

Page
3

of
23

Building a Tomcat/Apache solution for Linux on I
BM System z

Table of Contents

:


1

Introduction

................................
................................
................................
..................

4

2

Architecture Considerations

................................
................................
........................

4

3

Software installation

................................
................................
................................
.....

6

3.1

Yum setup

................................
................................
................................
.......................

6

3.1.1

FTP server configuration

................................
................................
................................

6

3.1.2

Yum repository configuration

................................
................................
........................

6

3.2

Apache setup

................................
................................
................................
..................

7

3.3

Tomcat setup

................................
................................
................................
..................

9

3.3.1

Tomcat server installation

................................
................................
..............................

9

3.3.2

JVM installation (optional)

................................
................................
..........................

14

3.3.3

Web applications installation

................................
................................
.......................

14

3.4

mod_jk setup

................................
................................
................................
................

16

3.5

The second Linux machine

................................
................................
...........................

17

4

Apache and Tomcat configuration

................................
................................
............

18

4.1

Tomcat configuration

................................
................................
................................
...

18

4.1.1

First Linux configuration (
lnxrh1
)

................................
................................
...............

18

4.1.2

Second Linux co
nfiguration (
lnxrh2
)

................................
................................
...........

19

4.2

mod_jk configuration

................................
................................
................................
...

19

4.3

Apache configuration

................................
................................
................................
...

20

5

Bibliography

................................
................................
....

Error! Bookmark not defined.





Special note

:


This document has been created based on experiences acquired through the setup of a
benchmark platform using Tomcat and Apache
.


Thank you to Guillaume Lasmayous (
guillau
me.lasmayous@fr.ibm.com)

for
reviewing this document.




© IBM Copyright, 200
9


16
-
04
-
2009

Web location of document (
www.ibm.com/support/techdocs
)

Page
4

of
23

Building a Tomcat/Apache solution for Linux on I
BM System z

1

Introduction


The goal of this document is to give the information needed to build a complete
architecture running a
W
eb server and applications servers on Linux on IBM System z. For
this demonstrat
ion, the distribution used is RedHat 5 Update 2

(64 bits)
, which
contain
s the
HTTP server Apache 2.2.3 and Tomcat 5.5.23.


2

Architecture Considerations


First of all, we need to determine the architecture to put in place:




A Web server should be placed in f
ront of
the solution to handle the static web
documents (such as HTML files) and also redirect requests to J2EE
applications running on Tomcat.



Two Tomcat applications servers will be used for hosting the J2EE
applications. These servers will be reachable
through the HTTP Apache server.



In our configuration, the two Linux machines are running as z/VM guests, each having
4 CP shared and 2 GB of memory. The z/VM system version is 5.4, and is running in a
System z LPAR configured with 4 CP and 4 GB of memory
. The machine is an IBM z10
model, connected to
an

IBM DS8000 System storage with FICON channels.




The Linux images are RedHat 5 Update 2, with Tomcat 5.5.23 installed on both nodes.
Apache 2.2.3 is also installed on the first node, to ensure the dispat
ching of requests to J2EE
applications.

Both Linux machines are connected to a network through a Virtual Switch, and
they are able to reach other machines in this network.


© IBM Copyright, 200
9


16
-
04
-
2009

Web location of document (
www.ibm.com/support/techdocs
)

Page
5

of
23

Building a Tomcat/Apache solution for Linux on I
BM System z

As a starting base for this document, we will assume that the
z/VM system is alread
y
installed and running, as for the two
Linux machine
s
. Please refer to [1] to understand how t
o
install and configure z/VM for

Linux on System z
.


In our configuration, an FTP server hosting the package suite for RedHat 5 Update 2 is
reachable from both L
inux guests: this FTP server will be used for package maintenance in
the later phases.


© IBM Copyright, 200
9


16
-
04
-
2009

Web location of document (
www.ibm.com/support/techdocs
)

Page
6

of
23

Building a Tomcat/Apache solution for Linux on I
BM System z

3

Software installation


Linux installation is out of scope of this document, please refer to [
1
] for more
information.


All the following operations are made with the r
oot user, unless stated otherwise.

3.1

Yum setup


Yum is
an
utility package capable of installing, removing and maintaining RedHat
packages, known as RPM packages. This tool is useful in the way that it handles properly the
dependencies between packages, which

be very difficult to manage
manually
. Indeed, the
Tomcat suite needs different dependencies to install properly, so yum will handle this part for
us.


Yum can access repositories hosted on NFS servers, HTTP servers and FTP servers.
Here we have chosen the

last option.

3.1.1

FTP server configuration


No particular configuration should be done on the FTP server, but the main point is the
way

the packages are accessible:




The DVD image is located on the FTP server and is mounted on the loopback
device :


sudo mount

-
t iso9660 RHEL5.2
-
s390x
-
DVD.iso RHEL5U2/DVD
-
o loop,ro




The FTP server is accessible with the “
ftpusr
” user, with password “
xxxxxx
”.
When logged in, the

ftpusr


user can access the repository at the path

/dists/RHEL5U2
-
s390x/RHEL5U2/DVD/Server


3.1.2

Yum rep
ository configuration


Repositories c
onfiguration
s

for yum
are

located in “
/etc/yum.repos.d

. In this
directory, you must create a file describing your repository. In our configuration:


[rhel5]

name=Red Hat Enterpris
e Linux $releasever
-

$basearch

baseurl
=ftp://ftpusr:
xxxxxx
@
IP_AD
D
RESS
/dists/RHEL5U2
-
s390x/RHEL5U2/DVD/Server

enabled=1


Please watch out to change to IP_AD
D
RESS variable to the IP address of your FTP
server. You may also change the user, password and location path to the repository on the
serv
er.




© IBM Copyright, 200
9


16
-
04
-
2009

Web location of document (
www.ibm.com/support/techdocs
)

Page
7

of
23

Building a Tomcat/Apache solution for Linux on I
BM System z

You should get the following output when using yum to search for packages named

tomcat
5
”:


[root@lnxrh1

yum.repos.d]# yum search tomcat5

Loading "security" plugin

Loading "rhnplugin" plugin

This system is not registered with RHN.

RHN support will b
e disabled.

rhel5 100% |=========================| 1.3 kB 00:00

primary.xml.gz 100% |=========================| 712 kB 00:04

rhel5 : ################################################## 2595/2595

tomcat5
-
servlet
-
2.4
-
a
pi
-
javadoc.s390x : Javadoc generated documentation for
tomcat5
-
servlet
-
2.4
-
api

tomcat5
-
admin
-
webapps.s390x : The administrative web applications for Jakarta
Tomcat

tomcat5
-
jasper.s390x : Compiler JARs and associated scripts for tomcat5

tomcat5
-
webapps.s390
x : Web applications for Jakarta Tomcat

tomcat5
-
servlet
-
2.4
-
api.s390x : Jakarta Tomcat Servlet implementation classes

tomcat5
-
jsp
-
2.0
-
api
-
javadoc.s390x : Javadoc generated documentation for tomcat5
-
jsp
-
2.0
-
api

tomcat5
-
server
-
lib.s390x : Libraries needed to

run the Tomcat Web container (part)

struts
-
webapps
-
tomcat5.s390x : Sample struts webapps for tomcat5

tomcat5
-
jsp
-
2.0
-
api.s390x : Jakarta Tomcat Servlet and JSP implementation classes

tomcat5
-
jasper
-
javadoc.s390x : Javadoc generated documentation for tomca
t5
-
jasper

tomcat5.s390x : Apache Servlet/JSP Engine, RI for Servlet 2.4/JSP 2.0 API

jakarta
-
commons
-
collections
-
tomcat5.s390x : Jakarta Commons Collection dependency
for Tomcat5

tomcat5
-
common
-
lib.s390x : Libraries needed to run the Tomcat Web container (p
art)


The last

step is to import GPG signatures of packages in order to avoid messages in
yum saying that some GPG signatures are not installed. For example:


Public key for postgresql
-
libs
-
8.1.11
-
1.el5_1.1.s390x.rpm is not installed



For this error to av
oid, or correct if already encountered, you need to import 3 files
with the rpm command:


[root@
lnxrh1

~]# cd /etc/pki/rpm
-
gpg/

[root@
lnxrh1

rpm
-
gpg]# rpm
--
import RPM
-
GPG
-
KEY
-
redhat
-
beta

[root@
lnxrh1

rpm
-
gpg]# rpm
--
import RPM
-
GPG
-
KEY
-
redhat
-
auxiliary

[ro
ot@
lnxrh1

rpm
-
gpg]# rpm
--
import RPM
-
GPG
-
KEY
-
redhat
-
release


You are now ready to install your new software.


3.2

Apache setup


At first, we are going to install an HTTP server; the one available in RedHat 5 Update
2 is Apache 2.2.3. This server is packaged un
der the name “
httpd.s390x
”. With yum
,

you can
search for this package and install it:


[root@
lnxrh1

~]# yum install httpd.s390x

Loading "security" plugin

Loading "rhnplugin" plugin

This system is not registered with RHN.

RHN support will be disabled.

Setti
ng up Install Process

Parsing package install arguments

Resolving Dependencies

--
> Running transaction check

---
> Package httpd.s390x 0:2.2.3
-
11.el5_1.3 set to be updated

--
> Processing Dependency: libapr
-
1.so.0()(64bit) for package: httpd

--
> Processing D
ependency: libaprutil
-
1.so.0()(64bit) for package: httpd

--
> Running transaction check

© IBM Copyright, 200
9


16
-
04
-
2009

Web location of document (
www.ibm.com/support/techdocs
)

Page
8

of
23

Building a Tomcat/Apache solution for Linux on I
BM System z

---
> Package apr.s390x 0:1.2.7
-
11 set to be updated

---
> Package apr
-
util.s390x 0:1.2.7
-
7.el5 set to be updated

--
> Processing Dependency: libpq.so.4()(64bit) for packag
e: apr
-
util

--
> Running transaction check

---
> Package postgresql
-
libs.s390x 0:8.1.11
-
1.el5_1.1 set to be updated

--
> Finished Dependency Resolution


Dependencies Resolved


=============================================================================


Pack
age Arch Version Repository Size

=============================================================================

Installing:


httpd s390x 2.2.3
-
11.el5_1.3 rhel5 1.1 M

Installing for de
pendencies:


apr s390x 1.2.7
-
11 rhel5 122 k


apr
-
util s390x 1.2.7
-
7.el5 rhel5 78 k


postgresql
-
libs s390x 8.1.11
-
1.el5_1.1 rhel5 199 k


Transaction

Summary

=============================================================================

Install 4 Package(s)

Update 0 Package(s)

Remove 0 Package(s)


Total download size: 1.5 M

Is this ok [y/N]:
y

Downloading Packages:

Running rpm_check_deb
ug

Running Transaction Test

Finished Transaction Test

Transaction Test Succeeded

Running Transaction


Installing: apr ######################### [1/4]


Installing: postgresql
-
libs ######################### [2/4]


Ins
talling: apr
-
util ######################### [3/4]


Installing: httpd ######################### [4/4]


Installed: httpd.s390x 0:2.2.3
-
11.el5_1.3

Dependency Installed: apr.s390x 0:1.2.7
-
11 apr
-
util.s390x 0:1.2.7
-
7.
el5 postgresql
-
libs.s390x 0:8.1.11
-
1.el5_1.1

Complete!


You can now test your Apache server to check if it runs correctly. You will need to
ask the httpd service to start, and connect with a browser to the Linux guest
(on default HTTP

port
80):


[root@
lnxr
h1

~]# service httpd start

Starting httpd: [ OK ]


© IBM Copyright, 200
9


16
-
04
-
2009

Web location of document (
www.ibm.com/support/techdocs
)

Page
9

of
23

Building a Tomcat/Apache solution for Linux on I
BM System z

On your browser, you should get the following screen:




If you are not able to connect, you may have to disable the firewall (the iptables
service) by entering the following command:


[root@
lnxrh1

con
f.d]# service iptables stop

Flushing firewall rules: [ OK ]

Setting chains to policy ACCEPT: filter [ OK ]

Unloading iptables modules: [ OK ]


3.3

Tomcat setup

3.3.1

Tomcat server installation


We are now going to install the tomcat suite. With yum, search and

install the package
“tomcat5.s390x”. A lot of packages should come along, in order to resolve dependencies: note
that the java package included in the distribution is also installed.



[root@
lnxrh1

~]# yum install tomcat5.s390x

Loading "security" plugin

L
oading "rhnplugin" plugin

Setting up Install Process

Parsing package install arguments

Resolving Dependencies

--
> Running transaction check

---
> Package tomcat5.s390x 0:5.5.23
-
0jpp.7.el5 set to be updated

--
> Processing Dependency: tomcat5
-
common
-
lib = 5.5
.23
-
0jpp.7.el5 for package:
tomcat5

--
> Processing Dependency: jakarta
-
commons
-
daemon >= 1.0.1 for package: tomcat5

© IBM Copyright, 200
9


16
-
04
-
2009

Web location of document (
www.ibm.com/support/techdocs
)

Page
10

of
23

Building a Tomcat/Apache solution for Linux on I
BM System z

--
> Processing Dependency: tomcat5
-
server
-
lib = 5.5.23
-
0jpp.7.el5 for package:
tomcat5

--
> Processing Dependency: xml
-
commons
-
apis >= 1.3 fo
r package: tomcat5

--
> Processing Dependency: jndi
-
ldap for package: tomcat5

--
> Processing Dependency: xerces
-
j2 >= 2.7.1 for package: tomcat5

--
> Processing Dependency: tomcat5
-
common
-
lib = 5.5.23
-
0jpp.7.el5 for package:
tomcat5

--
> Processing Dependency
: jakarta
-
commons
-
launcher >= 0.9 for package: tomcat5

--
> Processing Dependency: tomcat5
-
server
-
lib = 5.5.23
-
0jpp.7.el5 for package:
tomcat5

--
> Running transaction check

---
> Package xml
-
commons
-
apis.s390x 0:1.3.02
-
0.b2.7jpp.10 set to be updated

--
> Proc
essing Dependency: xml
-
commons = 1.3.02
-
0.b2.7jpp.10 for package: xml
-
commons
-
apis

---
> Package tomcat5
-
common
-
lib.s390x 0:5.5.23
-
0jpp.7.el5 set to be updated

--
> Processing Dependency: tomcat5
-
jsp
-
2.0
-
api = 5.5.23
-
0jpp.7.el5 for package:
tomcat5
-
common
-
li
b

--
> Processing Dependency: jakarta
-
commons
-
logging >= 1.0.4 for package: tomcat5
-
common
-
lib

--
> Processing Dependency: jaf >= 1.0.1 for package: tomcat5
-
common
-
lib

--
> Processing Dependency: jakarta
-
commons
-
pool >= 1.2 for package: tomcat5
-
common
-
lib

--
>

Processing Dependency: jakarta
-
commons
-
el >= 1.0 for package: tomcat5
-
common
-
lib

--
> Processing Dependency: jakarta
-
commons
-
dbcp >= 1.2.1 for package: tomcat5
-
common
-
lib

--
> Processing Dependency: eclipse
-
ecj >= 3.1.1 for package: tomcat5
-
common
-
lib

--
> P
rocessing Dependency: tomcat5
-
jasper = 5.5.23
-
0jpp.7.el5 for package: tomcat5
-
common
-
lib

--
> Processing Dependency: javamail >= 1.3.1 for package: tomcat5
-
common
-
lib

--
> Processing Dependency: tomcat5
-
jsp
-
2.0
-
api = 5.5.23
-
0jpp.7.el5 for package:
tomcat5
-
co
mmon
-
lib

--
> Processing Dependency: ant >= 1.6 for package: tomcat5
-
common
-
lib

--
> Processing Dependency: tomcat5
-
servlet
-
2.4
-
api = 5.5.23
-
0jpp.7.el5 for package:
tomcat5
-
common
-
lib

--
> Processing Dependency: jakarta
-
commons
-
el >= 1.0 for package: tomcat5
-
common
-
lib

--
> Processing Dependency: jakarta
-
commons
-
collections >= 3.1 for package: tomcat5
-
common
-
lib

--
> Processing Dependency: tomcat5
-
jasper = 5.5.23
-
0jpp.7.el5 for package: tomcat5
-
common
-
lib

--
> Processing Dependency: jta >= 1.0.1 for package: tomc
at5
-
common
-
lib

--
> Processing Dependency: ant >= 1.6 for package: tomcat5
-
common
-
lib

--
> Processing Dependency: jakarta
-
commons
-
logging >= 1.0.4 for package: tomcat5
-
common
-
lib

--
> Processing Dependency: jaf >= 1.0.1 for package: tomcat5
-
common
-
lib

--
> Pro
cessing Dependency: tomcat5
-
servlet
-
2.4
-
api = 5.5.23
-
0jpp.7.el5 for package:
tomcat5
-
common
-
lib

--
> Processing Dependency: jakarta
-
commons
-
pool >= 1.2 for package: tomcat5
-
common
-
lib

--
> Processing Dependency: jakarta
-
commons
-
dbcp >= 1.2.1 for package: tom
cat5
-
common
-
lib

--
> Processing Dependency: eclipse
-
ecj >= 3.1.1 for package: tomcat5
-
common
-
lib

--
> Processing Dependency: jakarta
-
commons
-
collections >= 3.1 for package: tomcat5
-
common
-
lib

--
> Processing Dependency: javamail >= 1.3.1 for package: tomcat5
-
common
-
lib

--
> Processing Dependency: mx4j >= 3.0.1 for package: tomcat5
-
common
-
lib

--
> Processing Dependency: jta >= 1.0.1 for package: tomcat5
-
common
-
lib

--
> Processing Dependency: mx4j >= 3.0.1 for package: tomcat5
-
common
-
lib

---
> Package tomcat5
-
server
-
lib.s390x 0:5.5.23
-
0jpp.7.el5 set to be updated

--
> Processing Dependency: jakarta
-
commons
-
digester >= 1.6 for package: tomcat5
-
server
-
lib

--
> Processing Dependency: jakarta
-
commons
-
beanutils >= 1.7.0 for package: tomcat5
-
server
-
lib

--
> Processing Depende
ncy: regexp >= 1.3 for package: tomcat5
-
server
-
lib

--
> Processing Dependency: jakarta
-
commons
-
modeler >= 1.1
-
8jpp.1.0.1 for package:
tomcat5
-
server
-
lib

--
> Processing Dependency: jakarta
-
commons
-
beanutils >= 1.7.0 for package: tomcat5
-
server
-
lib

--
> Proces
sing Dependency: jakarta
-
commons
-
fileupload >= 1.0
-
1jpp for package:
tomcat5
-
server
-
lib

--
> Processing Dependency: regexp >= 1.3 for package: tomcat5
-
server
-
lib

--
> Processing Dependency: jakarta
-
commons
-
digester >= 1.6 for package: tomcat5
-
server
-
lib

--
>
Processing Dependency: jakarta
-
commons
-
modeler >= 1.1
-
8jpp.1.0.1 for package:
tomcat5
-
server
-
lib

© IBM Copyright, 200
9


16
-
04
-
2009

Web location of document (
www.ibm.com/support/techdocs
)

Page
11

of
23

Building a Tomcat/Apache solution for Linux on I
BM System z

--
> Processing Dependency: jakarta
-
commons
-
fileupload >= 1.0
-
1jpp for package:
tomcat5
-
server
-
lib

---
> Package ldapjdk.s390x 0:4.18
-
2jpp.3.el5 set to be update
d

---
> Package jakarta
-
commons
-
launcher.s390x 0:0.9
-
6jpp.1 set to be updated

---
> Package xerces
-
j2.s390x 0:2.7.1
-
7jpp.2 set to be updated

--
> Processing Dependency: xml
-
commons
-
resolver >= 1.1 for package: xerces
-
j2

---
> Package jakarta
-
commons
-
daemon.s39
0x 1:1.0.1
-
6jpp.1 set to be updated

--
> Running transaction check

---
> Package jakarta
-
commons
-
pool.s390x 0:1.3
-
5jpp.1 set to be updated

---
> Package mx4j.s390x 1:3.0.1
-
6jpp.4 set to be updated

--
> Processing Dependency: axis >= 1.1 for package: mx4j

--
> P
rocessing Dependency: bcel >= 5.0 for package: mx4j

--
> Processing Dependency: log4j >= 1.2.7 for package: mx4j

---
> Package jakarta
-
commons
-
digester.s390x 0:1.7
-
5jpp.1 set to be updated

---
> Package jakarta
-
commons
-
logging.s390x 0:1.0.4
-
6jpp.1 set to be u
pdated

---
> Package eclipse
-
ecj.s390x 1:3.2.1
-
19.el5 set to be updated

---
> Package tomcat5
-
servlet
-
2.4
-
api.s390x 0:5.5.23
-
0jpp.7.el5 set to be updated

---
> Package jakarta
-
commons
-
el.s390x 0:1.0
-
7jpp.1 set to be updated

---
> Package jakarta
-
commons
-
fileup
load.s390x 1:1.0
-
6jpp.1 set to be updated

---
> Package classpathx
-
jaf.s390x 0:1.0
-
9jpp.1 set to be updated

---
> Package jakarta
-
commons
-
collections.s390x 0:3.2
-
2jpp.3 set to be updated

---
> Package xml
-
commons.s390x 0:1.3.02
-
0.b2.7jpp.10 set to be updated

---
> Package classpathx
-
mail.s390x 0:1.1.1
-
4jpp.2 set to be updated

---
> Package jakarta
-
commons
-
beanutils.s390x 0:1.7.0
-
5jpp.1 set to be updated

---
> Package ant.s390x 0:1.6.5
-
2jpp.2 set to be updated

---
>
Processing Dependency: java
-
devel for package: an
t

---
> Package tomcat5
-
jasper.s390x 0:5.5.23
-
0jpp.7.el5 set to be updated

---
> Package jakarta
-
commons
-
dbcp.s390x 0:1.2.1
-
7jpp.1 set to be updated

---
> Package jakarta
-
commons
-
modeler.s390x 0:1.1
-
8jpp.3.el5 set to be updated

--
> Processing Dependency: jaxp
_transform_impl for package: jakarta
-
commons
-
modeler

---
> Package regexp.s390x 0:1.4
-
2jpp.2 set to be updated

---
> Package tomcat5
-
jsp
-
2.0
-
api.s390x 0:5.5.23
-
0jpp.7.el5 set to be updated

---
> Package xml
-
commons
-
resolver.s390x 0:1.1
-
1jpp.12 set to be updat
ed

---
> Package geronimo
-
specs
-
compat.s390x 0:1.0
-
0.M2.2jpp.12 set to be updated

--
> Processing Dependency: geronimo
-
specs = 1.0
-
0.M2.2jpp.12 for package: geronimo
-
specs
-
compat

--
> Running transaction check

---
> Package xalan
-
j2.s390x 0:2.7.0
-
6jpp.1 set to

be updated

---
> Package geronimo
-
specs.s390x 0:1.0
-
0.M2.2jpp.12 set to be updated

---
> Package log4j.s390x 0:1.2.13
-
3jpp.2 set to be updated

---
> Package axis.s390x 0:1.2.1
-
2jpp.6 set to be updated

--
> Processing Dependency: jakarta
-
commons
-
httpclient for

package: axis

--
> Processing Dependency: wsdl4j for package: axis

--
> Processing Dependency: jakarta
-
commons
-
discovery for package: axis

---
> Package java
-
1.4.2
-
gcj
-
compat
-
devel.s390x 0:1.4.2.0
-
40jpp.115 set to be
updated

--
> Processing Dependency: libgcj
-
devel >= 4.0.0
-
0.42 for package: java
-
1.4.2
-
gcj
-
compat
-
devel

--
> Processing Dependency: gcc
-
java >= 4.0.0
-
0.42 for package: java
-
1.4.2
-
gcj
-
compat
-
devel

--
> Processing Dependency: /usr/lib/gcc/s390x
-
redhat
-
linux/4.1.1/libgcj.spec for
package: java
-
1.4.2
-
gc
j
-
compat
-
devel

--
> Processing Dependency: libgcj
-
devel >= 4.0.0
-
0.42 for package: java
-
1.4.2
-
gcj
-
compat
-
devel

--
> Processing Dependency: gcc
-
java >= 4.0.0
-
0.42 for package: java
-
1.4.2
-
gcj
-
compat
-
devel

--
> Processing Dependency: /usr/lib/gcc/s390x
-
redhat
-
li
nux/4.1.1/libgcj.spec for
package: java
-
1.4.2
-
gcj
-
compat
-
devel

---
> Package bcel.s390x 0:5.1
-
8jpp.1 set to be updated

--
> Running transaction check

---
> Package wsdl4j.s390x 0:1.5.2
-
4jpp.1 set to be updated

---
> Package jakarta
-
commons
-
discovery.s390x 1:0.
3
-
4jpp.1 set to be updated

---
> Package libgcj
-
devel.s390x 0:4.1.2
-
42.el5 set to be updated

--
> Processing Dependency: /usr/lib64/libz.so for package: libgcj
-
devel

--
> Processing Dependency: zlib
-
devel for package: libgcj
-
devel

---
> Package jakarta
-
commons
-
httpclient.s390x 1:3.0
-
7jpp.1 set to be updated

---
> Package gcc
-
java.s390x 0:4.1.2
-
42.el5 set to be updated

--
> Processing Dependency: gcc = 4.1.2
-
42.el5 for package: gcc
-
java

--
> Running transaction check

---
> Package zlib
-
devel.s390x 0:1.2.3
-
3 set to b
e updated

---
> Package gcc.s390x 0:4.1.2
-
42.el5 set to be updated

--
> Processing Dependency: libgomp.so.1()(64bit) for package: gcc

--
> Processing Dependency: glibc
-
devel >= 2.2.90
-
12 for package: gcc

--
> Processing Dependency: libgomp = 4.1.2
-
42.el5 for p
ackage: gcc

--
> Running transaction check

---
> Package glibc
-
devel.s390x 0:2.5
-
24 set to be updated

--
> Processing Dependency: glibc
-
headers = 2.5
-
24 for package: glibc
-
devel

© IBM Copyright, 200
9


16
-
04
-
2009

Web location of document (
www.ibm.com/support/techdocs
)

Page
12

of
23

Building a Tomcat/Apache solution for Linux on I
BM System z

--
> Processing Dependency: glibc
-
headers for package: glibc
-
devel

---
> Package li
bgomp.s390x 0:4.1.2
-
42.el5 set to be updated

--
> Running transaction check

---
> Package glibc
-
headers.s390x 0:2.5
-
24 set to be updated

--
> Processing Dependency: kernel
-
headers >= 2.2.1 for package: glibc
-
headers

--
> Processing Dependency: kernel
-
headers f
or package: glibc
-
headers

--
> Running transaction check

---
> Package kernel
-
headers.s390x 0:2.6.18
-
92.el5 set to be updated

--
> Finished Dependency Resolution


Dependencies Resolved


=========================================================================
====


Package Arch Version Repository Size

=============================================================================

Installing:


tomcat5 s390x 5.5.23
-
0jpp.7.el5 rhel5 371 k

Instal
ling for dependencies:


ant s390x 1.6.5
-
2jpp.2 rhel5 2.5 M


axis s390x 1.2.1
-
2jpp.6 rhel5 2.4 M


bcel s390x 5.1
-
8jpp.1 rhel5 1.2 M


c
lasspathx
-
jaf s390x 1.0
-
9jpp.1 rhel5 116 k


classpathx
-
mail s390x 1.1.1
-
4jpp.2 rhel5 1.3 M


eclipse
-
ecj s390x 1:3.2.1
-
19.el5 rhel5 9.5 M


gcc s3
90x 4.1.2
-
42.el5 rhel5 5.3 M


gcc
-
java s390x 4.1.2
-
42.el5 rhel5 2.8 M


geronimo
-
specs s390x 1.0
-
0.M2.2jpp.12 rhel5 265 k


geronimo
-
specs
-
compat s390x 1.0
-
0.M2.2jpp.1
2 rhel5 5.5 k


glibc
-
devel s390x 2.5
-
24 rhel5 2.5 M


glibc
-
headers s390x 2.5
-
24 rhel5 598 k


jakarta
-
commons
-
beanutils s390x 1.7.0
-
5jpp.1 rhel5 5
90 k


jakarta
-
commons
-
collections s390x 3.2
-
2jpp.3 rhel5 1.2 M


jakarta
-
commons
-
daemon s390x 1:1.0.1
-
6jpp.1 rhel5 47 k


jakarta
-
commons
-
dbcp s390x 1.2.1
-
7jpp.1 rhel5 295 k


jakarta
-
common
s
-
digester s390x 1.7
-
5jpp.1 rhel5 365 k


jakarta
-
commons
-
discovery s390x 1:0.3
-
4jpp.1 rhel5 157 k


jakarta
-
commons
-
el s390x 1.0
-
7jpp.1 rhel5 279 k


jakarta
-
commons
-
fileupload s390x

1:1.0
-
6jpp.1 rhel5 56 k


jakarta
-
commons
-
httpclient s390x 1:3.0
-
7jpp.1 rhel5 635 k


jakarta
-
commons
-
launcher s390x 0.9
-
6jpp.1 rhel5 104 k

jakarta
-
commons
-
logging s390x 1.0.4
-
6jpp.1

rhel5 119 k


jakarta
-
commons
-
modeler s390x 1.1
-
8jpp.3.el5 rhel5 277 k


jakarta
-
commons
-
pool s390x 1.3
-
5jpp.1 rhel5 151 k


java
-
1.4.2
-
gcj
-
compat
-
devel s390x 1.4.2.0
-
40jpp.115 rhel5

50 k


kernel
-
headers s390x 2.6.18
-
92.el5 rhel5 852 k


ldapjdk s390x 4.18
-
2jpp.3.el5 rhel5 965 k


libgcj
-
devel s390x 4.1.2
-
42.el5 rhel5 1.4 M


libgomp

s390x 4.1.2
-
42.el5 rhel5 84 k


log4j s390x 1.2.13
-
3jpp.2 rhel5 774 k


mx4j s390x 1:3.0.1
-
6jpp.4 rhel5 2.8 M


regexp s390x 1.4
-
2jpp.2 rhel5 108 k


tomcat5
-
common
-
lib s390x 5.5.23
-
0jpp.7.el5 rhel5 230 k


tomcat5
-
jasper s390x 5.5.23
-
0jpp.7.el5 rhel5 1.2 M


tomcat5
-
jsp
-
2.0
-
api s390x 5.5.23
-
0jpp.7.el5 rhel5

102 k


tomcat5
-
server
-
lib s390x 5.5.23
-
0jpp.7.el5 rhel5 4.3 M


tomcat5
-
servlet
-
2.4
-
api s390x 5.5.23
-
0jpp.7.el5 rhel5 163 k


wsdl4j s390x 1.5.2
-
4jpp.1 rhel5 447 k


x
alan
-
j2 s390x 2.7.0
-
6jpp.1 rhel5 3.1 M


xerces
-
j2 s390x 2.7.1
-
7jpp.2 rhel5 2.1 M


xml
-
commons s390x 1.3.02
-
0.b2.7jpp.10 rhel5 19 k


xml
-
commons
-
apis

s390x 1.3.02
-
0.b2.7jpp.10 rhel5 409 k


xml
-
commons
-
resolver s390x 1.1
-
1jpp.12 rhel5 181 k


zlib
-
devel s390x 1.2.3
-
3 rhel5 106 k


Transaction Summary

=======================
======================================================

Install 46 Package(s)

Update 0 Package(s)

Remove 0 Package(s)


Total download size: 52 M

Is this ok [y/N]: Downloading Packages:

Running rpm_check_debug

Running Transaction Test

Finishe
d Transaction Test

Transaction Test Succeeded

Running Transaction

© IBM Copyright, 200
9


16
-
04
-
2009

Web location of document (
www.ibm.com/support/techdocs
)

Page
13

of
23

Building a Tomcat/Apache solution for Linux on I
BM System z


Installing: jakarta
-
commons
-
logging ####################### [ 1/46]


Installing: tomcat5
-
servlet
-
2.4
-
api ####################### [ 2/46]


Installing: jakarta
-
commons
-
collection
s ####################### [ 3/46]


Installing: classpathx
-
jaf ####################### [ 4/46]


Installing: classpathx
-
mail ####################### [ 5/46]


Installing: jakarta
-
commons
-
beanutils ####################### [ 6/
46]


Installing: jakarta
-
commons
-
digester ####################### [ 7/46]


Installing: tomcat5
-
jasper ####################### [ 8/46]


Installing: regexp ####################### [ 9/46]


Installing: jakarta
-
commo
ns
-
el ####################### [10/46]


Installing: eclipse
-
ecj ####################### [11/46]


Installing: jakarta
-
commons
-
pool ####################### [12/46]


Installing: xml
-
commons ###############
######## [13/46]


Installing: xml
-
commons
-
apis ####################### [14/46]


Installing: jakarta
-
commons
-
dbcp ####################### [15/46]


Installing: bcel ####################### [16/46]


Installing:
jakarta
-
commons
-
fileupload ####################### [17/46]


Installing: tomcat5
-
jsp
-
2.0
-
api ####################### [18/46]


Installing: jakarta
-
commons
-
discovery ####################### [19/46]


Installing: jakarta
-
commons
-
httpclient ##
##################### [20/46]


Installing: jakarta
-
commons
-
launcher ####################### [21/46]


Installing: libgomp ####################### [22/46]


Installing: ldapjdk ####################### [23/46]



Installing: jakarta
-
commons
-
daemon ####################### [24/46]


Installing: zlib
-
devel ####################### [25/46]


Installing: libgcj
-
devel ####################### [26/46]


Installing: kernel
-
headers

####################### [27/46]


Installing: glibc
-
headers ####################### [28/46]


Installing: glibc
-
devel ####################### [29/46]


Installing: gcc ####################
### [30/46]


Installing: gcc
-
java ####################### [31/46]


Installing: java
-
1.4.2
-
gcj
-
compat
-
devel ####################### [32/46]


Installing: xerces
-
j2 ####################### [33/46]


Installing: log4j

####################### [34/46]


Installing: xml
-
commons
-
resolver ####################### [35/46]


Installing: wsdl4j ####################### [36/46]


Installing: axis #######
################ [37/46]


Installing: mx4j ####################### [38/46]


Installing: geronimo
-
specs ####################### [39/46]


Installing: xalan
-
j2 ####################### [40/46]


Inst
alling: jakarta
-
commons
-
modeler ####################### [41/46]


Installing: tomcat5
-
server
-
lib ####################### [42/46]


Installing: ant ####################### [43/46]


Installing: geronimo
-
specs
-
compat

####################### [44/46]


Installing: tomcat5
-
common
-
lib ####################### [45/46]


Installing: tomcat5 ####################### [46/46]


Installed: tomcat5.s390x 0:5.5.23
-
0jpp.7.el5

Dependency Installed:
ant.s390x 0:1.6.5
-
2jpp.2 axis.s390x 0:1.2.1
-
2jpp.6 bcel.s390x
0:5.1
-
8jpp.1 classpathx
-
jaf.s390x 0:1.0
-
9jpp.1 classpathx
-
mail.s390x 0:1.1.1
-
4jpp.2
eclipse
-
ecj.s390x 1:3.2.1
-
19.el5 gcc.s390x 0:4.1.2
-
42.el5 gcc
-
java.s390x 0:4.1.2
-
42.el5 geronimo
-
specs.s390x 0
:1.0
-
0.M2.2jpp.12 geronimo
-
specs
-
compat.s390x 0:1.0
-
0.M2.2jpp.12 glibc
-
devel.s390x 0:2.5
-
24 glibc
-
headers.s390x 0:2.5
-
24 jakarta
-
commons
-
beanutils.s390x 0:1.7.0
-
5jpp.1 jakarta
-
commons
-
collections.s390x 0:3.2
-
2jpp.3 jakarta
-
commons
-
daemon.s390x 1:1.0.1
-
6jpp
.1 jakarta
-
commons
-
dbcp.s390x
0:1.2.1
-
7jpp.1 jakarta
-
commons
-
digester.s390x 0:1.7
-
5jpp.1 jakarta
-
commons
-
discovery.s390x 1:0.3
-
4jpp.1 jakarta
-
commons
-
el.s390x 0:1.0
-
7jpp.1 jakarta
-
commons
-
fileupload.s390x 1:1.0
-
6jpp.1 jakarta
-
commons
-
httpclient.s390x 1:3.0
-
7jpp.1
jakarta
-
commons
-
launcher.s390x 0:0.9
-
6jpp.1 jakarta
-
commons
-
logging.s390x 0:1.0.4
-
6jpp.1 jakarta
-
commons
-
modeler.s390x 0:1.1
-
8jpp.3.el5 jakarta
-
commons
-
pool.s390x
0:1.3
-
5jpp.1 java
-
1.4.2
-
gcj
-
compat
-
devel.s390x 0:1.4.2.0
-
40jpp.115 kernel
-
headers.s39
0x 0:2.6.18
-
92.el5 ldapjdk.s390x 0:4.18
-
2jpp.3.el5 libgcj
-
devel.s390x
0:4.1.2
-
42.el5 libgomp.s390x 0:4.1.2
-
42.el5 log4j.s390x 0:1.2.13
-
3jpp.2 mx4j.s390x
1:3.0.1
-
6jpp.4 regexp.s390x 0:1.4
-
2jpp.2 tomcat5
-
common
-
lib.s390x 0:5.5.23
-
0jpp.7.el5 tomcat5
-
jasper.s3
90x 0:5.5.23
-
0jpp.7.el5 tomcat5
-
jsp
-
2.0
-
api.s390x
0:5.5.23
-
0jpp.7.el5 tomcat5
-
server
-
lib.s390x 0:5.5.23
-
0jpp.7.el5 tomcat5
-
servlet
-
2.4
-
api.s390x 0:5.5.23
-
0jpp.7.el5 wsdl4j.s390x 0:1.5.2
-
4jpp.1 xalan
-
j2.s390x
0:2.7.0
-
6jpp.1 xerces
-
j2.s390x 0:2.7.1
-
7jpp.2 xm
l
-
commons.s390x 0:1.3.02
-
0.b2.7jpp.10 xml
-
commons
-
apis.s390x 0:1.3.02
-
0.b2.7jpp.10 xml
-
commons
-
resolver.s390x 0:1.1
-
1jpp.12 zlib
-
devel.s390x 0:1.2.3
-
3

Complete!




© IBM Copyright, 200
9


16
-
04
-
2009

Web location of document (
www.ibm.com/support/techdocs
)

Page
14

of
23

Building a Tomcat/Apache solution for Linux on I
BM System z

3.3.2

JVM installation (optional)


We will now install a supported JVM runtime environment (JRE),
that is an IBM

JRE,
but you can keep th
e JVM of the distribution (gcj)
.
The version we plan to use for this
environment is Java 1.5, in order to take advantage of the latest developments for java while
still having the stability of the platform. You can fi
nd a number of downloads at this location
(
http://www.ibm.com/developerworks/java/jdk/linux/download.html
), including JVM for
Linux on System z.


To install the downloaded JVM,

you can directly use the rpm command, and change
the
link in /usr/lib/jvm/java t
o
make it point to

the
IBM
JRE directory to it:


[root@
lnxrh1

~]# rpm
-
Uvh ibm
-
java2
-
s390x
-
jre
-
5.0
-
9.0.s390x.rpm

Preparing... ##################################
######### [100%]


1:ibm
-
java2
-
s390x
-
jre ########################################### [100%]

[root@lnxrh1 ~]# cd /usr/lib/jvm

[root@lnxrh1
jvm
]# rm java

rm: remove symbolic link `java'? y

[root@lnxrh1 jvm]# ln
-
s /opt/ibm/java2
-
s390x
-
50/jre java

[root@
l
nxrh1

bin]# java
-
version

java version "1.5.0"

Java(TM) 2 Runtime Environment, Standard Edition (build pxz64dev
-
20081129 (SR9
-
0 ))

IBM J9 VM (build 2.3, J2RE 1.5.0 IBM J9 2.3 Linux s390x
-
64 j9vmxz6423
-
20081129 (JIT
enabled)

J9VM
-

20081126_26240_BHdSMr

JIT

-

20081112_1511ifx1_r8

GC
-

200811_07)

JCL
-

20081129


You can check that the right JVM is used
by

issu
ing

the command “
java
-
version
”.


3.3.3

Web applications installation


Next step is to install the web

app
lication
s that Tomcat will serve. “
tomcat5
-
webap
ps.s390x
” and “
tomcat5
-
admin
-
webapps.s390x


contain standard web applications that
can be used for demonstration:


[root@
lnxrh1

~]# yum install tomcat5
-
webapps.s390x

Loading "security" plugin

Loading "rhnplugin" plugin

This system is not registered with RH
N.

RHN support will be disabled.

Setting up Install Process

Parsing package install arguments

Resolving Dependencies

--
> Running transaction check

---
> Package tomcat5
-
webapps.s390x 0:5.5.23
-
0jpp.7.el5 set to be updated

--
> Processing Dependency: jakarta
-
t
aglibs
-
standard >= 1.1.0 for package: tomcat5
-
webapps

--
> Running transaction check

---
> Package jakarta
-
taglibs
-
standard.s390x 0:1.1.1
-
7jpp.1 set to be updated

--
> Finished Dependency Resolution


Dependencies Resolved


====================================
=========================================


Package Arch Version Repository Size

=============================================================================

Installing:


tomcat5
-
webapps s390x 5.5.23
-
0jpp.
7.el5 rhel5 1.2 M

Installing for dependencies:


jakarta
-
taglibs
-
standard s390x 1.1.1
-
7jpp.1 rhel5 811 k


© IBM Copyright, 200
9


16
-
04
-
2009

Web location of document (
www.ibm.com/support/techdocs
)

Page
15

of
23

Building a Tomcat/Apache solution for Linux on I
BM System z

Transaction Summary

=============================================================================

Install 2 Pac
kage(s)

Update 0 Package(s)

Remove 0 Package(s)


Total download size: 2.0 M

Is this ok [y/N]: y

Downloading Packages:

(1/2): tomcat5
-
webapps
-
5. 100% |=========================| 1.2 MB 00:04

(2/2): jakarta
-
taglibs
-
st 100% |===================
======| 811 kB 00:07

Running rpm_check_debug

Running Transaction Test

Finished Transaction Test

Transaction Test Succeeded

Running Transaction


Installing: jakarta
-
taglibs
-
standard ######################### [1/2]


Installing: tomcat5
-
webapps

######################### [2/2]


Installed: tomcat5
-
webapps.s390x 0:5.5.23
-
0jpp.7.el5

Dependency Installed: jakarta
-
taglibs
-
standard.s390x 0:1.1.1
-
7jpp.1

Complete!

[root@
lnxrh1

~]# yum install tomcat5
-
admin
-
webapps.s390x

Loading "security" plugin

L
oading "rhnplugin" plugin

This system is not registered with RHN.

RHN support will be disabled.

Setting up Install Process

Parsing package install arguments

Resolving Dependencies

--
> Running transaction check

---
> Package tomcat5
-
admin
-
webapps.s390x 0:5.5
.23
-
0jpp.7.el5 set to be updated

--
> Processing Dependency: struts >= 1.1 for package: tomcat5
-
admin
-
webapps

--
> Running transaction check

---
> Package struts.s390x 0:1.2.9
-
4jpp.5 set to be updated

--
> Processing Dependency: oro for package: struts

--
> Pro
cessing Dependency: jakarta
-
commons
-
validator for package: struts

--
> Running transaction check

---
> Package jakarta
-
oro.s390x 0:2.0.8
-
3jpp.1 set to be updated

---
> Package jakarta
-
commons
-
validator.s390x 0:1.1.4
-
5jpp.1 set to be updated

--
> Finished Depen
dency Resolution


Dependencies Resolved


=============================================================================


Package Arch Version Repository Size

=============================================================
================

Installing:


tomcat5
-
admin
-
webapps s390x 5.5.23
-
0jpp.7.el5 rhel5 1.3 M

Installing for dependencies:


jakarta
-
commons
-
validator s390x 1.1.4
-
5jpp.1 rhel5 176 k


jakarta
-
oro s390x 2.0
.8
-
3jpp.1 rhel5 205 k


struts s390x 1.2.9
-
4jpp.5 rhel5 1.2 M


Transaction Summary

=============================================================================

Install 4 Package(s)

Update 0 P
ackage(s)

Remove 0 Package(s)


Total download size: 2.9 M

Is this ok [y/N]: y

Downloading Packages:

(1/4): jakarta
-
oro
-
2.0.8
-

100% |=========================| 205 kB 00:01

(2/4): struts
-
1.2.9
-
4jpp. 100% |=========================| 1.2 MB 00:06

(3/4): jakarta
-
commons
-
va 100% |=========================| 176 kB 00:01

(4/4): tomcat5
-
admin
-
weba 100% |=========================| 1.3 MB 00:08

Running rpm_check_debug

Running Transaction Test

Finished Transaction Test

Transaction Test Succeeded

Runn
ing Transaction


Installing: jakarta
-
oro ######################### [1/4]


Installing: jakarta
-
commons
-
validator ######################### [2/4]


Installing: struts ######################### [3/4]


Installing: t
omcat5
-
admin
-
webapps ######################### [4/4]


© IBM Copyright, 200
9


16
-
04
-
2009

Web location of document (
www.ibm.com/support/techdocs
)

Page
16

of
23

Building a Tomcat/Apache solution for Linux on I
BM System z

Installed: tomcat5
-
admin
-
webapps.s390x 0:5.5.23
-
0jpp.7.el5

Dependency Installed: jakarta
-
commons
-
validator.s390x 0:1.1.4
-
5jpp.1 jakarta
-
oro.s390x 0:2.0.8
-
3jpp.1 struts.s390x 0:1.2.9
-
4jpp.5

Comple
te!


After that, you can test the validity of the setup by starting the Tomcat server:


[root@
lnxrh1

~]# service tomcat5 start

Starting tomcat5: [ OK ]


On your browser, you can connect to the Linux machine on por
t 8080 (default Tomcat
port):




3.4

mod_jk setup


In this section we will describe the way to setup the connector between Apache and
Tomcat, known as mod_jk.

Mod_jk is a module loaded by Apache that handles the
communication between Apache and Tomcat:
it for
wards the requests to Tomcat
based on
URL format of the HTTP
transaction.

Mod_jk is able to be configured to support virtual
hosts, which will be useful in our infrastructure because we will have 2 Tomcat
servers
connected to Apache: forwarding rules will
be based on the different virtual hosts defined.


First step to do is to install the package “
httpd
-
devel.s390x
” to be able to use the tool
APXS, needed to build module for Apache.


[root@
lnxrh1

~
]# yum install httpd
-
devel.s390x

© IBM Copyright, 200
9


16
-
04
-
2009

Web location of document (
www.ibm.com/support/techdocs
)

Page
17

of
23

Building a Tomcat/Apache solution for Linux on I
BM System z


Second

step

to do

is to re
trieve the source code of the connector, because it is not
available in the distribution. You can find all the source files at this location
(
http://apache.mirror.faceboo
k.com/tomcat/tomcat
-
connectors/jk/source/
), get the latest
version,
unpack it on the Linux machine
, and run the installation procedure
:


[root@
lnxrh1

~]# tar
-
xvzf tomcat
-
connectors
-
1.2.27
-
src.tar.gz

[root@
lnxrh1

~]# cd tomcat
-
connectors
-
1.2.27
-
src/native
/

[root@
lnxrh1

~]#

./configure
--
with
-
apxs=/usr/sbin/apxs

[root@
lnxrh1

~]# make

[root@
lnxrh1

~]#

make install


At the end of the process, you should see a message saying:


See any operating system documentation about shared libraries for

more information,
such as the ld(1) and ld.so(8) manual pages.

----------------------------------------------------------------------

chmod 755 /usr/lib64/httpd/modules/mod_jk.so


Please be sure to arrange /etc/httpd/conf/httpd.conf...


3.5

The second Linux machine


For our inf
rastructure, we will require a second Linux machine running Tomcat that
will serve other web applications. Assuming the second machine is installed, you can refer to
chapter

Tomcat setup
” in order to install an

other instance of Tomcat on the second Linux

guest.


© IBM Copyright, 200
9


16
-
04
-
2009

Web location of document (
www.ibm.com/support/techdocs
)

Page
18

of
23

Building a Tomcat/Apache solution for Linux on I
BM System z

4

Apache and Tomcat configuration


4.1

Tomcat configuration


The first step of the configuration is to define which applications must be served in
each Tomcat servers.

In our architecture, we have chosen to have the webapp named

servlets
-
examples
” and

the Tomcat manager on the first node (called “
lnxrh1
”, which is also
hosting the Apache server), the application “
jsp
-
examples
” will be served by the second node
(called “
lnxrh2
”).


All configuration files for Tomcat are located in “
/etc/tomcat5

. The co
nfiguration for
the application server itself is stored in the file “
/etc/tomcat5/server.xml
”, which will be
customized to meet our needs.


4.1.1

First Linux configuration

(
lnxrh1
)


On the first Linux guest
lnxrh1
, we must add the contexts for the two applicatio
ns that
will be served by Tomcat, which are “
servlets
-
examples
” and “
manager
”. In the file

/etc/tomcat5/server.xml
”, the section <Host> describes how the server will answer to
requests. You may want to disable the

autodeploy
” and

deployOnStartup

parame
ter
s

and
set
them

to false, in order to avoid the automatic deployment of all applications located in the
webapps
directory.


Inside the <Host>
section
is where you add the Context for each application to run in
the Tomcat server: the context describes whe
re the application is located on the file system
and the URL path to access the application. Here we will add the two contexts for the web
applications to deploy:


<Host name="localhost" appBase="webapps"


unpackWARs="true" autoDeploy="
fals
e
"

deployO
nStartup="false"


xmlValidation="false" xmlNamespaceAware="false">




<Context path="/manager" debug="0" privileged="true"


docBase="/usr/share/tomcat5/server/webapps/manager">


</Context>




<Context path="/
servlets
-
examples
" deb
ug="0" privileged="true"


docBase="/usr/share/tomcat5/
webapps/servlets
-
examples
">


</Context>


</Host>


The “
manager
” application requires some security considerations, concerning the
authorized users to connect. In the file “
/etc/tomcat5/tom
cat
-
users.xml
”, you can either add a
user with the
manager

authority, or modify an existing user to add it the
manager

authority.

Here we have chosen the first solution:


<?xml version='1.0' encoding='utf
-
8'?>

<tomcat
-
users>


<role rolename="role1"/>


<r
ole rolename="tomcat"/>

© IBM Copyright, 200
9


16
-
04
-
2009

Web location of document (
www.ibm.com/support/techdocs
)

Page
19

of
23

Building a Tomcat/Apache solution for Linux on I
BM System z


<user username="role1" password="tomcat" roles="role1"/>


<user username="both" password="tomcat" roles="tomcat,role1"/>


<user username="tomcat" password="tomcat" roles="tomcat"/>


<role rolename="manager"/>


<user username="
tomcatmanager" password="admin" roles="manager"/>

</tomcat
-
users>


Note that you need to have the “
audeploy
” parameter set to true if you want to
dynamically deploy application with the Manager application.
After restarting the Tomcat
server, you should ge
t the following screen when connecting to the “
manager
” application:



4.1.2

Second Linux configuration (
lnxrh2
)


On the second node, we will deploy the application “
jsp
-
examples

. In the file

/etc/tomcat5/server.xml
”, we must add the context for this applicat
ion:


<Host name="localhost" appBase="webapps"


unpackWARs="true" autoDeploy="
fals
e"

deployOnStartup="false"


xmlValidation="false" xmlNamespaceAware="false">




<Context path="/
jsp
-
examples
" debug="0" privileged="true"


docBase="
/usr/share/tomcat5/
webapps/
jsp
-
examples
">


</Context>


</Host>



4.2

mod_jk configuration


© IBM Copyright, 200
9


16
-
04
-
2009

Web location of document (
www.ibm.com/support/techdocs
)

Page
20

of
23

Building a Tomcat/Apache solution for Linux on I
BM System z

The first step of the configuration is to
make

the mod_jk module

available in Apache

on the first host
, and do

basic configuration
.

The Apache file configuration is l
ocated in

/etc/httpd/conf/httpd.conf
”. Edit this file and append the mod_jk configuration statements:


#

# Mod_jk settings

#

# Load mod_jk module

LoadModule jk_module /usr/lib64/httpd/modules/mod_jk.so

# Where to find workers.properties

JkWorkersFile /etc
/httpd/conf/workers.properties

# Where to put jk logs

JkLogFile /caamt/logs/mod_jk.log

# Set the jk log level [debug/error/info]

JkLogLevel info

# Select the log format

JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "

# JkOptions indicate to send SSL KEY SIZE,

#

JkOptions +ForwardKeySize +ForwardURICompat
-
ForwardDirectories

# JkRequestLogFormat set the request format

JkRequestLogFormat "%w %V %T"


The mod_jk module should be located in “
/usr/lib64/httpd/modules/mod_jk.so

, as
seen in the message obtained after i
ts compilation
. We need now to define the workers for the
mod_jk, which are the Tomcat servers that will serve the web applications. In our
configuration, we have defined two Tomcat servers on two nodes. Here is the

/etc/httpd/conf/workers.properties
” fil
e corresponding to our infrastructure:


workers.tomcat_home=/usr/share/tomcat5

workers.java_home=${JAVA_HOME}

ps=/

worker.list=lnxrh1, lnxrh2


worker.lnxrh1.port=8009

worker.lnxrh1.host=lnxrh1

worker.lnxrh1.type=ajp13

worker.lnxrh1.lbfactor=1


worker.lnxrh
2.port=8009

worker.lnxrh2.host=lnxrh2

worker.lnxrh2.type=ajp13

worker.lnxrh2.lbfactor=1


In this file, you will describe the APJ13 connectors defined in each Tomcat servers.
On the node
lnxrh1
, the connector is accessible on port 8009 (default configuratio
n), as for
the node
lnxrh2
. Here we have named the workers based on the hostnames of the Linux
machines.

Don’t forget to modify your “
/etc/hosts
” file in order to link

the hostnames with IP
addresses, or

your Apache server won’t start
!


4.3

Apache configuratio
n


We need now to configure the Apache server on the first Linux node. The main point

is to define the redirections to the Tomcat servers. In our environment, we want to access all
the applications through the URL with a prefix of the form
“http://linux/”
.

This implies the
definition of a virtual host in Apache, and redirections through this virtual host. In

/etc/httpd/conf/httpd.conf
”, here is the definition of our virtual host:


<VirtualHost linux>


ServerName linux


DocumentRoot /var/www/html

© IBM Copyright, 200
9


16
-
04
-
2009

Web location of document (
www.ibm.com/support/techdocs
)

Page
21

of
23

Building a Tomcat/Apache solution for Linux on I
BM System z


JkMount /servlets
-
examples/* lnxrh1


JkMount /manager/* lnxrh1


JkMount /jsp
-
examples/* lnxrh2

</VirtualHost>


Redirections are made with the directive JkMount, based on matching URL. With the
above configuration, every request having the form “
http:
//linux/jsp
-
examples/*
” will be then
redirected to the node lnxrh2.


Note that your client will need to know the hostname “
linux
” pointing to the first
Linux node lnxrh1.


After restarting the httpd server,
you should now be able to connect to the web
app
lications “
jsp
-
examples
”, “
servlets
-
examples
” and “
manager
” through the URL

http:/linux
”:




© IBM Copyright, 200
9


16
-
04
-
2009

Web location of document (
www.ibm.com/support/techdocs
)

Page
22

of
23

Building a Tomcat/Apache solution for Linux on I
BM System z



The setup of our infrastructure is now complete.


© IBM Copyright, 200
9


16
-
04
-
2009

Web location of document (
www.ibm.com/support/techdocs
)

Page
23

of
23

Building a Tomcat/Apache solution for Linux on I
BM System z

5

References



[1]:

z/VM and Linux on IBM System z

The Virtualization Cookbook for Red Hat Enterprise Linux
5.2, SG24
-
7492
-
00