LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 08-14-2009, 09:07 AM   #1
mikelawford
LQ Newbie
 
Registered: Jun 2007
Posts: 7

Rep: Reputation: 0
Tomcat 6 / apache 2.2.3 / mod_jk help


Hi Giys - Ive been trying to implement modjk with tomcat 6 and aapache 2.2.3 and it seems like ive followed everything correctly but cannot seem to get it working. Can you spot my error?

I have done the following:
1. downloaded and compiled the mod_jk.so file from source and places in /usr/lib/httpd/modules/mod_jk.so
2. included this in the httpd.conf file and set my workers.properties file as follows:
Include /opt/tomcat/conf/auto/mod_jk.conf

# Where to find workers.properties
JkWorkersFile /etc/httpd/conf/workers.properties

# Where to put jk logs
JkLogFile /var/log/httpd/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"
3. wrokers.properties is as follows:
workers.tomcat_home=/opt/tomcat
workers.java_home=/usr/java/jdk1.6.0_14/
worker.list=ajp13
ps=/

worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13

4. I included the following in the virtual host tag of httpd.conf
<VirtualHost ip address here:80>
ServerName gnsol.net
ServerAlias www.gnsol.net
ServerAlias webmail.gnsol.net
ServerAlias admin.gnsol.net
<IfModule mod_jk.c>
# The followingV line makes apache aware of the location of
# the /examples context
Alias /gnsol "/opt/tomcat/webapps/gnsol"
<Directory "/opt/tomcat/webapps/gnsol">
Options Indexes FollowSymLinks
Allow from All
</Directory>

