mod_jk problem: Tomcat is probably not started or is listening on the wrong port

24,822

Solution 1

thanks for all your support, I really appreciate it!

It was actually, as some of you suggested - application issue. This was caused by incorrect configuration of MySQL connection pooling (typo in timeout - so value was having one 0 to much). So application was running out of Connections to DB, as those were never timing out.

Fixing pooling configuration (in my case c3p0) resolved issue!

Thanks once again!

Konrad

Solution 2

Is this a busy site? Maybe you are just reaching maxThreads.

Solution 3

It appears that no response is being sent Tomcat before the timeout period. This could be an application issue. What I would do in this situation is have some sort of monitoring set up (be it Nagios, or something far simpler) to make sure on a frequent interval that:

  • Port 8009 on the application server is accepting incoming connections.
  • Port 8009 on the application server is accepting AJP/1.3 requests at all.

If you graph the historical of these tests you might find an issue with your application and/or application server having periodic outages, which will eventually lead you to a root cause. Best of luck... intermittent issues are the worst.

Share:
24,822

Related videos on Youtube

Konrad Pawlus
Author by

Konrad Pawlus

I am IT manager, CTO, always passionate about software craftsmanship. Successfully delivered SaaS products from scratch to $17 mln ARR global solutions. Scaled IT team from 1 up to 75 people. Stil know how to code 😉 I have 9 years of experience building SALESmanago – 3rd largest European Marketing Automation Platform as VP of Engineering/CTO. Scaling from 2 to 260 employees, of which 75 in IT, from 0 to 45 000 transactions/s. Always thinking business first! Additionally as an investor and consultant I am involved in ExMetrix – one of most innovative AI startup in Poland. Prior to founding SALESmanago I worked 2 years at Sabre, where I quickly jumped from senior level Developer to 20 people team manager. Working with tech debt, always delivering, even when it was said some things are impossible. Before Sabre I spent 4 years of Java challenges in two Irish startups in Dublin. Delighted with Ireland’s startup culture, longing Irish attitude and atmosphere. Graduated from one of best polish Universities – AGH while working full time at innovative fintech Startups. In meantime launching at least two own projects – which failed – but there were reasons behind. konrad[at]pawlus.io http://www.linkedin.com/in/konradpawlus

Updated on September 17, 2022

Comments

  • Konrad Pawlus
    Konrad Pawlus over 1 year

    I am running some application on Tomcat 6.0.26. There is Apache in front of web server talking to it over mod_jk. Every few hours when I try to access application browser simply spins, and no content is retrieved.

    No error is reported in Tomcat logs, but I fond such errors in mod_jk log:

    [Sun Jul 04 21:19:13 2010][error] ajp_service::jk_ajp_common.c (1758): Error connecting to tomcat. Tomcat is probably not started or is listening on the wrong port. worker=***** failed
    [Sun Jul 04 21:19:13 2010][info]  jk_handler::mod_jk.c (1985): Service error=0 for worker==*****
    [Sun Jul 04 21:19:13 2010][info]  ajp_connection_tcp_get_message::jk_ajp_common.c (955): Tomcat has forced a connection close for socket 46
    [Sun Jul 04 21:19:13 2010][info]  ajp_connection_tcp_get_message::jk_ajp_common.c (955): Tomcat has forced a connection close for socket 46
    [Sun Jul 04 21:19:13 2010][info]  ajp_connection_tcp_get_message::jk_ajp_common.c (955): Tomcat has forced a connection close for socket 46
    [Sun Jul 04 21:19:13 2010][error] ajp_get_reply::jk_ajp_common.c (1503): Tomcat is down or refused connection. No response has been sent to the client (yet)
    [Sun Jul 04 21:19:13 2010][error] ajp_get_reply::jk_ajp_common.c (1503): Tomcat is down or refused connection. No response has been sent to the client (yet)
    [Sun Jul 04 21:19:13 2010][info]  ajp_connection_tcp_get_message::jk_ajp_common.c (955): Tomcat has forced a connection close for socket 46
    [Sun Jul 04 21:19:13 2010][error] ajp_get_reply::jk_ajp_common.c (1503): Tomcat is down or refused connection. No response has been sent to the client (yet)
    [Sun Jul 04 21:19:13 2010][info]  ajp_connection_tcp_get_message::jk_ajp_common.c (955): Tomcat has forced a connection close for socket 45
    [Sun Jul 04 21:19:13 2010][info]  ajp_connection_tcp_get_message::jk_ajp_common.c (955): Tomcat has forced a connection close for socket 46
    [Sun Jul 04 21:19:13 2010][info]  ajp_service::jk_ajp_common.c (1721): Receiving from tomcat failed, recoverable operation attempt=0
    

    my worker is configured in following way:

    worker.admanagonode.port=8009
    worker.admanagonode.host=*****.com
    worker.admanagonode.type=ajp13
    worker.admanagonode.ping_mode=A
    worker.admanagonode.socket_timeout=60
    worker.admanagonode.prepost_timeout=10000
    worker.admanagonode.connect_timeout=10000
    worker.admanagonode.connection_pool_size=200
    worker.admanagonode.connection_pool_timeout=300
    worker.admanagonode.retries=20
    worker.admanagonode.socket_keepalive=1
    worker.admanagonode.cachesize=10
    worker.admanagonode.cache_timeout=600
    

    Tomcat has same port number in Connector configuration:

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

    Does any of you has any ideas what i am missing? What can cause such problems?

    Cheers Konrad

    • Kyle Smith
      Kyle Smith almost 14 years
      Why do you have a redirectPort on your AJP/1.3 Connector directive? I think this option is actually ignored but that certainly doesn't make sense.
  • Konrad Pawlus
    Konrad Pawlus almost 14 years
    Thanks Kyle, I did setup some monitoring, will try to see if I will get any more info on that. But if anyone will have some other ideas please share those. This is driving me a bit crazy :)