1

我正在使用 Jmeter 3.0 进行负载测试 API。我正在使用 Maven-Jmeter 插件来运行我的负载测试。目前使用 com.lazerycode.jmeter 插件版本 2.0.3。测试在我的本地机器上运行良好,但是当我通过 Jenkins 运行它时,我得到“非 HTTP 响应代码:javax.net.ssl.SSLHandshakeException”。我已经用谷歌搜索并尝试了各种论坛中建议的几乎所有内容,但错误并没有消失。我错过了什么?任何帮助表示赞赏。

请参阅下面的错误堆栈。

httpSample t="1069" it="0" lt="0" ts="1485212600015" s="false" lb="ServiceProxy:TC#1: GET-  Health Check For Proxy Service" **rc="Non HTTP response code: javax.net.ssl.SSLHandshakeException" rm="Non HTTP response message: Received fatal alert: handshake_failure"** tn="Service Proxy Regression Test Plan 1-1" dt="text" by="2566" ng="1" na="1">

****** received  : [[[Non HTTP response code: javax.net.ssl.SSLHandshakeException]]]

****** comparison: [[[200                                                        ]]]

class="java.lang.String">javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:154)
    at sun.security.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1979)
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1086)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1332)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1359)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1343)
    at org.apache.http.conn.ssl.SSLSocketFactory.createLayeredSocket(SSLSocketFactory.java:573)
    at org.apache.http.conn.ssl.SSLSocketFactory.createLayeredSocket(SSLSocketFactory.java:447)
    at org.apache.jmeter.protocol.http.sampler.LazySchemeSocketFactory.createLayeredSocket(LazySchemeSocketFactory.java:121)
    at org.apache.http.impl.conn.DefaultClientConnectionOperator.updateSecureConnection(DefaultClientConnectionOperator.java:219)
    at org.apache.http.impl.conn.ManagedClientConnectionImpl.layerProtocol(ManagedClientConnectionImpl.java:421)
    at org.apache.jmeter.protocol.http.sampler.MeasuringConnectionManager$MeasuredConnection.layerProtocol(MeasuringConnectionManager.java:152)
    at org.apache.http.impl.client.DefaultRequestDirector.establishRoute(DefaultRequestDirector.java:815)
    at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:616)
    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:447)
    at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:884)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
    at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.executeRequest(HTTPHC4Impl.java:619)
    at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:379)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1146)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1135)
    at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:465)
    at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:410)
    at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:241)
    at java.lang.Thread.run(Thread.java:745)

...

4

2 回答 2

1

我能够解决这个问题。这是解决方案:

1)我正在使用 maven-jmeter 插件和 maven-jmeter 分析插件。简单来说,通过 maven 项目运行 jmeter。要解决 SSLHandshakeException 问题,请将您的 maven 命令放在“执行 Shell”区域,而不是 jenkins 作业中的“目标”区域。我还将命令更改为“mvn -B -f ./pom.xml verify -s settings.xml”。

但是,在执行 #1 之后,我看到我的性能测试运行了两次。所以我遵循了解决方案#2。

2)我在jenkins中使用了一个freestyle项目而不是maven项目。我把命令放在“执行shell”区域。我收到“cmd 失败”错误。这是由于在奴隶上使用了旧版本的 maven。我指定了我想在 slave 上使用的 maven 的确切版本,并且一切正常。

这是它的样子:

export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export PATH=$JAVA_HOME/bin:$PATH
export http_proxy=http://example.com:8080
export HTTP_PROXY=http://example.com:8080
export https_proxy=http://example.com:8080
export HTTPS_PROXY=http://example.com:8080


/usr/share/maven-3.3.9/bin/mvn -B -f ./pom.xml verify -s settings.xml -DSERVICE_P_NUM_OF_USERS=1 -DSERVICE_P_RAMP_UP_TIME=1 
于 2017-01-27T18:56:16.587 回答
0

我已经看到了这个错误。然后我发现错误是由于 Jenkins-slave 的 java 版本造成的。升级java版本,看看是否有帮助。

于 2017-01-24T14:10:07.330 回答