简体   繁体   English

AJP 连接器和 Tomcat 8.5.54 之间的网关超时问题

[英]Gateway Time_out issue between AJP connector and Tomcat 8.5.54

I have a tomcat 8 server fronted by Apache 2 (2.4.25) on debian 9.12 (stretch) system and I'm using ajp connector between apache2 an tomcat. I have a tomcat 8 server fronted by Apache 2 (2.4.25) on debian 9.12 (stretch) system and I'm using ajp connector between apache2 an tomcat. JDK version is Oracle JDK 1.8.0_252-8u252-b09-1~deb9u1-b09. JDK版本为Oracle JDK 1.8.0_252-8u252-b09-1~deb9u1-b09。 Everything was working fine until tomcat8 automatically updated to 8.5.54.一切正常,直到 tomcat8 自动更新到 8.5.54。 But now when accesing application through ajp there is a 504 time-out Gateway error.但是现在通过 ajp 访问应用程序时出现 504 超时网关错误。

The tomcat8 server was automatically updated this morning 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

Nothing changed in the apache2 and tomcat8 configuration file. apache2 和 tomcat8 配置文件没有任何变化。 I can still acces the tomcat manager interface and I can see my applications running.我仍然可以访问 tomcat 管理器界面,并且可以看到我的应用程序正在运行。 I can acces the tomcat applications with localhost, but not through the apache2 server.我可以使用 localhost 访问 tomcat 应用程序,但不能通过 apache2 服务器。

For example, I have the application QCM1 deployed on the tomcat8 server.例如,我在 tomcat8 服务器上部署了应用程序QCM1 If I perform the following wget command如果我执行以下wget命令

wget http://localhost:8080/QCM1

the response is correct, but when I perform响应是正确的,但是当我执行

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

there is 504 Gateway Time-out error出现 504 网关超时错误

To enable redirection of HTTP request to the tomcat server, there is the following directive in the apache2 configuration file (that directive was working fie before the update of tomcat8)要启用将 HTTP 请求重定向到 tomcat 服务器,apache2 配置文件中有以下指令(该指令在 tomcat8 更新之前有效)

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

What am I missing?我错过了什么? Thanks for your help.谢谢你的帮助。

Finally I've found a solution, the stack trace of the error was:最后我找到了一个解决方案,错误的堆栈跟踪是:

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)

a solution to fix this problem was to change the configuration of the AJP connector in the server.xml file and to add a secretRequired attribute as Jainender Chauhan suggested in his response to Springboot -The AJP Connector is configured with secretRequired="true" but the secret attribute is either null or "" after upgrade to 2.2.5解决此问题的解决方案是更改server.xml文件中 AJP 连接器的配置,并添加一个secretRequired属性,正如 Jainender Chauhan 在他对Springboot 的响应中所建议的那样 - AJP 连接器配置为 secretRequired="true" 但升级到 2.2.5 后,机密属性为 null 或“”

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

It works fine.它工作正常。 But I'm not sure it's the best and the most secure way of proceeding但我不确定这是最好和最安全的处理方式

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM