Apache没有在workers.properties上使用所需的端口

时间:2015-10-14 09:56:36

标签: apache tomcat debian mod-jk

我们已将Apache配置为通过AJP默认8009的不同端口重定向到tomcat实例。它仅适用于默认端口,但它不能与我们在worker.properties上设置的那个(8109)一起使用这是我们的场景

/ etc / apache2上的worker.properties

  JCoDestination destination = JCoDestinationManager.getDestination("");
  try
  {
      JCoContext.begin(destination);
      function.execute(destination)
      function.execute(destination)
  } 
  catch (AbapException ex)
  {
         ...
  } 
  catch (JCoException ex)
  {
         ...
  }  
  catch (Exception ex)
  {
         ...
  }
  finally
  {
      JCoContext.end(destination);
  }
/usr/share/instance-tomcat-7.0.42/sacmimexico/conf /

上的

server.xml

worker.list=sacmimexico
# Set properties for sacmimexico
worker.sacmimexico.type=ajp13
worker.sacmimexico.host=localhost
worker.sacmimexico.port=8109
/ var / log / apache2

上的

mod_jk.log

<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8109" protocol="AJP/1.3" redirectPort="8143" />

jk.conf / etc / apache2 / mods-available

[Wed Oct 14 05:29:18 2015] [17752:140024424515392] [info] init_jk::mod_jk.c (3189): mod_jk/1.2.30 initialized
[Wed Oct 14 05:29:18 2015] [17753:140024424515392] [info] init_jk::mod_jk.c (3189): mod_jk/1.2.30 initialized
[Wed Oct 14 05:29:22 2015] [17757:140024328361728] [info] jk_open_socket::jk_connect.c (622): connect to 127.0.0.1:8009 failed (errno=111)
[Wed Oct 14 05:29:22 2015] [17757:140024328361728] [info] ajp_connect_to_endpoint::jk_ajp_common.c (959): Failed opening socket to (127.0.0.1:8009) (errno=111)
[Wed Oct 14 05:29:22 2015] [17757:140024328361728] [error] ajp_send_request::jk_ajp_common.c (1585): (sacmimexico) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=111)
[Wed Oct 14 05:29:22 2015] [17757:140024328361728] [info] ajp_service::jk_ajp_common.c (2540): (sacmimexico) sending request to tomcat failed (recoverable), because of error during request sending (attempt=1)
[Wed Oct 14 05:29:22 2015] [17757:140024328361728] [info] jk_open_socket::jk_connect.c (622): connect to 127.0.0.1:8009 failed (errno=111)
[Wed Oct 14 05:29:22 2015] [17757:140024328361728] [info] ajp_connect_to_endpoint::jk_ajp_common.c (959): Failed opening socket to (127.0.0.1:8009) (errno=111)
[Wed Oct 14 05:29:22 2015] [17757:140024328361728] [error] ajp_send_request::jk_ajp_common.c (1585): (sacmimexico) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=111)
[Wed Oct 14 05:29:22 2015] [17757:140024328361728] [info] ajp_service::jk_ajp_common.c (2540): (sacmimexico) sending request to tomcat failed (recoverable), because of error during request sending (attempt=2)
[Wed Oct 14 05:29:22 2015] [17757:140024328361728] [error] ajp_service::jk_ajp_common.c (2559): (sacmimexico) connecting to tomcat failed.
[Wed Oct 14 05:29:22 2015] sacmimexico 199.187.122.163 0.100588
[Wed Oct 14 05:29:22 2015] [17757:140024328361728] [info] jk_handler::mod_jk.c (2618): Service error=-3 for worker=sacmimexico

默认位于/ etc / apache2 / sites-available

<IfModule mod_jk.c>
 JkWorkersFile "/etc/apache2/workers.properties"
 JkLogFile "/var/log/apache2/mod_jk.log"
 JkLogLevel info
 JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
 JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
 JkRequestLogFormat "%w %V %T"
</IfModule>

版本:

Apache 2:Apache / 2.2.16(Debian)

Tomcat 7:Apache Tomcat / 7.0.42

mod-jk:1.2.30-1squeeze1

我们知道Tomcat正在使用该端口8109 谁知道发生了什么?

由于

阿尔伯特

2 个答案:

答案 0 :(得分:0)

由于编辑错误,问题是在workers.properties上错误的carachters。 我用cat -A workers.properties检查它,然后从头开始创建一个新的。

答案 1 :(得分:0)

我遇到了同样的问题。解决此问题的方法是将AJP端口更改为其他范围。在我的CentOS / Red Hat中,端口8109被SELinux阻止了。所以我在woker.proberties以及Tomcat server.xml上将AJP端口更改为81。因此问题得到解决。