trouble running multiple domains on tomcat behind apache via mod_jk

Posted by mkoryak on Server Fault See other posts from Server Fault or by mkoryak
Published on 2011-02-08T03:13:26Z Indexed on 2012/06/22 9:18 UTC
Read the original article Hit count: 263

Filed under:
|
|

I am having trouble setting up tomcat6 with 2 virtual hosts, behind apache2.

if i have just one host defined in tomcat, and one jk worker, everything works fine. as soon as i define another jk worker and a corresponding tomcat host i get this error in jk.log:

9:3075328656] [info] ajp_connect_to_endpoint::jk_ajp_common.c (922): Failed opening socket to (69.164.218.75:8009) (errno=111)
[Tue Feb 08 03:08:13 2011] [17159:3075328656] [error] ajp_send_request::jk_ajp_common.c (1507): (dogself) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=111)
[Tue Feb 08 03:08:13 2011] [17159:3075328656] [info] ajp_service::jk_ajp_common.c (2447): (dogself) sending request to tomcat failed (recoverable), because of error during request sending (attempt=2)
[Tue Feb 08 03:08:13 2011] [17159:3075328656] [error] ajp_service::jk_ajp_common.c (2466): (dogself) connecting to tomcat failed.
[Tue Feb 08 03:08:13 2011] [17159:3075328656] [info] jk_handler::mod_jk.c (2615): Service error=-3 for worker=dogself

my tomcat server.xml looks like this:

<Service name="Catalina">


<Connector port="8080" protocol="HTTP/1.1" 
           connectionTimeout="20000" 
           URIEncoding="UTF-8"
           redirectPort="8443" />

<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />



<Engine name="Catalina" defaultHost="dogself.com">


  <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
         resourceName="UserDatabase"/>


  <Host name="dogself.com"  appBase="webapps-dogself"
        unpackWARs="true" autoDeploy="true"
        xmlValidation="false" xmlNamespaceAware="false">
  </Host>

  <Host name="nousophia.com"  appBase="webapps-test"
        unpackWARs="true" autoDeploy="true"
        xmlValidation="false" xmlNamespaceAware="false">
  </Host>


</Engine>
</Service>

my workers.properties looks like this:

# workers.properties - ajp13
#
# List workers
worker.list=dogself,nousophia

# Define dogself
worker.dogself.port=8009
worker.dogself.host=dogself.com
worker.dogself.type=ajp13

worker.nousophia.port=8009
worker.nousophia.host=nousophia.com
worker.nousophia.type=ajp13

tomcat is started/restarted

i followed these directions for setting it up: http://stackoverflow.com/questions/1765399/linking-apache-to-tomcat-with-multiple-domains

can someone confirm that it would work as above?

© Server Fault or respective owner

Related posts about apache2

Related posts about tomcat6