You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by John Martin <jo...@virgin.net> on 2004/06/09 00:55:28 UTC

Apache 2, Tomcat 5, mod_jk2 with virtual hosts and multiple Tomcat instances

Hi All,

I'm having problems integrating Apache 2.0.46, Tomcat 5.0.24 using connectors JK2 2.0.2 on linux for multiple Tomcat instances.

I'm trying to run seperate instances of Tomcat for development environments that also correspond to different virtual hosts. I have managed to get the different instances of Tomcat working on there own, "browsing" to them using the relevant port numbers. If i then use mod_jk2 to connect to either instance seperately (without the other instance being configured), it all works ok, however when i try to run both (and configured) i get an "Internal Server error" for dev2, and the error in the Apache log file is:
 
[Mon Jun 07 22:26:13 2004] [error] channelSocket.open() connect failed 127.0.0.1:9109 111 Connection refused
[Mon Jun 07 22:26:13 2004] [error] ajp13.connect() failed ajp13:localhost:9109
[Mon Jun 07 22:26:13 2004] [error] ajp13.service() failed to connect endpoint errno=111 Connection refused
[Mon Jun 07 22:26:13 2004] [error] ajp13.service() Error  forwarding ajp13:localhost:9109 1 1
[Mon Jun 07 22:26:13 2004] [notice] ajp13.done() close endpoint ajp13:localhost:9109 error_state 1
[Mon Jun 07 22:26:13 2004] [error] lb.service() worker failed 120000 for ajp13:localhost:9109
[Mon Jun 07 22:26:13 2004] [notice] lb.getWorker() All workers in error state, use the one with oldest error
[Mon Jun 07 22:26:13 2004] [notice] lb.getWorker() We tried all possible workers 5
[Mon Jun 07 22:26:13 2004] [error] lb_worker.service() all workers in error or disabled state
[Mon Jun 07 22:26:13 2004] [error] mod_jk.handler() Error connecting to tomcat 120000

The development environments are dev2, dev3 etc and are different virtual hosts on server, server:

Workers2.properties
[logger.apache2]
level=DEBUG

[shm]
file=/usr/local/apache/logs/shm.file
size=1048576

# Example socket channel, override port and host.
[channel.socket:localhost:8009]
port=8009
host=127.0.0.1

# define the server worker
[ajp13:localhost:8009]
channel=channel.socket:localhost:8009

# Added for dev2
[channel.socket:localhost:9109]
port=9109
host=127.0.0.1
group=dev2

# define the worker
[ajp13:localhost:9109]
channel=channel.socket:localhost:9109
group=dev2

# new worker
[uri:dev2/*]
group=dev2

The "mod_jk-server.conf"

<VirtualHost server>
  ServerName server
  ServerAlias server.company.co.uk
  DocumentRoot /usr/local/tomcat/webapps/server
  ErrorLog logs/server-error_log
  TransferLog logs/server-access_log
  ScriptAlias /cgi-bin /usr/local/tomcat/webapps/server/cgi-bin
  <location "/*.jsp">
        JkUriSet worker ajp13:localhost:8009
  </location>
  <location "/servlet/*">
        JkUriSet worker ajp13:localhost:8009
  </location>
  <location "/manager/*">
        JkUriSet worker ajp13:localhost:8009
  </location>
  <location "/*.do">
        JkUriSet worker ajp13:localhost:8009
  </location>
</VirtualHost>

The "mod_jk-dev2.conf"
<VirtualHost dev2>
  ServerName dev2
  ServerAlias dev2.company.co.uk
  DocumentRoot /usr/local/home/dev2/BUILD/htdocs
  ErrorLog logs/dev2-error_log
  TransferLog logs/dev2-access_log
  ScriptAlias /cgi-bin /usr/local/home/dev2/BUILD/htdocs/cgi-bin
  <Location "/*.jsp">
        JkUriSet group dev2
  </Location>
  <Location "/servlet/*">
        JkUriSet group dev2
  </Location>
  <Location "/*.do">
        JkUriSet group dev2
  </Location>
</VirtualHost>

Any help would be appreciated as i have trawled the mail archives and googled and haven't come up with much to help solve the problem.

Many thanks,
John