【问题标题】:Gateway Time_out issue between AJP connector and Tomcat 8.5.54AJP 连接器和 Tomcat 8.5.54 之间的网关超时问题
【发布时间】:2020-08-20 04:40:39
【问题描述】:

我在 debian 9.12 (stretch) 系统上有一个 Apache 2 (2.4.25) 前端的 tomcat 8 服务器,我在 apache2 和 tomcat 之间使用 ajp 连接器。 JDK版本为Oracle JDK 1.8.0_252-8u252-b09-1~deb9u1-b09。一切正常,直到 tomcat8 自动更新到 8.5.54。但是现在通过 ajp 访问应用程序时出现 504 超时网关错误。

tomcat8服务器今天早上自动更新了

Start-Date: 2020-05-05  06:01:41
Commandline: /usr/bin/unattended-upgrade
Upgrade: libservlet3.1-java:amd64 (8.5.50-0+deb9u1, 8.5.54-0+deb9u1),
libtomcat8-java:amd64 (8.5.50-0+deb9u1, 8.5.54-0+deb9u1),
tomcat8-examples:amd64 (8.5.50-0+deb9u1, 8.5.54-0+deb9u1),
tomcat8-admin:amd64 (8.5.50-0+deb9u1, 8.5.54-0+deb9u1),
tomcat8-common:amd64 (8.5.50-0+deb9u1, 8.5.54-0+deb9u1), tomcat8:amd64
(8.5.50-0+deb9u1, 8.5.54-0+deb9u1), tomcat8-docs:amd64 (8.5.50-0+deb9u1,
8.5.54-0+deb9u1)
End-Date: 2020-05-05  06:01:52

apache2 和 tomcat8 配置文件没有任何变化。我仍然可以访问 tomcat 管理器界面,并且可以看到我的应用程序正在运行。我可以通过 localhost 访问 tomcat 应用程序,但不能通过 apache2 服务器。

例如,我在 tomcat8 服务器上部署了应用程序QCM1。如果我执行以下wget 命令

wget http://localhost:8080/QCM1

响应是正确的,但是当我执行时

wget http://myserve.mydomain.fr/QCM1

出现 504 网关超时错误

要启用将 HTTP 请求重定向到 tomcat 服务器,在 apache2 配置文件中有以下指令(该指令在 tomcat8 更新之前工作)

ProxyPass /QCM1 ajp://localhost:8009/QCM1

我错过了什么? 感谢您的帮助。

【问题讨论】:

    标签: java apache tomcat


    【解决方案1】:

    我终于找到了解决办法,错误的堆栈跟踪是:

    05-May-2020 16:29:01.292 GRAVE [main]
    org.apache.catalina.core.StandardService.startInternal Failed to start connector [Connector[AJP/1.3-8009]]
    org.apache.catalina.LifecycleException: Le démarrage du gestionnaire de protocole a échoué 
    at org.apache.catalina.connector.Connector.startInternal(Connector.java:1086)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:440)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:766)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:688)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:343)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:474)
    

    解决此问题的解决方案是更改 server.xml 文件中 AJP 连接器的配置并添加 secretRequired 属性,正如 Jainender Chauhan 在他对 Springboot -The AJP Connector is configured with secretRequired="true" but the secret attribute is either null or "" after upgrade to 2.2.5 的回复中所建议的那样

    <Connector protocol="AJP/1.3" port="8009" redirectPort="8443" secretRequired="false" />
    

    它工作正常。但我不确定这是最好、最安全的处理方式

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-02
      • 1970-01-01
      • 2021-06-14
      • 2017-02-25
      相关资源
      最近更新 更多