Temos uma instância do Tomcat atrás de um Apache. Nós usamos mod_jk.
A configuração do módulo é:
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>
E aqui a configuração do VirtualHost:
<VirtualHost *:9090>
...
JkMount /Web/* worker-Web
JkMount /Web worker-Web
</VirtualHost>
O arquivo workers.properties:
worker.list=worker-Web
worker.worker-omiapWeb.port=8209
worker.worker-omiapWeb.host=localhost
worker.worker-omiapWeb.type=ajp13
Esta configuração funciona muito bem para jsp, html ... mas nós temos um arquivo JNLP:
<?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>
O problema é que baixar os recursos do JNLP falha aleatoriamente (falha mais se a velocidade da conexão for ruim).
Se acessarmos diretamente ao Tomcat, tudo funcionará bem.
Alguma idéia?
Editado 1:
Erro de log do Apache:
[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
Editado 2:
server.xml Seção AJP:
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8209"
maxThreads="300" connectionTimeout="600000"
enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />