Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I hope this finds you all in the best of your health and spirits. I have an issue with a new setup where I currently have 1 APACHE 2.2.15 & Tomcat 6.0.14 on RHEL. Mod_JK version 1.2.30. Ill add the second Tomcat when this starts working.

So when I try to point my browser to apache-host: port i get IT WORKS , but if point browser to host: port //examples/jsp/ i get a 404....apache isnt forwarding requests to Tomcat Tomcat works fine , i can browse to the JSP examples page and run stuff. I just cannot do it through the apache. Any help is very much appreciated...please help!!!!!

Here are my configs.... no virtual hosts configured...

HTTPD.CONF 
Include conf/jk/mod_jk.conf 
LoadModule jk_module modules/mod_jk.so 

MOD_JK.CONF 
JkWorkersFile conf/jk/workers.properties 
JkShmFile logs/mod_jk.shm 
JkLogFile logs/mod_jk.log 
JkLogLevel info 
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] " 

WORKERS.PROPERTIES 
worker.list=loadbalancer,status 

# Node #1 properties 
worker.worker1.type=ajp13 
worker.worker1.host=localhost 
worker.worker1.port=8009 
worker.worker1.lbfactor=1 

# Node #2 properties(will be configured later when apache and node 1 start working) 
worker.worker2.type=ajp13 
worker.worker2.host=localhost 
worker.worker2.port=001 
worker.worker2.lbfactor=1 

# Load-balancing behaviour 
worker.loadbalancer.type=lb 
worker.loadbalancer.balance_workers=worker1,worker2 

# Status worker for managing load balancer 
worker.status.type=status 

#JkMount /* loadbalancer 
JkMount /examples/jsp lb 
JkMount /examples/jsp/* lb 


tomcat server.xml has this 
<Service name="Catalina"> 
... 
<!-- Define an AJP 1.3 Connector on port 8009 --> 
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> 
... 
</Service>
share|improve this question
    
where did you put JkMount config? workers.properties? it should be putted in Apache config file (or a file under /etc/httpd/conf.d directory). –  LiuYan 刘研 Feb 22 '13 at 4:55

2 Answers 2

WORKERS.PROPERTIES

# Load-balancing behaviour 
worker.loadbalancer.type=lb 
worker.loadbalancer.balance_workers=worker1,worker2 

#JkMount /* loadbalancer 
JkMount /examples/jsp lb 
JkMount /examples/jsp/* lb

This is wrong. Move the JkMount directive to the mod_jk.conf, something like this:

JkWorkersFile conf/jk/workers.properties 
JkShmFile logs/mod_jk.shm 
JkLogFile logs/mod_jk.log 
JkLogLevel info 
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] " 

JkMount /examples/jsp loadbalancer
JkMount /examples/jsp/* loadbalancer

Notice that the Tomcat worker should be loadbalancer as you defined in the workers.properties, instead of lb.

share|improve this answer
    
Got it working... –  vikingz Feb 22 '13 at 16:47

Fixed both...now i just get a blank page....it does complain about second worker in mod_jk logs about host is down but i guess thats OK since i dont have worker 2 configured. It should route requests to worker 1 right?

i get this in access logs when i try host: port/examples/jsp

172.31.118.231 - - [22/Feb/2013:09:27:09 -0600] "GET /examples/jsp HTTP/1.1" 200 -
172.31.118.231 - - [22/Feb/2013:09:27:21 -0600] "GET /examples/jsp HTTP/1.1" 200 -
172.31.118.231 - - [22/Feb/2013:09:27:21 -0600] "GET /favicon.ico HTTP/1.1" 404 209
172.31.118.231 - - [22/Feb/2013:09:28:06 -0600] "GET /examples/jsp HTTP/1.1" 200 -
172.31.118.231 - - [22/Feb/2013:09:28:07 -0600] "GET /favicon.ico HTTP/1.1" 404 209

in error logs

[Fri Feb 22 09:26:00 2013] [error] [client 172.31.118.231] File does not exist: /opt/fas/loader/tomproj/apache2.2.15/htdocs/examples

in mod_jklogs

[Fri Feb 22 09:25:27 2013] [5773:47624974852416] [info] init_jk::mod_jk.c (3189): mod_jk/1.2.30 initialized
[Fri Feb 22 09:26:45 2013] [5777:1119607104] [info] jk_open_socket::jk_connect.c (622): connect to 127.0.0.1:1 failed (errno=111)
[Fri Feb 22 09:26:45 2013] [5777:1119607104] [info] ajp_connect_to_endpoint::jk_ajp_common.c (959): Failed opening socket to (127.0.0.1:1) (errno=111)
[Fri Feb 22 09:26:45 2013] [5777:1119607104] [error] ajp_send_request::jk_ajp_common.c (1585): (worker2) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=111)
[Fri Feb 22 09:26:45 2013] [5777:1119607104] [info] ajp_service::jk_ajp_common.c (2540): (worker2) sending request to tomcat failed (recoverable), because of error during request sending (attempt=1)
[Fri Feb 22 09:26:45 2013] [5777:1119607104] [info] jk_open_socket::jk_connect.c (622): connect to 127.0.0.1:1 failed (errno=111)
[Fri Feb 22 09:26:45 2013] [5777:1119607104] [info] ajp_connect_to_endpoint::jk_ajp_common.c (959): Failed opening socket to (127.0.0.1:1) (errno=111)
[Fri Feb 22 09:26:45 2013] [5777:1119607104] [error] ajp_send_request::jk_ajp_common.c (1585): (worker2) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=111)
[Fri Feb 22 09:26:45 2013] [5777:1119607104] [info] ajp_service::jk_ajp_common.c (2540): (worker2) sending request to tomcat failed (recoverable), because of error during request sending (attempt=2)
[Fri Feb 22 09:26:45 2013] [5777:1119607104] [error] ajp_service::jk_ajp_common.c (2559): (worker2) connecting to tomcat failed.
[Fri Feb 22 09:26:45 2013] [5777:1119607104] [info] service::jk_lb_worker.c (1388): service failed, worker worker2 is in error state

its the

share|improve this answer
    
OK got it working.....after those 2 changes , i found out tomcat ajp port's configuration has an issue...i had this....<Service name="Catalina"> <!-- Define an AJP 1.3 Connector on port 8009 --> <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> </Service> .............................i removed <Service name="Catalina"> and removed /service....and only used <!-- Define an AJP 1.3 Connector on port 8009 --> <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />...tomcat worked fine...no errors.....apache work fine no errors....thank you Quanta & Liu Yuan!!!! –  vikingz Feb 22 '13 at 16:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.