Re: Is this common behavior in Apache Tomcat? (cPanel install of Tomcat 5.5)

2010-09-12 Thread André Warnier

Carlo del Mundo wrote:

I realized the problem indirectly as I wrote this e-mail; thanks for your
quick response also.

I went to my httpd.conf for Apache, found the VirtualHost entry to my
Servlet, to find that my application was not automagically listed under
JkMount.

I manually added it, and voila it works.

Can you answer me this however... for every WAR I want to install, I must
manually add it to the httpd.conf virtual hosts entry? 


Hi.

Short answer : yes.

Medium answer : yes, because the JkMount /something directive in httpd.conf, is the way 
whereby the Apache add-on module mod_jk learns that it must forward to Tomcat the 
requests which match this URL.


Longer answer :
It works approximately like this :

A) during Apache startup:

When Apache (httpd) loads an add-on module (like mod_jk), it calls an initialisation 
procedure in this module.  This procedure tells Apache  which configuration directives it 
is interested in (in this case, this would be a list including JkMount, JkUnMount, etc..).


Later, when Apache scans the httpd.conf, when it finds such a directive, it calls another 
procedure in the add-on module to actually process the directive.
So for example, when Apache finds a directive JkMount later in the httpd.conf file, it 
calls mod_jk to handle this.  And when mod_jk is called, with JkMount /something as a 
parameter, it internally builds a table, of all the URL patterns which it should later handle.


B) later at run-time:

Whenever Apache receives a request, it will look at all the handlers it has for 
processing that request.  Then it will pass the request to each possible handler in turn.
A called handler can decide to process the request and generate a response for it, or to 
decline. If it declines, Apache will call the next handler and so on, until one generates 
a response.
mod_jk is one of these handlers, so it gets called for each request, and can examine the 
request to see if he wants to handle it.  If the request URL matches one of the URLs that 
were specified earlier by one of the JkMount directives, mod_jk will handle it, and will 
generate the response to that request.
(For Apache thus, it is mod_jk which generates the response;  Apache itself has no idea 
that mod_jk is cheating, and actually passing this request to another process (Tomcat) 
to generate the response.)


Tip answer :
I do not think that you can dynamically add new URL patterns to the internal table of 
mod_jk.  But you can make use of Apache's include and reload capabilities to get 
something similar.


When you tell Apache to reload its configuration (e.g. under most Linuxes : 
/etc/init.d/apache2 reload), it re-reads all its configuration files, and goes through 
the process described above in (A).
You can tell Apache to include in this configuration, all the files located in some 
directory (e.g. Include /etc/apache2/mods-enabled/*.conf).


In your case thus, you could set up your deployment script to automatically create a small 
file in some Apache configuration directory (e.g. /etc/apache2/tomcat_apps), this file 
containing a list of JkMount directives, like :

JkMount /myapp1
JkMount /myapp1/*
JkMount /myapp2
JkMount /myapp2/*
...
JkMount /mynewapp
JkMount /mynewapp/*

then add in httpd.conf the following line :
Include /etc/apache2/tomcat_apps/*

then force an Apache reload.

You need to adapt the above in function of your Virtual Hosts, so that each host gets 
his tomcat apps (the Include can be in a VirtualHost section).



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



Re: Is this common behavior in Apache Tomcat? (cPanel install of Tomcat 5.5)

2010-09-11 Thread Carlo del Mundo
 Hi all.

 I installed mod_jk (the Tomcat module) via easyApache (predefined script
 that installs Tomcat on my web server).  The install went on fine.  I added
 a servlet to a specific domain name, and then I proceeded with unzipping a
 WAR into the appBase folder.

 It detects the appBase folder fine (and added the WAR perfect).

 I can access my context application through
 http://mydomain.com:8080/mySoftware/

 However, I cannot access the application through
 http://mydomain.com/mySoftware/

 Is this common behavior since I am running Apache Http Server alongside the
 mod_jk (Tomcat) jsvc service?

 I just need verification because for some reason iptables likes to block
 out users who use port 8080.

 Info:
 OS: CentOS 5.5
 Apache Http Sever 2.2 with Apache Tomcat 5.5

 Thanks.

 Carlo



Re: Is this common behavior in Apache Tomcat? (cPanel install of Tomcat 5.5)

2010-09-11 Thread msacks
We need a bit more info to help. Post your mod_jk directives and output of
iptables -l and any other configuration directives you think might be
relevant.

On Sep 11, 2010 9:24 PM, Carlo del Mundo carlodelmu...@gmail.com wrote:
 Hi all.

 I installed mod_jk (the Tomcat module) via easyApache (predefined script
 that installs Tomcat on my web server). The install went on fine. I added
 a servlet to a specific domain name, and then I proceeded with unzipping
a
 WAR into the appBase folder.

 It detects the appBase folder fine (and added the WAR perfect).

 I can access my context application through
 http://mydomain.com:8080/mySoftware/

 However, I cannot access the application through
 http://mydomain.com/mySoftware/

 Is this common behavior since I am running Apache Http Server alongside
the
 mod_jk (Tomcat) jsvc service?

 I just need verification because for some reason iptables likes to block
 out users who use port 8080.

 Info:
 OS: CentOS 5.5
 Apache Http Sever 2.2 with Apache Tomcat 5.5

 Thanks.

 Carlo



Re: Is this common behavior in Apache Tomcat? (cPanel install of Tomcat 5.5)

2010-09-11 Thread Carlo del Mundo
I realized the problem indirectly as I wrote this e-mail; thanks for your
quick response also.

I went to my httpd.conf for Apache, found the VirtualHost entry to my
Servlet, to find that my application was not automagically listed under
JkMount.

I manually added it, and voila it works.

Can you answer me this however... for every WAR I want to install, I must
manually add it to the httpd.conf virtual hosts entry? The automatic
deployment script in Tomcat can't do it for me?

Thanks.

Carlo

On Sun, Sep 12, 2010 at 12:31 AM, msacks ntw...@gmail.com wrote:

 We need a bit more info to help. Post your mod_jk directives and output of
 iptables -l and any other configuration directives you think might be
 relevant.

 On Sep 11, 2010 9:24 PM, Carlo del Mundo carlodelmu...@gmail.com
 wrote:
  Hi all.
 
  I installed mod_jk (the Tomcat module) via easyApache (predefined script
  that installs Tomcat on my web server). The install went on fine. I
 added
  a servlet to a specific domain name, and then I proceeded with unzipping
 a
  WAR into the appBase folder.
 
  It detects the appBase folder fine (and added the WAR perfect).
 
  I can access my context application through
  http://mydomain.com:8080/mySoftware/
 
  However, I cannot access the application through
  http://mydomain.com/mySoftware/
 
  Is this common behavior since I am running Apache Http Server alongside
 the
  mod_jk (Tomcat) jsvc service?
 
  I just need verification because for some reason iptables likes to block
  out users who use port 8080.
 
  Info:
  OS: CentOS 5.5
  Apache Http Sever 2.2 with Apache Tomcat 5.5
 
  Thanks.
 
  Carlo