1

We have an instance of Tomcat behind an Apache. We use mod_jk.

The module config is:

LoadModule jk_module modules/mod_jk.so
<IfModule mod_jk.c>
  JkWorkersFile conf/workers.properties
  JkLogFile     logs/mod_jk.log
  JkLogLevel    info
  JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
</IfModule>

And here the VirtualHost config:

<VirtualHost *:9090>
...
  JkMount  /Web/* worker-Web
  JkMount  /Web worker-Web
</VirtualHost>

The workers.properties file:

worker.list=worker-Web
worker.worker-omiapWeb.port=8209
worker.worker-omiapWeb.host=localhost
worker.worker-omiapWeb.type=ajp13

This config works great for jsp, html... but we have a JNLP file:

<?xml version="1.0" encoding="utf-8"?>
  <jnlp spec="1.0" codebase="$$codebase">
    <information>
      <title>Gestor Impresiones</title>
      <vendor>.</vendor>
    </information>
    <resources locale="es">
      <jar href="gestorImpresiones.jar"/>
      <jar href="jasperreports-1.2.5.jar"/>
      <jar href="commons-httpclient-3.1-beta1.jar"/>
      <jar href="commons-logging-1.1.jar"/>
      <jar href="commons-codec-1.3.jar"/>
      <jar href="commons-javaflow-20060411.jar"/>
      <jar href="commons-collections-3.1.jar"/>
      <jar href="poi-3.0.1-FINAL-20070705.jar"/>
      <jar href="jdic.jar"/>
    </resources>
    <resources os="Windows">
      <jar href="windows/jdic_stub.jar"/>
      <nativelib href="windows/jdic-native.jar"/>
    </resources>
    <resources os="Linux">
      <jar href="linux/jdic_stub.jar"/>
      <nativelib href="linux/jdic-native.jar"/>
    </resources>
    <resources locale="es">
      <j2se version="1.3+" href="http://java.sun.com/products/autodl/j2se"/>
    </resources>
    <security>
      <all-permissions/>
    </security>
    <application-desc main-class="stacks.printing.cliente.GestorImpresionLauncher"/>
  </jnlp>

The problem is that downloading the JNLP resources fails randomly (It fails more if the connection speed are poor).

If we access directly to Tomcat, everything works fine.

Any ideas?

Edited 1:

Apache log error:

[Thu Jul 01 09:51:45 2010] [868:5096] [info] jk_connect.c (566): connect to 127.0.0.1:8209 failed (errno=61)
[Thu Jul 01 09:51:45 2010] [868:5096] [info] jk_ajp_common.c (869): Failed opening socket to (127.0.0.1:8209) (errno=61)
[Thu Jul 01 09:51:45 2010] [868:5096] [error] jk_ajp_common.c (1359): (worker-omiapWeb) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=61)
[Thu Jul 01 09:51:45 2010] [868:5096] [info] jk_ajp_common.c (2186): (worker-omiapWeb) sending request to tomcat failed (recoverable), because of error during request sending (attempt=2)
[Thu Jul 01 09:51:45 2010] [868:5096] [error] jk_ajp_common.c (2204): (worker-omiapWeb) Connecting to tomcat failed. Tomcat is probably not started or is listening on the wrong port
[Thu Jul 01 09:51:45 2010] [868:5096] [info] mod_jk.c (2364): Service error=-3 for worker=worker-omiapWeb

Edited 2:

server.xml AJP section:

<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8209" 
       maxThreads="300" connectionTimeout="600000"
       enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />
2
  • What versions of Tomcat, Apache, and connector modules are you using?
    – Kief
    Jul 12, 2010 at 7:54
  • Tomcat 5.5.27, Apache HTTP 2.0.63 and Tomcat Connector 1.2.26
    – Maxfer
    Jul 12, 2010 at 11:17

3 Answers 3

1

Why do you serve the JNLP application from tomcat? WebStart uses plain HTTP GET requests to acces the JNLP file and then the .jar files. You could place these outside of Tomcat, and let Apache do the work alone.

0

Try setting your worker timeouts to higher than default values:

worker.worker-omiapWeb.socket_timeout=60

worker.worker-omiapWeb.connect_timeout=2000

worker.worker-omiapWeb.prepost_timeout=1000

worker.worker-omiapWeb.reply_timeout=30000

That goes in your workers.properties file. You may have to go higher with one or more of them - we'd need to see your apache log files to be sure which one is causing the issue for you.

2
0

You may also want to post the bits of your server.xml for the AJP connector. One possibility is that your connector on the Tomcat side doesn't have enough capacity (maxThreads & timeout) to handle the number of connections Apache is sending it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .