工作中项目一直放在测试环境中测试,但最近在正式环境中,有一次与同事联调的过程中,Tomcat 服务器出现异常,百思不得其解,之前一直正常的 Tomcat 出现异常,服务器窗口不间断输出 org.apache.coyote.ajp.AjpMessage.processHeader Invalid message received with signature 5635,但我并没有对服务器配置进行修改过,what?
如下为 Tomcat 服务器的报错信息
123-Jul-2019 14:28:43.711 信息 [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. 23-Jul-2019 14:28:50.039 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory D:tomcatwebappsQYWeixinyh has finished in 9,907 ms 23-Jul-2019 14:28:50.086 信息 [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-apr-17000"] 23-Jul-2019 14:28:50.101 信息 [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-apr-8096"] 23-Jul-2019 14:28:50.101 信息 [main] org.apache.catalina.startup.Catalina.start Server startup in 10852 ms 23-Jul-2019 14:28:50.148 严重 [ajp-apr-8096-exec-7] org.apache.coyote.ajp.AjpMessage.processHeader Invalid message received with signature 5635 23-Jul-2019 14:28:50.164 严重 [ajp-apr-8096-exec-6] org.apache.coyote.ajp.AjpMessage.processHeader Invalid message received with signature 5635 23-Jul-2019 14:28:50.164 严重 [ajp-apr-8096-exec-5] org.apache.coyote.ajp.AjpMessage.processHeader Invalid message received with signature 5635 23-Jul-2019 14:28:50.164 严重 [ajp-apr-8096-exec-3] org.apache.coyote.ajp.AjpMessage.processHeader Invalid message received with signature 5635 23-Jul-2019 14:28:50.164 严重 [ajp-apr-8096-exec-4] org.apache.coyote.ajp.AjpMessage.processHeader Invalid message received with signature 5635 23-Jul-2019 14:28:50.164 严重 [ajp-apr-8096-exec-7] org.apache.coyote.ajp.AjpMessage.processHeader Invalid message received with signature 5635 23-Jul-2019 14:28:50.164 严重 [ajp-apr-8096-exec-2] org.apache.coyote.ajp.AjpMessage.processHeader Invalid message received with signature 5635 23-Jul-2019 14:28:50.164 严重 [ajp-apr-8096-exec-10] org.apache.coyote.ajp.AjpMessage.processHeader Invalid message received with signature 5635 23-Jul-2019 14:28:50.164 严重 [ajp-apr-8096-exec-1] org.apache.coyote.ajp.AjpMessage.processHeader Invalid message received with signature 5635 23-Jul-2019 14:28:50.164 严重 [ajp-apr-8096-exec-9] org.apache.coyote.ajp.AjpMessage.processHeader Invalid message received with signature 5635 23-Jul-2019 14:28:50.164 严重 [ajp-apr-8096-exec-8] org.apache.coyote.ajp.AjpMessage.processHeader Invalid message received with signature 5635 23-Jul-2019 14:28:50.164 严重 [ajp-apr-8096-exec-2] org.apache.coyote.ajp.AjpMessage.processHeader Invalid message received with signature 5635 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
自 Server startup in 10852 ms 启动之后,持续不间断的输出严重的报错信息,通过浏览器访问 Tomcat/conf/Server.xml 配置的端口也无法访问,通过报错信息追踪,问题产生于这一配置
<Connector port="8096" protocol="AJP/1.3" redirectPort="8443"/>
而在 Stack Overflow 中,对于 AjpMessage.processHeader 问题的记录并不多, 对于配置的修改则为将 AJP/1.3 替换为 HTTP/1.1,但这个修改对 5635 报错并没有起作用,反而会引起其他的报错信息。
对此,修改了如下配置便解决了一直输出端口严重错误的问题:
<Connector port="8096" protocol="AJP/1.3" address="127.0.0.1" redirectPort="8443"/>
添加 address 属性,将地址指向本地服务器,关于 address 属性,官方文档 也有具体说明,在默认的情况下,此端口将用于与服务器关联的所有IP地址,指定本地则免去暴露的危险,这个情况早在 Tomcat7 时就有出现,而此处使用 Tomcat8 也在启动时进行检测,避免该情况发生。
鉴于以上配置和今天遇到的一下log打印的错误,错误号各有不同
运行tomcat最后在窗口打印出 Invalid message received with signature 18245这个错误,只是写了一个简单的demo,最后百度了一通,说是Tomcat的Ajp端口8009,外网访问的原因,如果没有指定IP地址的话,默认是绑定任意地址,这样就导致外网也可以访问这个端口。因此出于安全考虑,我们需要增加这个address的设置,并且绑定到127.0.0.1,结果如下:<Connector port="8009" protocol="AJP/1.3" address="127.0.0.1" redirectPort="8443" />,修改的目录是tomcat下的conf/server.xml文件,里面找一下port=‘8009’的那一行,添加address="127.0.0.1"。
八月 19, 2020 3:56:01 下午 org.apache.coyote.ajp.AjpMessage processHeader
严重: Invalid message received with signature 356
八月 19, 2020 3:56:02 下午 org.apache.coyote.ajp.AjpMessage processHeader
严重: Invalid message received with signature 12420
八月 19, 2020 3:56:03 下午 org.apache.coyote.ajp.AjpMessage processHeader
严重: Invalid message received with signature 12300
八月 19, 2020 3:56:03 下午 org.apache.coyote.ajp.AjpMessage processHeader
严重: Invalid message received with signature 20304
八月 19, 2020 3:56:05 下午 org.apache.coyote.ajp.AjpMessage processHeader
严重: Invalid message received with signature 21582
八月 19, 2020 3:56:05 下午 org.apache.coyote.ajp.AjpMessage processHeader
严重: Invalid message received with signature 768
八月 19, 2020 3:56:06 下午 org.apache.coyote.ajp.AjpMessage processHeader
严重: Invalid message received with signature 17517
八月 19, 2020 3:56:07 下午 org.apache.coyote.ajp.AjpMessage processHeader
严重: Invalid message received with signature 14848
八月 19, 2020 3:56:08 下午 org.apache.coyote.ajp.AjpMessage processHeader
严重: Invalid message received with signature 17481
八月 19, 2020 3:56:08 下午 org.apache.coyote.ajp.AjpMessage processHeader
严重: Invalid message received with signature 19026
八月 19, 2020 3:56:09 下午 org.apache.coyote.ajp.AjpMessage processHeader
严重: Invalid message received with signature 256
八月 19, 2020 3:56:10 下午 org.apache.coyote.ajp.AjpMessage processHeader
严重: Invalid message received with signature 15392
八月 19, 2020 3:56:11 下午 org.apache.coyote.ajp.AjpMessage processHeader
严重: Invalid message received with signature 256
八月 19, 2020 3:56:11 下午 org.apache.coyote.ajp.AjpMessage processHeader
严重: Invalid message received with signature 90
八月 19, 2020 3:56:12 下午 org.apache.coyote.ajp.AjpMessage processHeader
严重: Invalid message received with signature 21365
八月 19, 2020 3:56:12 下午 org.apache.coyote.ajp.AjpMessage processHeader
严重: Invalid message received with signature 20853
八月 19, 2020 3:56:13 下午 org.apache.coyote.ajp.AjpMessage processHeader
严重: Invalid message received with signature 1284
八月 19, 2020 3:56:14 下午 org.apache.coyote.ajp.AjpMessage processHeader
严重: Invalid message received with signature 1025
八月 19, 2020 3:56:15 下午 org.apache.coyote.ajp.AjpMessage processHeader
严重: Invalid message received with signature 4609
八月 19, 2020 3:56:16 下午 org.apache.coyote.ajp.AjpMessage processHeader
严重: Invalid message received with signature 18501
八月 19, 2020 3:56:16 下午 org.apache.coyote.ajp.AjpMessage processHeader
严重: Invalid message received with signature 29556
八月 19, 2020 3:56:16 下午 org.apache.coyote.ajp.AjpMessage processHeader
严重: Invalid message received with signature 0
八月 19, 2020 3:56:17 下午 org.apache.coyote.ajp.AjpMessage processHeader
严重: Invalid message received with signature 0
八月 19, 2020 3:56:17 下午 org.apache.coyote.ajp.AjpMessage processHeader
严重: Invalid message received with signature 450
八月 19, 2020 3:56:17 下午 org.apache.coyote.ajp.AjpMessage processHeader
严重: Invalid message received with signature 17260
八月 19, 2020 3:56:18 下午 org.apache.coyote.ajp.AjpMessage processHeader
严重: Invalid message received with signature 15360
八月 19, 2020 4:02:02 下午 org.apache.coyote.ajp.AjpMessage processHeader
严重: Invalid message received with signature 5635
八月 19, 2020 5:53:00 下午 org.apache.coyote.ajp.AjpMessage processHeader
严重: Invalid message received with signature 5635
八月 19, 2020 5:53:00 下午 org.apache.coyote.ajp.AjpMessage processHeader
严重: Invalid message received with signature 18245
八月 19, 2020 5:53:01 下午 org.apache.coyote.ajp.AjpMessage processHeader
严重: Invalid message received with signature 5635
八月 19, 2020 5:53:01 下午 org.apache.coyote.ajp.AjpMessage processHeader
严重: Invalid message received with signature 18245