在 Jenkins 上使用 Maven-jmeter 插件进行负载测试给出 "Non HTTP response code: javax.net.ssl.SSLHandshakeException"
Load test using Maven-jmeter plugin on Jenkins gives "Non HTTP response code: javax.net.ssl.SSLHandshakeException"
我正在使用 Jmeter 3.0 进行负载测试 API。我正在使用 Maven-Jmeter 插件来 运行 我的负载测试。当前使用 com.lazerycode.jmeter 插件版本 2.0.3。测试 运行 在我的本地机器上很好,但是当我通过 Jenkins 运行 它时,我得到 "Non HTTP response code: 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)
...
我看到了这个错误。然后我发现错误是由于 java 版本的 Jenkins-slave。升级 java 版本,看看是否有帮助。
我能够解决问题。这是解决方案:
1) 我正在使用 maven-jmeter 插件和 maven-jmeter 分析插件。简单来说,运行 jmeter 通过 maven 项目。要解决 SSLHandshakeException 问题,请将您的 maven 命令放在 "Execute Shell" 区域而不是 jenkins 作业中的 "Goal" 区域。我还将命令更改为 "mvn -B -f ./pom.xml verify -s settings.xml".
但是,在执行#1 之后,我发现我的性能测试是 运行 两次。所以我遵循了解决方案#2。
2) 我在jenkins 中使用了一个freestyle 项目而不是maven 项目。我把命令放在 "Execute shell" 区域。我收到 'cmd fail' 错误。这是由于旧版本的 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
我正在使用 Jmeter 3.0 进行负载测试 API。我正在使用 Maven-Jmeter 插件来 运行 我的负载测试。当前使用 com.lazerycode.jmeter 插件版本 2.0.3。测试 运行 在我的本地机器上很好,但是当我通过 Jenkins 运行 它时,我得到 "Non HTTP response code: 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)
...
我看到了这个错误。然后我发现错误是由于 java 版本的 Jenkins-slave。升级 java 版本,看看是否有帮助。
我能够解决问题。这是解决方案:
1) 我正在使用 maven-jmeter 插件和 maven-jmeter 分析插件。简单来说,运行 jmeter 通过 maven 项目。要解决 SSLHandshakeException 问题,请将您的 maven 命令放在 "Execute Shell" 区域而不是 jenkins 作业中的 "Goal" 区域。我还将命令更改为 "mvn -B -f ./pom.xml verify -s settings.xml".
但是,在执行#1 之后,我发现我的性能测试是 运行 两次。所以我遵循了解决方案#2。
2) 我在jenkins 中使用了一个freestyle 项目而不是maven 项目。我把命令放在 "Execute shell" 区域。我收到 'cmd fail' 错误。这是由于旧版本的 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