Need a hand to set up Apache2 jk-mod2 to work with T omcat 5.0.28

Jim Skehill JimS-pFJmkVL1u50 at public.gmane.org
Fri Nov 5 18:10:28 UTC 2004


Hi Chris,
I'll tell you what worked for me - see if it helps. BTW, in case you don't
know mod_jk2 manages the communication between Apache and Tomcat. Also I'm
working on Windows. Things may be somewhat different on Linux but not a lot.

1) I placed mod_jk2.so in my Apache modules directory and mod_jk2.conf and
workers.properties in my Apache conf directory
In httpd.conf I added the lines
	LoadModule jk2_module modules/mod_jk2.so
		...
	# Enable the JKconnector between Apache and Tomcat
	include "C:\Apache2\conf\mod_jk2.conf"

The LoadModule line could also be placed in the mod_jk2.conf file.

2) In mod_jk2.conf  I have lines that point to the workers.properties file
and map context roots to particular Tomcat directories
e.g. the line:
	Alias /XYZ "C:\jakarta-tomcat-3.3a\webapps\XYZ" 
tells Apache that if it receives an URL that begins with XYZ it should send
it to the XYZ application in Tomcat.
Heres what the file looks like:

#Load mod_jk2 module
#LoadModule jk2_module modules/mod_jk2.so

<IfModule mod_jk2.c>
JkSet config.file "C:\Apache2\conf\workers2.properties"
####### Mappings for /XYZ directory ######################################
# Static files in the XYZ webapp are served by apache 
Alias /XYZ "C:\jakarta-tomcat-3.3a\webapps\XYZ" 

<Directory "C:\jakarta-tomcat-3.3a\webapps\XYZ">
   Options Indexes FollowSymLinks
</Directory>

# The following line prohibits users from directly access WEB-INF
<Location /XYZ/WEB-INF/ > 
   AllowOverride None 
   deny from all 
</Location> 
############################################################################
######

</IfModule>

I'm not proud of having absolute paths in my config files. In Linux you
could use symbolic links. Such things don't exist in WIndows. Actually, now
that I look at it the line
	JkSet config.file "C:\Apache2\conf\workers2.properties"
could probably be saferly changed to 
	JkSet config.file "workers2.properties"

Also workers.properties is actually a Tomcat conf file so it's a bit odd
placing it in the Apache conf directory. But that's what we decided to do.

Good Luck
Jim.

-----Original Message-----
From: Chris Gow [mailto:sniffy-bJEeYj9oJeDQT0dZR+AlfA at public.gmane.org]
Sent: Friday, November 05, 2004 12:37 PM
To: tlug-lxSQFCZeNF4 at public.gmane.org
Subject: Re: [TLUG]: Need a hand to set up Apache2 jk-mod2 to work with
Tomcat 5.0.28


On November 5, 2004 11:35 am, Frank Peng wrote:
> --- Chris Gow <sniffy-bJEeYj9oJeDQT0dZR+AlfA at public.gmane.org> wrote:
> > On November 5, 2004 10:31 am, Frank Peng wrote:
> > > I got a source for the connector but failed when I
> > > "ant". I am working on the binary jk-mod2 but it
> >
> > is
> >
> > > hard to set up workers2.properties and the
> >
> > server.xml
> >
> > > for Tomcat. I installed J2EE, but I do not know
> >
> > how to
> >
> > > use it to help this.
> >
> > What exactly failed? Do you have ant installed? If
> > not its available at
> > http://ant.apache.org. Its sort of like make, but
> > for Java.
>
> Yes, I have ant installed. The compiler is looking for
> ../somewhere/util directory. But this directory never
> show up in the Tomcat. I wonder if I should compile
> Tomcat to get an util directory or just put the
> jk-mod.so into Apache's ../modules directory.

Darn. Figured it wouldn't be that easy. Considering that what you really
want 
to do is write a web-app that accesses a postgress database, I'd say forego 
the apache/tomcat route and just access tomcat directly. Then after you have

your application up and running, do the apache/tomcat integration.

Tomcat by itself is fine for writing a test application.

-- chris
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list