gpt4 book ai didi

java - Jmeter记录时出错

转载 作者:太空宇宙 更新时间:2023-11-04 14:06:29 26 4
gpt4 key购买 nike

JMeter 中录制应用程序时,我在浏览器中遇到以下错误。

org.apache.http.conn.HttpHostConnectException: Connection to http://access.xyz.com refused at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:190) at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294) at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:643) at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:479) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805) at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.executeRequest(HTTPHC4Impl.java:481) at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:298) at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74) at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1105) at org.apache.jmeter.protocol.http.proxy.Proxy.run(Proxy.java:236) Caused by: java.net.ConnectException: Connection timed out: connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(Unknown Source) at java.net.PlainSocketImpl.connectToAddress(Unknown Source) at java.net.PlainSocketImpl.connect(Unknown Source) at java.net.SocksSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:127) at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180) ... 10 more

我将地址指定为 Localhost,将端口指定为 8080。我正在使用 JMeter 2.11,它对于所有其他应用程序都运行良好。仅在记录此特定应用程序时,我才会遇到上述错误。

最佳答案

您的堆栈跟踪在第一行中显示:

org.apache.http.conn.HttpHostConnectException: Connection to http://access.xyz.com refused

在堆栈跟踪后的描述中,您说该服务位于本地主机端口 8080 上。问题是您请求的 URL 后面没有服务。将您要查询的 URL 更改为:

http://localhost:8080

或者,如果您已破解 HOSTS 文件以使 access.xyz.com 解析为 localhost,那么您需要在 URL 中指定端口号,如下所示:

http://access.xyz.com:8080

如果没有 :8080,协议(protocol) http 使用默认端口 80。同样,协议(protocol) https (SSL) 的默认端口为 443。如果您使用默认端口以外的任何端口,则必须在 URL 中显式设置该端口。

关于java - Jmeter记录时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28815058/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com