You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by VEGH Karoly <ka...@uta.at> on 2004/05/01 19:33:38 UTC

usage of JkWorkersFile and JkLogFile in apache config.

Hi all,


I am trying to integrate two Tomcat instances with one apache with 
mod_jk2 on a linux box.
Well, I have an idea how to do this, but it the 'official' way
is others, do not hesitate to let me know it.

With a single tomcat instance everything works fine, e.g. the /admin 
and the /manager and the /examples apps.

What I though of, is: two VirtualHost entries in apache, both 
using mod_jk2 to connect to two different tomcat-instances.

The challange at it is: the location of the workers2.properties file is
hardcoded in the mod_jk2:

bilbo:~# strings /usr/lib/apache2/modules/mod_jk2.so | grep workers2.proper
${serverRoot}/conf/workers2.properties
bilbo:~#

because of this I of course have an /etc/apache2/conf/workers2.properties
file.

well, i thought no problem, i could use the JkWorkersFile directive in the 
VirtualHost section, like this:

-----------<cut>--------------------------

NameVirtualHost tomcat:80
<VirtualHost tomcat:80>
        ServerName tomcat
        DocumentRoot /var/www/

[...apache directives snipped ...]

<IfModule mod_jk.c>
        JkWorkersFile /etc/apache2/conf/tomcat-workers2.properties
        JkWorkersFile /etc/apache2/conf/tomcat-workers2.properties
        JkMount /examples/* ajp13
        JkMount /examples/ ajp13
        JkLogFile /var/log/apache2/tomcat-mod_jk.log

    <Location "/examples/*">
            JkUriSet worker ajp13:localhost:8009 
    </Location>
    <Location "/examples/">
            JkUriSet worker ajp13:localhost:8009 
    </Location>

</IfModule>

        LogLevel warn
        ErrorLog /var/log/apache2/tomcat-error.log
        CustomLog /var/log/apache2/tomcat-access.log combined

-----------<cut>--------------------------

my other VirtualHost entry looks like this one, just I used everywhere
"tomcat2" instead od "tomcat".

...and in the /etc/apache2/conf/tomcat-workers2.properties file and in the 
/etc/apache2/conf/tomcat2-workers2.properties files I thought I could define
different channel sockets with the same uri's so that from the 
tomcat VirtualHost the /examples/ uri through channel.socket would run on 
port 8009 (on the first tomcat instance), and from the tomcat2 VirtualHost 
the /examples/ uri through the channel socket would run on port 8109
(to the second tomcat instance).


Well, the VirtualHost directives work fine, since the errormessages about 
the virtualhost come to the ErrorLog defined in the VirtualHost:

bilbo:/var/log/apache2# tail -1 tomcat-error.log 
[Tue May 18 18:29:42 2004] [error] [client 127.0.0.1] File does not exist: /var/www/examples
bilbo:/var/log/apache2# 


But the JkWorkersFile directives in the VirtualHost seem to be ignored somehow,
since I have defined the /examples/ uri in my tomcat-workers2.properties file, 
but still I don't get any connection between the VIrtualHost and the first tomcat
instance.
the JkLogFile directive doesnt work either.

how to override the workers2.properties location and the directives in it?

the relevant parts of my tomcat-workers2.properties file:

------<cut>---------------------

[logger]
level=DEBUG

[config:]
file=/etc/apache2/conf/tomcat-workers2.properties
debug=1
debugEnv=0

[uriMap:]
info=Maps the requests. Options: debug
debug=0

# Alternate file logger
[logger.file:0]
level=DEBUG
file=/var/log/apache2/jk2-tomcat.log

[...]

[channel.socket:localhost:8009]
info=Ajp13 forwarding over socket
debug=1
tomcatId=localhost:8009

[ajp13:localhost:8009]
channel=channel.socket:localhost:8009

[status:status]
info=Status worker, displays runtime informations

[...]

[uri:/jkstatus/*]
info=Display status information and checks the config file for changes.
group=status:
worker=status:status

[uri:/examples]
info=Example webapp in the default context.
context=/examples
debug=0

[uri:/examples/*.jsp]
info=Extension mapping

[uri:/examples/*]
info=Map the whole webapp

-------------<cut>--------------------


What did i do wrong?
with the port give in the URL everything works fine.
any help is appreciated, and ofcourse I am ready to give more informaiton,
if necessary.

a quick and dirty hack would be to use more mod_jk2.so files with different 
workers2.properties path hardcoded in them, but Im not sure what the apache
would say if I would want to load  a module two times with different names.

oh yes: 

tomcat 4.1.30
apache 2.0.49

mod_jk version:

bilbo:/var/log/apache2# lynx -dump localhost  |grep mod_jk
    Apache/2.0.49 (Debian GNU/Linux) mod_jk2/2.0.2 Server at localhost
bilbo:/var/log/apache2# 

tia

charlie

-- 
Végh Károly -  System Engineer - UTA - TIS.SAS.BSS
"There are two major products that come out of Berkeley: LSD and UNIX.
 We don't believe this to be a coincidence." 
 				- Jeremy S. Anderson

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: usage of JkWorkersFile and JkLogFile in apache config.

Posted by VEGH Karoly <ka...@uta.at>.
On Sat, May 01, 2004 at 07:33:38PM +0200, VEGH Karoly wrote:

> I am trying to integrate two Tomcat instances with one apache with 
> mod_jk2 on a linux box.
> Well, I have an idea how to do this, but it the 'official' way
> is others, do not hesitate to let me know it.

erm, OK, didnt know, that the host name can be given in the 
workers2.properties in the uri directive, of course now it sounds logical,
and works fine as well, no need for extra JkDirectives im VirtualHost:

[uri:tomcat/examples/*.jsp]
worker=ajp13:localhost:8009
info=Extension mapping

[uri:tomcat/examples/*]
worker=ajp13:localhost:8009
info=Map the whole webapp


[uri:tomcat2/examples/*.jsp]
worker=ajp13:localhost:8109
info=Extension mapping

[uri:tomcat2/examples/*]
worker=ajp13:localhost:8109
info=Map the whole webapp


HAND

charlie

-- 
Végh Károly -  System Engineer - UTA - TIS.SAS.BSS
"There are two major products that come out of Berkeley: LSD and UNIX.
 We don't believe this to be a coincidence." 
 				- Jeremy S. Anderson

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org