# Mounted stuff goes via tomcat (ajp13)
JkMount /gnsol/* ajp13
# You can explicitly unmount part of the mounted tree
# Unmounted stuff goes via apache.
# Serve html, jpg and gif using httpd
JkUnMount /gnsol/*.html ajp13
JkUnMount /gnsol/*.jpg ajp13
JkUnMount /gnsol/*.gif ajp13

# The following line prohibits users from directly accessing WEB-INF
<Location "/gnsol/WEB-INF/">
AllowOverride None
Deny from All
</Location>
</IfModule>
#JkMount /gnsol ajp13
#JkMount /gnsol/* ajp13
#DocumentRoot /home/gnsol/public_html
#ErrorLog /var/log/virtualmin/gnsol.net_error_log
#CustomLog /var/log/virtualmin/gnsol.net_access_log combined
#ScriptAlias /cgi-bin/ /home/gnsol/cgi-bin/
#DirectoryIndex index.html index.htm index.php index.php4 index.php5
#<Directory /home/gnsol/public_html>
#Options -Indexes IncludesNOEXEC FollowSymLinks
#allow from all
#AllowOverride All
#</Directory>
#<Directory /home/gnsol/cgi-bin>
#allow from all
#</Directory>
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.gnsol.net
RewriteRule ^(.*) http://gnsol.net:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.gnsol.net
RewriteRule ^(.*) http://gnsol.net:10000/ [R]
</VirtualHost>

5. We are also trying to get the jsp examples going by entering
# Send servlet for context / examples to worker named worker1
JkMount /examples ajp13
# Send JSPs for context /examples/* to worker named worker1
JkMount /examples/* ajp13
Which didnt work either.

6. I have feeling it maay be something with the server.xml file we are using. The server.xml does have thee following 2 lines in it though:
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

we also added this:
<Listener className="org.apache.jk.config.ApacheConfig" modJk="/usr/lib/httpd/modules/mod_jk.so"/>


Yet still nothing runs.
Were is the error?
 
Old 08-15-2009, 11:24 AM   #2
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
First, when you post configuration examples here, please put them in code tags. They're difficult to read when they are all blended together with the rest of your post.

Start by looking through httpd's error log and Tomcat's catalina.out. There are likely some good clues there.
 
Old 08-17-2009, 07:55 AM   #3
mikelawford
LQ Newbie
 
Registered: Jun 2007
Posts: 7

Original Poster
Rep: Reputation: 0
Sorry about the no code tags.... ;-)

Firstly I looked at /var/log/httpd/error_log and see the following:

<code>
[Sun Aug 16 04:02:07 2009] [warn] No JkShmFile defined in httpd.conf. Using default /etc/httpd/logs/jk-runtime-status
[Sun Aug 16 04:02:07 2009] [notice] mod_python: Creating 4 session mutexes based on 256 max processes and 0 max threads.
[Sun Aug 16 04:02:07 2009] [notice] Apache/2.2.3 (Red Hat) configured -- resuming normal operations
</code>

This is odd - JK seems to be creating multiple runtime files (e.g. jk-runtime-status.22638) in the /var/log/httpd directory - but these contain no data.

Although I dont think this has anything to do with the problem. So I looked in mod_jk.log and can see:

<code>
[Sun Aug 16 04:02:07 2009] [15963:3086612240] [warn] map_uri_to_worker_ext::jk_uri_worker_map.c (962): Uri * is invalid. Uri must start with /
[Sun Aug 16 04:02:07 2009] [24325:3086612240] [error] init_jk::mod_jk.c (3166): Initializing shm:/etc/httpd/logs/jk-runtime-status.24325 errno=13. Load balancing workers will not function properly.
[Sun Aug 16 04:02:07 2009] [24325:3086612240] [info] init_jk::mod_jk.c (3183): mod_jk/1.2.28 initialized
</code>

Where must the Uri start with a '/' though?

Then I looked at catalina.out and can see a line stating:
<code>
WARNING: Can't find workers.properties at /opt/tomcat/conf/jk/workers.properties
</code>

But my workers.properties file is in /etc/httpd/conf/workers.properties - is this what I am doing wrong?
 
Old 08-17-2009, 08:03 AM   #4
mikelawford
LQ Newbie
 
Registered: Jun 2007
Posts: 7

Original Poster
Rep: Reputation: 0
I copied workers.properties to the /opt/tomcat/conf/jk/workers.properties and restarted Tomcat - looking better but then I tried to restart Apache and get:

Starting httpd: Syntax error on line 1356 of /etc/httpd/conf/httpd.conf:
JkWorkersFile only allowed once

I changed this to reflect the /opt/tomcat/conf/jk/workers.properties path but it still fails to start. I am hesitant to remove the old workers.properties entries from /etc/httpd/conf as these were auto created.

Where am I going wrong?
 
Old 08-17-2009, 07:03 PM   #5
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
Quote:
Originally Posted by mikelawford
I copied workers.properties to the /opt/tomcat/conf/jk/workers.properties and restarted Tomcat
Ok. Or you could have configured the directive to point to the path you had it in.

Quote:
Originally Posted by mikelawford
Starting httpd: Syntax error on line 1356 of /etc/httpd/conf/httpd.conf:
JkWorkersFile only allowed once
httpd is telling you that you have a directive specified twice. Run the command:
Code:
# grep -ni 'jkworkersfile' httpd.conf
That will give you the line numbers for both directives. Remove one of them...
 
Old 08-18-2009, 05:22 AM   #6
mikelawford
LQ Newbie
 
Registered: Jun 2007
Posts: 7

Original Poster
Rep: Reputation: 0
Thanks for your help but I havent specified it twice:

[root@onduline conf]# grep -ni 'jkworkersfile' httpd.conf
1356:JkWorkersFile /opt/tomcat/conf/jk/workers.properties

But when I try and restart with the JKworkersfile uncommented it fails on the restart:

Starting httpd: Syntax error on line 1356 of /etc/httpd/conf/httpd.conf:
JkWorkersFile only allowed once
[FAILED]

Any suggestions? There is def no repetition of teh jkworkers directive in httpd.conf....
 
Old 08-18-2009, 05:39 AM   #7
mikelawford
LQ Newbie
 
Registered: Jun 2007
Posts: 7

Original Poster
Rep: Reputation: 0
re:

OK in Apache there is the following:

Code:
Include /opt/tomcat/conf/auto/mod_jk.conf
JkWorkersFile /opt/tomcat/conf/jk/workers.properties
The mod_jk.conf is auto generated and includes its own jkworkers file directive:
Code:
JkWorkersFile "/opt/tomcat/conf/jk/workers.properties"
Do we have to have to have a jkworkers directive in httpd.conf - I understand we do but as soon as I put that in it gives me this multiple directive junk...

So where to from here?
 
Old 08-18-2009, 11:29 AM   #8
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
Quote:
Originally Posted by mikelawford
Code:
Include /opt/tomcat/conf/auto/mod_jk.conf
JkWorkersFile /opt/tomcat/conf/jk/workers.properties
.......

Do we have to have to have a jkworkers directive in httpd.conf - I understand we do but as soon as I put that in it gives me this multiple directive junk...
Nope -- you're OK. The directive is there in mod_jk.conf, apparently. And you're including that config into your httpd.conf already.
 
Old 08-19-2009, 07:32 AM   #9
mikelawford
LQ Newbie
 
Registered: Jun 2007
Posts: 7

Original Poster
Rep: Reputation: 0
But if I comment out the line:

# JkWorkersFile /opt/tomcat/conf/jk/workers.properties

And restart Apache it starts fine - but no mod_jk is loaded. I think that httpd.conf has to have the include to mod_jk.conf
as well as the path to workers.properties doesnt it?

So im back at square 1? Any further suggestions?
 
Old 08-19-2009, 10:57 AM   #10
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
I must be misunderstanding something. When you include mod_jk.conf, it is providing a JkWorkersFile directive, right? (Otherwise you wouldn't be receiving the error message about duplicate directives.)

How are you determining that mod_jk isn't being loaded?
 
Old 08-20-2009, 04:52 AM   #11
mikelawford
LQ Newbie
 
Registered: Jun 2007
Posts: 7

Original Poster
Rep: Reputation: 0
Well http://IPADDRESS/examples is not routing to the examples folder! So its not working...
 
Old 08-20-2009, 03:05 PM   #12
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
Check the same logs we discussed again please.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache/Tomcat/Mod_JK chantman Linux - Software 1 04-05-2006 04:32 AM
Apache Tomcat mod_jk connector dashp Linux - Newbie 1 04-01-2005 01:34 PM
Apache Tomcat mod_jk connector dashp Linux - Newbie 0 03-24-2005 07:12 PM
connecting Apache 1.3.x and Tomcat 5.5: mod_jk [GOD]Anck Slackware 0 03-22-2005 09:27 AM
Apache, Tomcat problem with mod_jk WaveyDave Linux - Software 0 09-20-2001 08:28 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 07:32 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration