关于tomcat:JMeter-AJP Sampler失败,并显示非HTTP响应消息

JMeter - AJP Sampler failed with Non HTTP response message

我尝试遵循AJP Sampler教程,除了我按照建议使用Tomcat 7而不是9并使用eclipse和maven tomcat插件运行tomcat

当我使用有效的POST请求定义AJP Sampler时,出现错误,原因为

具有8009端口:

1
2
Response code: Non HTTP response code: java.net.ConnectException
Response message: Non HTTP response message: Connection refused: connect

具有8080端口(如在常规HTTP请求中一样):

1
2
Response code: Non HTTP response code: java.io.IOException
Response message: Non HTTP response message: Connection Closed: -1

是否需要在tomcat中定义其他配置以允许AJP请求?


tomcat插件中默认未启动AJP连接器:

ajpPort int 2.0 The AJP port to run the Tomcat server on. By default it's 0 this means won't be started. The ajp connector will be started only for value > 0. Will be exposed as System props and session.executionProperties with key tomcat.maven.ajp.port

在pom.xml中添加ajpPort修复了问题

1
8009</ajpPort>