Installing Tomcat 5.5.9 for Apache 1 & 2

Is the above apache 2/1 with Tomcat 5.5.9 configuration usefull..?

  • No

    Votes: 0 0.0%
  • Somthing is Missing

    Votes: 1 33.3%
  • Usefull

    Votes: 0 0.0%
  • Very much

    Votes: 2 66.7%

  • Total voters
    3
  • Poll closed .

murali

New member
Joined
Jun 25, 2004
Messages
3
The following can be used to get jsp pages to be accessed with apache .
Tomcat 5.5.9 has jsp 2 and Servlet 2.4


Installing Tomcat 5.5.9 for Apache 1 & 2 Tested with RHEL3, CentOS 3.5 and CentOS 4.0 For Apache 2


1. vi /etc/profile

export JAVA_HOME='/usr/local/java'
export CATALINA_HOME='/usr/local/tomcat'
export TOMCAT_HOME='/usr/local/tomcat'
source /etc/profile

2. cd /usr/local

Download jdk-1_5_0_04-linux-i586.bin from http://java.sun.com/j2se/1.5.0/download.jsp

chmod 755 jdk-1_5_0_04-linux-i586.bin

./jdk-1_5_0_04-linux-i586.bin

ln -s jdk1.5.0_04 java

/usr/local/java is JAVA_HOME

3. Download jakarta-tomcat-5.5.9.tar.gz from http://archive.apache.org/dist/jakarta/tomcat-5/v5.5.9/bin/jakarta-tomcat-5.5.9.tar.gz

tar zxvf jakarta-tomcat-5.5.9.tar.gz

ln -s jakarta-tomcat-5.5.9 tomcat

/usr/local/tomcat is TOMCAT_HOME and CATALINA_HOME

4. Download jakarta-tomcat-connectors from http://archive.apache.org/dist/jaka...a-tomcat-connectors-jk-1.2-src-current.tar.gz

tar zxvf jakarta-tomcat-connectors-jk-1.2-src-current.tar.gz

cd /usr/local/jakarta-tomcat-connectors-jk-1.2.6-src/jk/native/
- ./buildconf.sh
- ./configure --with-apxs=/usr/sbin/apxs
- make
- Depending on apache1 or 2
cp apache-1.3/mod_jk.so /etc/httpd/modules/
(or)
cp apache-2.0/mod_jk.so /etc/httpd/modules/


5. cp -p /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.bak

vi /etc/httpd/conf/httpd.conf

After this line :
LoadModule cgi_module modules/mod_cgi.so

Add :
LoadModule jk_module modules/mod_jk.so

Include "/usr/local/jakarta-tomcat-5.5.9/conf/mod_jk.conf"

6. vi /usr/local/jakarta-tomcat-5.5.9/conf/mod_jk.conf

Enter the following lines:

<IfModule !mod_jk.c>
LoadModule jk_module /usr/lib/httpd/modules/mod_jk.so
</IfModule>


JkWorkersFile "/usr/local/jakarta-tomcat-5.5.9/conf/jk/workers.properties"
JkLogFile "/usr/local/jakarta-tomcat-5.5.9/logs/mod_jk.log"

JkMount /*.jsp ajp13
JkMount /servlet/* ajp13
JkMount /servlets/* ajp13
JkMount /*.do ajp13
JkMount /manager/* ajp13

JkLogLevel emerg


7. mkdir /usr/local/jakarta-tomcat-5.5.9/conf/jk
- vi /usr/local/jakarta-tomcat-5.5.9/conf/jk/workers.properties

Enter the following lines :

# Setting Tomcat & Java Home
workers.tomcat_home=/usr/local/tomcat
workers.java_home=/usr/local/java/java
ps=/
worker.list=ajp13
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13

8. Edit /usr/local/jakarta-tomcat-5.5.9/conf/server.xml

Before the last three lines of original server.xml file

</Engine>
</Service>
</Server>

You can add virtual host entries

<Host name="mysite.com" debug="0"
appBase="/usr/local/tomcat/mysite.com" unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Alias>www.mysite.com</Alias>
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="mysite.com"
suffix=".log" timestamp="true"/>
<Context path="" docBase="" debug="0" allowLinking="true"/>
<Listener className="org.apache.catalina.startup.UserConfig"
directoryName="mysite.com"
userClass="org.apache.catalina.startup.PasswdUserDatabase"/>
</Host>

Note : You can use any path instead " /usr/local/tomcat/mysite.com "


9. Execute

/usr/local/tomcat/bin/startup.sh to start tomcat
and restart apache
/etc/init.d/httpd restart

That's it..

Make sure you have configured apache httpd.conf and server.xml for the same path of virtual host...

If you face any error in connector (step 4) try the following method :

Download the Java Connector from CVS and build / install mod_jk
- cvs -d :pserver:[email protected]:/home/cvspublic login password: anoncvs (When prompted for a password, just hit ENTER)
- cvs -d :pserver:[email protected]:/home/cvspublic checkout jakarta-tomcat-connectors
- mv jakarta-tomcat-connectors /usr/local/java/
- cd /usr/local/java/jakarta-tomcat-connectors/jk/native/
- ./buildconf.sh

- ./configure --with-apxs=/usr/sbin/apxs
- make
- cp apache-1.3/mod_jk.so /etc/httpd/modules/
(or)
- cp apache-2.0/mod_jk.so /etc/httpd/modules/
 
Last edited:
murali,

Would you please be so kind as to create a paragraph at the top of this How-To explaining just what it is for?

Thanks.

Jeff
 
Ok, tried this but the following issues...

From step 4 on you seem to have left out a lot of untarring and other commands.

I followed through and almost got everything working but when I restart Apache I get

Code:
Syntax error on line 6 of /usr/local/tomcat/conf/mod_jk.conf:
Invalid command 'JkWorkersFile', perhaps mis-spelled or defined by a module not included in the server configuration

What do you mean by...

Make sure you have configured apache httpd.conf and server.xml for the same path of virtual host...

Should tomcat not be included in the startup routines of the server so it restarts when the server is rebooted?

Please let me know...

Regards,
Onno
 
murali said:
Is that ok...?

I guess it's the tile that's confusing me.

What do you mean by "Apache 1/2 Tomcat 5.5.9"?

Do you mean "installing Tomcat 5.5.9 for Apache 1 & 2"?

If so, can we just call it that?

:)

Please respond to Onno's post; it's important that our How-Tos work :) :) .

Jeff
 
Yes.. It is "Installing Tomcat 5.5.9 for Apache 1 & 2"

I am altering Now...

Syntax error on line 6 of /usr/local/tomcat/conf/mod_jk.conf:
Invalid command 'JkWorkersFile', perhaps mis-spelled or defined by a module not included in the server configuration

The Reason for the above error might be the following ...

verify the file /usr/local/tomcat/conf/mod_jk.conf for the following . It should be in 2 lines and not in 4 lines.

JkWorkersFile "/usr/local/jakarta-tomcat-5.5.9/conf/jk/workers.properties"
JkLogFile "/usr/local/jakarta-tomcat-5.5.9/logs/mod_jk.log"


Please check and restart apache ...

The following is the error

Starting httpd: Syntax error on line 5 of /usr/local/jakarta-tomcat-5.5.9/conf/mod_jk.conf:
JkWorkersFile takes one argument, the name of a worker file for the Jakarta servlet containers

with the following in /usr/local/jakarta-tomcat-5.5.9/conf/mod_jk.conf

JkWorkersFile
"/usr/local/jakarta-tomcat-5.5.9/conf/jk/workers.properties"
JkLogFile
"/usr/local/jakarta-tomcat-5.5.9/logs/mod_jk.log"



" Make sure you have configured apache httpd.conf and server.xml for the same path of virtual host... "

I mean the DocumentRoot ...

"Should tomcat not be included in the startup routines of the server so it restarts when the server is rebooted? "

NP
 
Last edited:
I tried using the other Howto on the forums for installing J2SE 1.4.2 and Tomcat 4, but tried replacing with JDK 5 and Tomcat 5 with no success... then, after reading your howto, and adjusting things as needed, everything worked swell. So thanks!

Only question left is... what would cause /manager not to work? ;)

Thanks,
Marc
 
Nevermind, seems to be fine as-is... just have to connect to:

http://[ip address]/manager/

or for the actual interface:

http://[ip address]/manager/html

If you want to add it to each individual host, just add the following <Context> after the other <Context> line listed in each <Host> tag in the server.xml file.

<Context path="/manager" docBase="/usr/local/jakarta-tomcat-5.5.9/server/webapps/manager" debug="0" privileged="true" />

Then restart tomcat.

Good stuff.
 
these instructions worked like a charm!!


I have been trying to get this to work for a couple of days now, and then saw these instructions.. deleted everything i had, and decided to start from scratch... worked like a charm!

:)


kunal
 
How do I test this?

Went through your excellent notes with some revisions for Ubuntu's distribution. Most important, it's necessary to install the apache-dev package so apxs is there.

Everything seems to come up fine, but is there a test I can run to see something happen before I tackle installing a servlet?
 
I am also getting the same error:

directadmin1:/tmp# /etc/init.d/httpd start
Starting httpd: Syntax error on line 5 of /usr/local/apache-tomcat-5.5.15/conf/mod_jk.conf:
Invalid command 'JkWorkersFile', perhaps mis-spelled or defined by a module not included in the server configuration


Any ideas how to fix this?

Thanks
 
I know this is an old bump,. but I tried to follow the instructions and sorrry,. I hit a wall on the few first d/l steps.


http://java.sun.com/j2se/1.5.0/download.jsp


2. cd /usr/local

Download jdk-1_5_0_04-linux-i586.bin from http://java.sun.com/j2se/1.5.0/download.jsp

I can't seem to find that bin file.

Perhaps the page was modified,. perhaps the version was changed,. either way there are many options on that page,. none that I'm certain are the correct ones.

Can you point me in the direction of the current d/l version that I would need?

Thanks,

-Alon.
 
I'm running Centos 4.3 and grabbed the latest jre from Sun.
The latest Tomcat from Apache.
The latest connector from Apache.
Everything seems to be working, except that I must type
http://domainname:8080/test.jsp

I cannot type

http://domainname/test.jsp

Does this mean my mod_jk connector isn't working?
How do I debug?
What logs do I look at?
What should I look at to confirm is configged properly?

Thanks for your efforts!
Any help or suggestions would be appreciated!

Thanks.
Hao.
 
This is a generic howto, not rpm/distribution specific so should work without problems.
The ideal scenario is to test it first on a vmware instance to be familiar with Tomcat and then install it on the production server.

Cheers
 
Hi there,

I'm getting the following errors when starting apache :

Syntax error on line 6 of /usr/local/tomcat/conf/mod_jk.conf:
Invalid command 'JkWorkersFile', perhaps mis-spelled or defined by a module not included in the server configuration

JkWorkersFile and JkLogFile are on 2 lines.

Any help ?

Thanks
 
Back
Top