Exclusão de responsabilidade: não é um administrador de servidor
Eu tenho coçado minha cabeça sobre isso por semanas agora (não mente de forma consistente você, pois isso seria enlouquecedor). Eu tenho tentado conectar meu servidor apache2 ao meu servidor tomcat até o ponto em que, se alguém encontrar * .jsp ou qualquer servelet ao navegar pelo meu diretório da web, ele será entregue ao tomcat.
Eu tenho tanto Apache2.0 (port 9099)
e Tomcat6 (9089)
rodando no Debian lenny na mesma caixa.
Atualmente, mod_jk
está ativado com mod_jk.conf
em $apacheHOME/mods-enabled/
com conteúdo:
# Where to find workers.properties
JkWorkersFile /etc/apache2/workers.properties
# Where to put jk shared memory
JkShmFile /var/log/at_jk/mod_jk.shm
# Where to put jk logs
JkLogFile /var/log/at_jk/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the timestamp log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# Send servlet for context /examples to worker named worker1
JkMount /*/servlet/* worker1
# Send JSPs for context /examples to worker named worker1
JkMount /*.jsp worker1
my workers.properties
localizado em $apacheHOME/
com conteúdo:
workers.tomcat_home=/var/lib/tomcat6
workers.java_home=/usr/lib/jdk1.6.0_23/db/
worker.list=worker1
ps=/
worker.worker1.port=9081
worker.worker1.host=localhost
worker.worker1.type=ajp13
my web.xml
in $tomcatHOME/conf
tem os seguintes servlets ativados
<servlet>
<servlet-name>default</servlet-name>
<servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-cla$
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<init-param>
<param-name>listings</param-name>
<param-value>false</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
<param-name>fork</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>xpoweredBy</param-name>
<param-value>false</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>*.jsp</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
server.xml:
- >
- >
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="9081" protocol="AJP/1.3" redirectPort="9088" />
mod_jk.log:
[Mon Feb 21 13:49:35 2011] [2921:3075307264] [info] jk_open_socket::jk_connect.c (566): connect to 127.0.0.1:9081 failed (errno=111)
[Mon Feb 21 13:49:35 2011] [2921:3075307264] [info] ajp_connect_to_endpoint::jk_ajp_common.c (869): Failed opening socket to (127.0.0.1:9081) (errno=111)
[Mon Feb 21 13:49:35 2011] [2921:3075307264] [error] ajp_send_request::jk_ajp_common.c (1359): (worker1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=111)
[Mon Feb 21 13:49:35 2011] [2921:3075307264] [info] ajp_service::jk_ajp_common.c (2194): (worker1) sending request to tomcat failed (recoverable), because of error during request sending (attempt=1)
[Mon Feb 21 13:49:35 2011] [2921:3075307264] [info] jk_open_socket::jk_connect.c (566): connect to 127.0.0.1:9081 failed (errno=111)
[Mon Feb 21 13:49:35 2011] [2921:3075307264] [info] ajp_connect_to_endpoint::jk_ajp_common.c (869): Failed opening socket to (127.0.0.1:9081) (errno=111)
[Mon Feb 21 13:49:35 2011] [2921:3075307264] [error] ajp_send_request::jk_ajp_common.c (1359): (worker1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=111)
[Mon Feb 21 13:49:35 2011] [2921:3075307264] [info] ajp_service::jk_ajp_common.c (2194): (worker1) sending request to tomcat failed (recoverable), because of error during request sending (attempt=2)
[Mon Feb 21 13:49:35 2011] [2921:3075307264] [error] ajp_service::jk_ajp_common.c (2212): (worker1) Connecting to tomcat failed. Tomcat is probably not started or is listening on the wrong port
[Mon Feb 21 13:49:35 2011] [2921:3075307264] [info] jk_handler::mod_jk.c (2364): Service error=-3 for worker=worker1
Parece haver um problema com a porta 9081, nenhum processo está usando, então eu suponho que ela esteja configurada incorretamente. Embora minha porta tomcat funcione bem.
ickronia:/var/log/at_jk# telnet localhost 9081
Trying ::1...
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
ickronia:/var/log/at_jk#
Pelo que eu posso dizer, não há um negócio engraçado, pois os logs apache2, tomcat e mod_jk são verdes; No entanto, sempre que eu navego para um jsp, ele simplesmente exibe o javascript.
Não sei ao certo qual é o problema, mesmo despejando os logs e a documentação para ajuda. Eu sou um novato no mundo do servelet.