Re: Connecting Apache Tomcat to Apache

2009-01-29 Thread Mike Eller
This was also the answer for me (original poster).
I placed the mount directives directly in the virtual host that I needed
it in and all works well.
Thank you for the assistance.

I am sure I will be back with additional questions...so don't go far.

Very Respectfully,
Mike

On Wed, 2009-01-28 at 15:03 -0800, Jordan Michaels wrote:
 Thanks folks. Oddly enough I ran into this same issue with almost an 
 identical system at the same time as the original poster (odd in 
 itself), and this solution fixed me right up. I added the JkMountCopy 
 all line under the rest of my global jkmount lines and that fixed me 
 right up.
 
 Thank you!
 
 Warm regards,
 Jordan Michaels
 Vivio Technologies
 http://www.viviotech.net/
 Open BlueDragon Steering Committee
 Adobe Solution Provider
 
 
 Rainer Jung wrote:
  Well answered until here. I assume it's the old put your JkMount into 
  the virtual host problem.
  
  kMount does only apply to the virtual host they are put into. So when 
  they are in the global server, but your requests to httpd are handled by 
  a VirtualHost, then the JkMounts are not effective for those requests.
  
  To keep it simple, you can set JkMountCopy all in the global server, 
  or you can move the JkMount lines to the virtual hosts which should 
  actually do the forwarding.
  
  Regards,
  
  Rainer
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org
 


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Connecting Apache Tomcat to Apache

2009-01-28 Thread Gregor Schneider
If you want people to help you, it's a good idea to post

- workers.properties (should be in /etc/apache2)

- your jkmount-directives (should be in the httpd-conf-file of your domain)

Not knowing CentOS, therefore just a shot from the hip:

- do you have a directory /etc/apache2/mods-available?

If so, are there two file jk.conf and jk.load?

Can you post your jk.conf?

- do you have a directory /etc/apache2/mods-enabled?

If so, do you also find there symbolic links pointing to
/etc/apache2/mods-available/jk.load and
/etc/apache2/mods-available/jk.conf?

In ${CATALINA_HOME}/conf/server.xml, have you specified a connector
for AJP/1.3? Should look similar to

Connector port=8009
   enableLookups=false redirectPort=8443
protocol=AJP/1.3 address=127.0.0.1/

Can you post your connector-definition?

rgds

Gregor
-- 
just because your paranoid, doesn't mean they're not after you...
gpgp-fp: 79A84FA526807026795E4209D3B3FE028B3170B2
gpgp-key available @ http://pgpkeys.pca.dfn.de:11371

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Connecting Apache Tomcat to Apache

2009-01-28 Thread Mike Eller
Ok,
workers.properties is as follows:

workers.tomcat_home=/usr/lib/apache-tomcat
 
workers.java_home=/usr/lib/jdk
 
worker.list=worker1
 
worker.worker1.port=8009
worker.worker1.host=webber
worker.worker1.type=ajp13

This is a simple file from the tutorial.

The jkmount directives in httpd-conf... I followed the tutorial to use
the auto config, so in httpd.conf I have the following:

Include /usr/lib/apache-tomcat/conf/auto/mod_jk.conf

The contents of mod_jk.conf is as follows:

## Auto generated on Wed Jan 28 15:05:37 EST 2009##

IfModule !mod_jk.c
  LoadModule jk_module
/usr/lib/httpd/modules/mod_jk-1.2.27-httpd-2.2.6.so
/IfModule

JkWorkersFile /usr/lib/apache-tomcat/conf/jk/workers.properties
JkLogFile /usr/lib/apache-tomcat/logs/mod_jk.log

JkLogLevel emerg

I do not have a directory /etc/apache2/mods-available nor can I find the
files jk.conf and jk.load

there is also no directory /etc/apache2/mods-enabled

my connector definition from ${CATALINA_HOME}/conf/server.xml is:

Connector port=8009 protocol=AJP/1.3 redirectPort=8443 /

Again, all this was created and configured according to the
guide/tutorial.

Thanks,
Mike


On Wed, 2009-01-28 at 20:54 +0100, Gregor Schneider wrote:
 If you want people to help you, it's a good idea to post
 
 - workers.properties (should be in /etc/apache2)
 
 - your jkmount-directives (should be in the httpd-conf-file of your domain)
 
 Not knowing CentOS, therefore just a shot from the hip:
 
 - do you have a directory /etc/apache2/mods-available?
 
 If so, are there two file jk.conf and jk.load?
 
 Can you post your jk.conf?
 
 - do you have a directory /etc/apache2/mods-enabled?
 
 If so, do you also find there symbolic links pointing to
 /etc/apache2/mods-available/jk.load and
 /etc/apache2/mods-available/jk.conf?
 
 In ${CATALINA_HOME}/conf/server.xml, have you specified a connector
 for AJP/1.3? Should look similar to
 
 Connector port=8009
enableLookups=false redirectPort=8443
 protocol=AJP/1.3 address=127.0.0.1/
 
 Can you post your connector-definition?
 
 rgds
 
 Gregor


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Connecting Apache Tomcat to Apache

2009-01-28 Thread André Warnier

Mike Eller wrote:

Hi,

I am new to Tomcat and trying to get it up and running.

I have an Apache server (2.2.3) running on CentOS 5.2.  I want to add
the capabilities that tomcat brings, mainly JSP for now.
I followed the connector tutorial/guide on the web site.  I have tomcat
running and can access pages if I use the port number in the url.
According to the guide, Apache should be handing .jsp requests over to
tomcat automatically.  I have went through the guide twice...still no
luck.

...
Ok, I'll bite, even if there are quite detailed instructions available 
here :

http://tomcat.apache.org/connectors-doc/generic_howto/quick.html

..and even if Gregor gave you the short answer before.

First, a bit of theory.

I) If you look at your Tomcat's conf/server.xml file, you will see that 
there are two types of Connector defined, one for HTTP, and one for 
AJP.  The HTTP one listens for requests to Tomcat, in the normal HTTP 
format and usually on port 8080 or 8180 or so.  That is the one you say 
you can access directly from the browser.
The other one listens for requests in a different format (AJP) and on a 
different port (usually 8009 by default).
For a Tomcat application (for example a JSP page), it does not matter 
through which of these channels the request comes in.  It will process 
the request, and respond to it.  Tomcat will then route the response 
back through the same Connector on which it came in.



II) From Apache, there are three ways to communicate with Tomcat :

1) via the Tomcat HTTP connector, using normal HTTP requests.  At the 
Apache level, that is done by using the mod_proxy module.
Basically, this is the same mechanism as the one used when Apache acts 
as a proxy for any other webserver. You have to tell Apache which 
requests it must process itself, and which requests it should forward to 
the back-end server for which it acts as a proxy. Apache will forward 
the request, receive the answer from the back-end server, and pass it 
through to the waiting browser.


2) via the Tomcat AJP connector, using the AJP format, but still at the 
Apache level using the mod_proxy module, this time with the addition of 
a helper mod_proxy_ajp module.  Apache will still receive the original 
request, decide if it has to go to the back-end Tomcat server, and if 
yes pass it on, but this time it passes it on through the mod_proxy_ajp 
module, which transforms the request format from pure HTTP into some 
different format called AJP.  Then this mod_proxy_ajp module forwards 
the request, not to the HTTP Connector of Tomcat, but to the AJP 
Connector of Tomcat.  Other than that, it is the same configuration as 
(1) above.


3) via the Apache add-on mod_jk module, also to the Tomcat AJP 
Connector.  That is presumably the one you are trying to use.
It differs of the above two methods, in that you are no longer using the 
standard proxy module of Apache, you are using a special dedicated 
handler, mod_jk.


There is a slight performance difference between the 3 above options, 
and quite a bit of difference in terms of configuration and 
capabilities.  But we'll leave that for another time.


III) Telling Apache which requests (which URLs) it needs to pass to 
Tomcat.

There again, there are 2 ways to indicate this to Apache :

1) through Apache configuration directives called JkMount and 
JkUnMount.  For example, to tell Apache that all requests for URLs 
starting with /examples should go to Tomcat, you would use these two 
lines :

