I want to connect Apache and Tomcat.

The versions I have available to me are:

Apache 2.0.45
Tomcat 4.0.4

I have tried both mod_jk and mod_jk2 with no success. 

I have read several FAQs, HOW-TOs and other documents on the Web and
read countless messages about doing this.

In my server.xml, I am using Ajp13Connector, as I get a "ClassNotFound"
in catalina.out if I try and use the CoyoteConnector.

As I understand from what I have read, for mod_jk I would need to create
a worker.properties file and put this in my {Tomcat}/conf directory -
this is all it contains:
----workers.properties -----
workers.tomcat_home=/home/gmh2441/uPortal/Tomcat_4-0-4
workers.java_home=/pkgs2/j2se
ps=/
worker.list=ajp13
worker.ajp13.port=8089
worker.ajp13.host=poivre.ucs.louisiana.edu
worker.ajp13.type=ajp13
---workers.properties -----

Then I would have to make some modifications to the Apache httpd.conf
file, like so:

---from httpd.conf ---
  JkWorkersFile
/home/gmh2441/uPortal/Tomcat_4-0-4/conf/workers.properties
  JkLogFile /home/gmh2441/uPortal/Tomcat_4-0-4/logs/mod_jk.log
  JkLogLevel debug
  JkOptions +ForwardDirectories
  Alias /examples /home/gmh2441/uPortal/Tomcat_4-0-4/webapps/examples
  <Directory "/home/gmh2441/uPortal/Tomcat_4-0-4/webapps/examples">
        Options Indexes FollowSymLinks
  </Directory>          
  <Location "/examples/WEB-INF/">
    AllowOverride None
    deny from all
  </Location>  

  JkMount /examples/jsp/* ajp13
---from httpd.conf ----

I tried this, using mod_jk v. 1.2.3; if I browsed to
http://poivre.ucs.louisiana.edu/examples/jsp, I would get the index.html
that displays the list of examples, and I could view their source code.
However, if I clicked on the "Execute" link (any one), I would get the
source code for the .jsp that was supposed to be executed. I tried some
variations on the JkMount directive, but nothing would make the .jsp be
executed. I couldn't find anything on the Net about my particular
combination of Tomcat and Apache, but I did read that mod_jk2 was
supposed to be a complete re-write of mod_jk, so I thought I'd try that
one.

In looking around the Web for info for jk2, I found a document on
intergrating Apache 2.0.39, Tomcat 4.0.4, and mod_jk2; I followed this
to the letter the best I could. It agreed with another message I read
about how with Apache 2 it was possible to either embed your mod_jk2
configurationinto httpd.conf or use seperate files for it - the person
writing the document said that none of his mod_jk2 configuration was
embedded in his httpd.conf, so that he wouldn't need to reformat the
configs if he needed to change to another version of Tomcat. The only
modification to his httpd.conf file was the line

LoadModule jk2_module modules/mod_jk2.so

For mod_jk2, this jk2 configuration was done using 2 files,
jk2.properties and worker2.properties. 
jk2.properties goes in the {Tomcat}/conf directory, while
workers2.properties goes in {Apache}/conf. jk2.properties is supposed to
allow you to "override and set various values on the tomcat side of
mod_jk2" - here's what mine looked like:

---jk2.properties ---
#list of needed handlers
handler.list=apr,channelSocket,request

#Set the derault port for the channelSocket
channelSocket.port=8089

#Information about a UNIX domain socket - we don't have this.
Supposedly, the 
#UNIX domain socket is used for speed only
#if this is used, add "channelUnix" to the handler.list above
#channel.Unix.file=/home/gmh2441/uPortal/Tomcat_4-0-4/work/jk2.socket

#Dynamic library
serverRoot=/opt/apache

# This will enable the starting of the Tomcat from mod_jk2
apr.jniModeSo=/opt/apache/modules/mod_jk2.so

---jk2.properties ---

And here begin my questions.

- I cannot find a "jk2.socket" file anywhere - is this somewhere in the
Tomcat configs?

- notice the directory "/apache" - this is acutally a symbolic link (I'm
on a UNIX system) - the directory is actually called "httpd-2.0.45" -
I've tried using the different names for it, and it doesn't seem to
matter - or does it?

- as far as the UNIX domain socket and dynamic library go, the document
said that without the dynamic library section the UNIX domain socket
would fail, but a regular TCP/IP socket would still work. but UNIX
domain sockets were much, much faster. So does that mean I should
removed the part about the dynamic library if I'm using TCP/IP sockets?

Here is workers2.properties, found in {Apache}/conf

---workers2.properties ---
[shm]
file=/var/adm/httpd-shm.mod_jk2
size=1048576

# Example socket channel
[channel.socket:poivre.ucs.louisiana.edu:8089]
info=Ajp13 forwarding over socket
tomcatId=poivre.ucs.louisiana.edu:8089

#Needed for UNIX domain socket - but we don't have that
#[channel.un:/home/gmh2441/uPortal/Tomcat_4-0-4/work/jk2.socket]
#tomcatId=poivre.ucs.louisiana.edu:8089
#debug=0

# define the worker
[ajp13:poivre.ucs.louisiana.edu:8089]
#This uses the TCP/IP socket instead of the UNIX domain socket
channel=channel.socket:poivre.ucs.louisiana.edu:8089
#Uncomment the next line to use the UNIX domain socket
#channel=channel.un:/home/gmh2441/uPortal/Tomcat_4-0-4/work/jk2.socket

#Announce a "status" worker
[status:status]

# Map the Tomcat examples webapp to the Web server uri space
[uri:/examples/*]
info=Map the whole webapp

worker=ajp13:poivre.ucs.louisiana.edu:8089
#Uncomment the next line to use the UNIX domain socket
#worker=ajp13:/home/gmh2441/uPortal/Tomcat_4-0-4/work/jk2.socket
#info=Map the whole examples webapp

[uri:/jkstatus/*]
worker=status:status

---workers2.properties ---

Something else I've seen, under that "#Example socket channel" entry is
that the port and host need to be explicity set, thusly:

port=8089
host=130.70.132.204
(127.0.0.1 for localhost)

 - Does this info have to be there as well?

All this configuration info is based on the document on Apache 2, Tomcat
4.0.4 and mod_jk2 I found at http://www.pubbitch.org/jboss/mod_jk2.html
- and according to this document, once these config files have been
written and installed in the correct places, I need to start Tomcat,
then Apache. First, I should view a "normal" tomcat connection by
referencing a URL ending in 8080, or the port that the standard http
connector is on. Then, (assuming the URL has been mapped in
workers2.properties)(like "/examples/*", I assume) try the equivalent
URL by connecting to Apache instead - I take it that this last sentence
means that if the first URL
 I viewed was, say, http://poivre.ucs.louisiana.edu:8080/examples, the
next URL I should try would be http://poivre.ucs.louisiana.edu/examples
- and I should get the same result, if the connector is working.

Well, according to that "status" worker, and my Apache log, the mod_jk2
connector is installed and working fine. However, all I get going to
that second URL is a blank page - even in the source of the page, all
that's there is <html><body></body></html>. A httpd-xfer log file I have
shows that each request returns a 400 (Bad Request), however when I go
to /jkstatus instead, I get a 200 and a page with tables, showing
various values and other information. I have tried this in several
different browsers - that is one reason I haven't been using "localhost"
but instead use my server's name - I can try it on a nearby PC as well.

None of the docs I've found as yet tell me what to do if things don't go
right - I'm not sure just where to look to solve this. I would
appreciate any ideas/comments/questions/etc.

TIA,

Lynn.
-- 
Lynn Hollerman.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to