Jmeter - Java.Net.SocketException

时间:2014-05-23 14:56:34

标签: jmeter socketexception

我在Web应用程序上运行Jmeter脚本,该应用程序托管在IIS上并使用ADFS身份验证机制。 对于Jmeter中的每个请求,由于“Java.Net.SocketException”而失败。

我所做的是: 使用HTTP身份验证管理器从CSV数据配置元素为每个用户提供凭据。但似乎Jmeter还没有登录。

遵循Jmeter HTTP授权管理器的文档,但看起来它没有登录到应用程序

在Jmeter日志文件中 - 我看是:

org.apache.commons.httpclient.auth.AuthChallengeProcessor: ntlm authentication scheme selected 
2014/05/22 16:34:22 INFO  - org.apache.commons.httpclient.HttpMethodDirector: No credentials available for NTLM <any realm>@DomainName:PortNumber ..
2014/05/22 16:34:31 INFO  - jmeter.protocol.http.sampler.HTTPHC4Impl: HTTP request retry count = 1 
2014/05/22 16:34:31 INFO  - jmeter.protocol.http.sampler.HTTPHC4Impl: Setting up HTTPS TrustAll scheme 
2014/05/22 16:34:32 INFO  - org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl$4: I/O exception (java.net.SocketException) caught when processing request: Connection reset 
2014/05/22 16:34:32 INFO  - org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl$4: Retrying request 
2014/05/22 16:34:32 INFO  - org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl$4: I/O exception (java.net.SocketException) caught when processing request: Connection reset 
2014/05/22 16:34:32 INFO  - org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl$4: Retrying request 
_________________
java.net.SocketException: Connection reset
    at sun.reflect.GeneratedConstructorAccessor64.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection$10.run(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection$10.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.net.www.protocol.http.HttpURLConnection.getChainedException(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    at java.net.HttpURLConnection.getResponseCode(Unknown Source)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(Unknown Source)
    at org.apache.jmeter.protocol.http.sampler.HTTPJavaImpl.readResponse(HTTPJavaImpl.java:264)
    at org.apache.jmeter.protocol.http.sampler.HTTPJavaImpl.sample(HTTPJavaImpl.java:520)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:62)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1088)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1077)
    at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:428)
    at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.net.SocketException: Connection reset
    at java.net.SocketInputStream.read(Unknown Source)
    at java.net.SocketInputStream.read(Unknown Source)
    at sun.security.ssl.InputRecord.readFully(Unknown Source)
    at sun.security.ssl.InputRecord.read(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.readDataRecord(Unknown Source)
    at sun.security.ssl.AppInputStream.read(Unknown Source)
    at java.io.BufferedInputStream.fill(Unknown Source)
    at java.io.BufferedInputStream.read1(Unknown Source)
    at java.io.BufferedInputStream.read(Unknown Source)
    at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
    at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
    at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)

由于身份验证失败,是否会发生上述异常?

请建议您解决此问题。

提前致谢!!

2 个答案:

答案 0 :(得分:0)

您的HTTP Authorization Manager

配置可能不正确

根据AD FS 2.0: How to Change the Local Authentication Type,ADFS可以配置为支持以下身份验证类型:

  1. 集成Windows身份验证(IWA) - NTLM或Kerberos
  2. 基于表单的身份验证(FBA)
  3. 传输层安全客户端身份验证
  4. 基本身份验证
  5. 点1和4可以通过HTTP授权管理器处理。有关操作方法,请参阅Windows Authentication with Apache JMeter指南。

    点2可以通过相关性来处理(即Regular Expression Extractor

    第3点我相信可以通过Keystore Configuration

    处理

答案 1 :(得分:0)

经过几天的故障排除 - 我发现由于登录失败,我的每个请求都失败了。

因此,当Jmeter登录失败时,它不会获得响应中的安全令牌,并且每个请求都会将安全令牌作为cookie发送。

因此,当那个cookie为空时,服务器要求提供凭证,而Jmeter请求由于Java.Net.SocketException而失败。

示例安全令牌是 -

Cookie数据:

Token=Vodu/2j9Hg5Z59PxJ3qAGMGOqFUrcGezGku3X6xn8QYMPdgxfVGEY+IPeO3PwPTDep0DaahTZflE+9UTE426w3p/pp1EiwL0IyJ5lkmIaQUz6byZX0+sEUnUoDhhr+ej5Myu2xkoICDfhwR5XSlBw53OlO9L7rLr/rbFK+JXkS/OKQydShS9J2eULIwy1RgXZaqLi/zn5KlNxaF/vnM9j/TECcPUfcq3nQaCornwXetxIhtWCQfZYZBh57iypzyreqnm6VRS93FNkjq8jQ4XYWZ2BA4xlrLhkXmZCcsTNQ2M2TEJfieFMwOHvTEdQcZ4WZVTvCccgv2YFkA2vcM2tnm9Fi6gQuiOR5lDYutat7zHoskQ1bCeJbeNUL2NO7Ixu/4l9Btoxoj2+E/ceP44RAYwDLVFingMLwpajKKTQHBN64gTEkfJg5VzBTpsIs7k+XnJsvNhS4ZzUXbtdPM9yyeO5nVhFQPFST6i/9zxt0kPCN4tfU0GjLp5jNkXca/hMZEyxv0vxSSnaPoNVbmd7sougchupFWyfRVDZg0oq34EU1BK57H7Jwcficliv3EO3alTDGihtEwjdjCH187L2YfEUXqum3uGurccsAwk0M/GUsUWAZQzziDnvH+weK9yV5hvUEEyIVBc4ja8WrtxMBT+Opfr1VZbD3nKtT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cV6OdfejlyJ7mUfAeGIis2e1CW0VlBj24YX+I9rLG5+bT04iFYganpGmEjpqSW4Et60oFYd3zVRurwdUz2qGz6JPdu3WyrLzkUnvEh3+zDxZqnbbKbpYFQXQrkm97oBQjNDjs9uWKnz7TjPET1qlLMksDgr/dfDmspzOXNyxtncFB7po9hyfSreNJ9oZcTJ77Q3RjgxzZa8tny5MQxzKHpzaBmUDjBMGGfqRpR6bjMe98/5bxgdMitVEcUHxWBQP/gTmFWSmHVoorFvpL1G0GIRdNDC7q8B6JcLoScPEK8EYyt/S9Lsf8TfOKxjU0hrptZ3k8NxCIGnQpU2/n2hJhLV5DodP2aYknZ0KEgzO9IuoVbcFMcnhTahnJm6mynr5GWUzEcgZ5FhuinhiuhOB79XdXm+6Z9kp8FdFGgxctJd2U72; .ASPXAUTH=E2EF9B7E3395B09FE1988C1A20BA2DD5A395FF15E40C5BA0C078038D799CC8A234602A4788565EBB30804E91154713FBB8E935FF1868871697C6B9681F8D181F2104BDDDAF645A87307FE7B6434D2F749BA6684F49E301FDA40703D0C8B4CAFBE2837D1BB84EE7A0DA66ABA5D61D074EBC985CBA6C5F3E94053878E4AD942393A71F5563259F4A584C3789F523174B3B