JkMount /examples worker1
JkMount /examples/* worker1

(where worker1 is just a name that you will encounter again in the 
workers.properties file, see in IV below).


2) with a section like this (same basic effect, but more flexible):
Location /examples
  setHandler jakarta-servlet
/Location

Now with either (1) or (2) Apache knows that if a request URL starts 
with /examples, then it should pass it to the mod_jk module in order 
to generate a response.

That's basically all that Apache knows.

When the mod_jk module is given this request, it will try to pass it to 
Tomcat for processing, and wait for the answer.  When the answer comes 
back, mod_jk gives it to Apache, which sends it to your browser, et 
voila, you run Java servlet examples in Apache !


IV) configuring mod_jk

Of course, for mod_jk to know where Tomcat is, and how to pass it the 
request, it needs instructions.

That is the role of the workers.properties file.
Basically, this file contains parameters that tell mod_jk that the 
Tomcat that you called worker1 above, is located at a certain host 
address (in your case probably localhost) and at a certain port (the 
one referenced in the port attribute of the Tomcat AJP Connector in 
Tomcat's server.xml file, probably 8009).


Now go back to Gregor's instructions about where to find these various 
files and instructions.




-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For 

Re: Connecting Apache Tomcat to Apache

2009-01-28 Thread André Warnier

Mike Eller wrote:

Ok,
workers.properties is as follows:

workers.tomcat_home=/usr/lib/apache-tomcat

comment out or delete, obsolete
 
workers.java_home=/usr/lib/jdk

comment out or delete, no longer needed
 
worker.list=worker1

good, and it matches my earlier explanation

 
worker.worker1.port=8009
good too, if that is the port mentioned in the AJP Connector of your 
Tomcat's server.xml file. (It is, I just peeked below..)



worker.worker1.host=webber
that needs to be localhost instead of webber (cause your Tomcat runs on 
the same machine, right ?). Unless your machine knows itself as webber 
of course.



worker.worker1.type=ajp13

that's good, and it's always like that.  That line never changes.



This is a simple file from the tutorial.

The jkmount directives in httpd-conf... I followed the tutorial to use
the auto config, so in httpd.conf I have the following:

Include /usr/lib/apache-tomcat/conf/auto/mod_jk.conf

The contents of mod_jk.conf is as follows:

## Auto generated on Wed Jan 28 15:05:37 EST 2009##

IfModule !mod_jk.c
  LoadModule jk_module
/usr/lib/httpd/modules/mod_jk-1.2.27-httpd-2.2.6.so
/IfModule
That tells Apache where to find the mod_jk module.  And it is a recent 
version too.




JkWorkersFile /usr/lib/apache-tomcat/conf/jk/workers.properties
that's the workers.properties both Gregor and I were talking about 
then, good too.



JkLogFile /usr/lib/apache-tomcat/logs/mod_jk.log

That's where you will find a log of any errors encountered by mod_jk


JkLogLevel emerg
You could set this to info to get a better idea of what mod_jk is 
doing. Even to debug if you are really curious.




I do not have a directory /etc/apache2/mods-available nor can I find the
files jk.conf and jk.load

there is also no directory /etc/apache2/mods-enabled
That's ok, each Linux distribution has some fun putting files in some 
other place. Keeps the world interesting and sysadmins from getting bored.




my connector definition from ${CATALINA_HOME}/conf/server.xml is:

Connector port=8009 protocol=AJP/1.3 redirectPort=8443 /


Very good. That is thus where Tomcat will be listening for request 
coming from Apache through the mod_jk module, as I mentioned before.




Again, all this was created and configured according to the
guide/tutorial.


You did a pretty good job too. I suspect only the webber part is 
wrong, and maybe your JkMount are missing in Apache.




Thanks,
Mike


On Wed, 2009-01-28 at 20:54 +0100, Gregor Schneider wrote:

If you want people to help you, it's a good idea to post

- workers.properties (should be in /etc/apache2)

- your jkmount-directives (should be in the httpd-conf-file of your domain)

Not knowing CentOS, therefore just a shot from the hip:

- do you have a directory /etc/apache2/mods-available?

If so, are there two file jk.conf and jk.load?

Can you post your jk.conf?

- do you have a directory /etc/apache2/mods-enabled?

If so, do you also find there symbolic links pointing to
/etc/apache2/mods-available/jk.load and
/etc/apache2/mods-available/jk.conf?

In ${CATALINA_HOME}/conf/server.xml, have you specified a connector
for AJP/1.3? Should look similar to

Connector port=8009
   enableLookups=false redirectPort=8443
protocol=AJP/1.3 address=127.0.0.1/

Can you post your connector-definition?

rgds

Gregor



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Connecting Apache Tomcat to Apache

2009-01-28 Thread Rainer Jung

On 28.01.2009 22:58, André Warnier wrote:

Mike Eller wrote:

Ok,
workers.properties is as follows:

workers.tomcat_home=/usr/lib/apache-tomcat

comment out or delete, obsolete


workers.java_home=/usr/lib/jdk

comment out or delete, no longer needed


worker.list=worker1

good, and it matches my earlier explanation



worker.worker1.port=8009

good too, if that is the port mentioned in the AJP Connector of your
Tomcat's server.xml file. (It is, I just peeked below..)


worker.worker1.host=webber

that needs to be localhost instead of webber (cause your Tomcat runs on
the same machine, right ?). Unless your machine knows itself as webber
of course.


worker.worker1.type=ajp13

that's good, and it's always like that. That line never changes.



This is a simple file from the tutorial.

The jkmount directives in httpd-conf... I followed the tutorial to use
the auto config, so in httpd.conf I have the following:

Include /usr/lib/apache-tomcat/conf/auto/mod_jk.conf

The contents of mod_jk.conf is as follows:

## Auto generated on Wed Jan 28 15:05:37 EST 2009##

IfModule !mod_jk.c
LoadModule jk_module
/usr/lib/httpd/modules/mod_jk-1.2.27-httpd-2.2.6.so
/IfModule

That tells Apache where to find the mod_jk module. And it is a recent
version too.



JkWorkersFile /usr/lib/apache-tomcat/conf/jk/workers.properties

that's the workers.properties both Gregor and I were talking about
then, good too.


JkLogFile /usr/lib/apache-tomcat/logs/mod_jk.log

That's where you will find a log of any errors encountered by mod_jk


JkLogLevel emerg

You could set this to info to get a better idea of what mod_jk is
doing. Even to debug if you are really curious.



I do not have a directory /etc/apache2/mods-available nor can I find the
files jk.conf and jk.load

there is also no directory /etc/apache2/mods-enabled

That's ok, each Linux distribution has some fun putting files in some
other place. Keeps the world interesting and sysadmins from getting bored.



my connector definition from ${CATALINA_HOME}/conf/server.xml is:

Connector port=8009 protocol=AJP/1.3 redirectPort=8443 /


Very good. That is thus where Tomcat will be listening for request
coming from Apache through the mod_jk module, as I mentioned before.



Again, all this was created and configured according to the
guide/tutorial.


You did a pretty good job too. I suspect only the webber part is
wrong, and maybe your JkMount are missing in Apache.


Well answered until here. I assume it's the old put your JkMount into 
the virtual host problem.


kMount does only apply to the virtual host they are put into. So when 
they are in the global server, but your requests to httpd are handled by 
a VirtualHost, then the JkMounts are not effective for those requests.


To keep it simple, you can set JkMountCopy all in the global server, 
or you can move the JkMount lines to the virtual hosts which should 
actually do the forwarding.


Regards,

Rainer




On Wed, 2009-01-28 at 20:54 +0100, Gregor Schneider wrote:

If you want people to help you, it's a good idea to post

- workers.properties (should be in /etc/apache2)

- your jkmount-directives (should be in the httpd-conf-file of your
domain)

Not knowing CentOS, therefore just a shot from the hip:

- do you have a directory /etc/apache2/mods-available?

If so, are there two file jk.conf and jk.load?

Can you post your jk.conf?

- do you have a directory /etc/apache2/mods-enabled?

If so, do you also find there symbolic links pointing to
/etc/apache2/mods-available/jk.load and
/etc/apache2/mods-available/jk.conf?

In ${CATALINA_HOME}/conf/server.xml, have you specified a connector
for AJP/1.3? Should look similar to

Connector port=8009
enableLookups=false redirectPort=8443
protocol=AJP/1.3 address=127.0.0.1/

Can you post your connector-definition?

rgds

Gregor


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Connecting Apache Tomcat to Apache

2009-01-28 Thread Jordan Michaels
Thanks folks. Oddly enough I ran into this same issue with almost an 
identical system at the same time as the original poster (odd in 
itself), and this solution fixed me right up. I added the JkMountCopy 
all line under the rest of my global jkmount lines and that fixed me 
right up.


Thank you!

Warm regards,
Jordan Michaels
Vivio Technologies
http://www.viviotech.net/
Open BlueDragon Steering Committee
Adobe Solution Provider


Rainer Jung wrote:
Well answered until here. I assume it's the old put your JkMount into 
the virtual host problem.


kMount does only apply to the virtual host they are put into. So when 
they are in the global server, but your requests to httpd are handled by 
a VirtualHost, then the JkMounts are not effective for those requests.


To keep it simple, you can set JkMountCopy all in the global server, 
or you can move the JkMount lines to the virtual hosts which should 
actually do the forwarding.


Regards,

Rainer


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org