JMeter - AJP 采样器因非 HTTP 响应消息而失败

JMeter - AJP Sampler failed with Non HTTP response message

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

当我用工作 POST 请求定义 AJP 采样器时,我收到错误

使用 8009 端口:

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

使用 8080 端口(与常规 HTTP 请求一样):

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

我是否需要在 tomcat 中定义另一个配置以允许 AJP 请求?

AJP connector 在 tomcat 插件中默认不启动:

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 解决了问题

<ajpPort>8009</ajpPort>