使用 JMeter + Maven 和 https 协议 [英] Using JMeter + Maven with https protocol

查看:29
本文介绍了使用 JMeter + Maven 和 https 协议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在努力使 https 请求与 JMeter+Maven 一起工作.整个场景是 - 启动应用程序 URL > 登录应用程序(这是 https)> 在主页上(这是 http)

我使用 JMeter 的 HTTP 代理记录了这些测试.然后按照指定此处将采样器的HTTP请求协议"更改为https">

现在,当我执行测试表单 Maven 时,我遇到以下异常 JMeter 日志 -

2010/09/08 16:25:38 错误 - jmeter.util.JsseSSLManager:发生异常 java.lang.NullPointerException在 org.apache.jmeter.util.SSLManager.getKeyStore(SSLManager.java:132)在 org.apache.jmeter.util.JsseSSLManager.getContext(JsseSSLManager.java:141)在 org.apache.jmeter.util.JsseSSLManager.(JsseSSLManager.java:88)在 sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)在 sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)在 sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)在 java.lang.reflect.Constructor.newInstance(Constructor.java:513)在 org.apache.jmeter.util.SSLManager.getInstance(SSLManager.java:231)在 org.apache.jmeter.protocol.http.sampler.HTTPSampler.setupConnection(HTTPSampler.java:148)在 org.apache.jmeter.protocol.http.sampler.HTTPSampler.sample(HTTPSampler.java:404)在 org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:658)在 org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:647)在 org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:247)在 java.lang.Thread.run(Thread.java:619)2010/09/08 16:25:38 信息-jmeter.util.JsseSSLManager:已安装 JsseSSLManager2010/09/08 16:25:38 警告 - jmeter.protocol.http.sampler.HTTPSampler:您可能忘记在 jmeter.properties java.lang.IllegalStateException 中设置 ssl.provider 属性:SSLContextImpl 未初始化在 com.sun.net.ssl.internal.ssl.SSLContextImpl.engineGetSocketFactory(SSLContextImpl.java:145)在 javax.net.ssl.SSLContext.getSocketFactory(SSLContext.java:260)在 com.sun.net.ssl.SSLContextSpiWrapper.engineGetSocketFactory(SSLSecurity.java:365)在 com.sun.net.ssl.SSLContext.getSocketFactory(SSLContext.java:168)在 org.apache.jmeter.util.JsseSSLManager.setContext(JsseSSLManager.java:101)在 org.apache.jmeter.protocol.http.sampler.HTTPSampler.setupConnection(HTTPSampler.java:160)在 org.apache.jmeter.protocol.http.sampler.HTTPSampler.sample(HTTPSampler.java:404)在 org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:658)在 org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:647)在 org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:247)在 java.lang.Thread.run(Thread.java:619)

另外一件事,当我从 JMeter 本身执行这些测试时,我没有遇到任何异常.但是从 Maven 中调用 test 会导致这个问题

你们有没有能够使用 JMeter+Maven 在 https 上成功执行测试

提前致谢塔伦K

解决方案

是的 jmeter 使用 https 我能够通过 maven 和 https 进行 jemter 测试,尝试使用 keytool 将证书添加到 server.xml 指向的 cacerts

I have been trying hard to make https request work with JMeter+Maven. Whole Scenarios is - Lauch app URL > login to app (this is https) > on Home page (this is http)

I recorded these tests using HTTP Proxy of JMeter. And then as specified here changed the "HTTP request protocol" of sampler to "https"

Now when I execute the test form Maven I encounter following exception JMeter log -

2010/09/08 16:25:38 ERROR - jmeter.util.JsseSSLManager: Exception occurred java.lang.NullPointerException
at org.apache.jmeter.util.SSLManager.getKeyStore(SSLManager.java:132)
at org.apache.jmeter.util.JsseSSLManager.getContext(JsseSSLManager.java:141)
at org.apache.jmeter.util.JsseSSLManager.<init>(JsseSSLManager.java:88)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.apache.jmeter.util.SSLManager.getInstance(SSLManager.java:231)
at org.apache.jmeter.protocol.http.sampler.HTTPSampler.setupConnection(HTTPSampler.java:148)
at org.apache.jmeter.protocol.http.sampler.HTTPSampler.sample(HTTPSampler.java:404)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:658)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:647)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:247)
at java.lang.Thread.run(Thread.java:619)

 2010/09/08 16:25:38 INFO  - jmeter.util.JsseSSLManager: JsseSSLManager installed 
 2010/09/08 16:25:38 WARN  - jmeter.protocol.http.sampler.HTTPSampler: You may have forgotten to set the ssl.provider property in jmeter.properties java.lang.IllegalStateException: SSLContextImpl is not initialized
at com.sun.net.ssl.internal.ssl.SSLContextImpl.engineGetSocketFactory(SSLContextImpl.java:145)
at javax.net.ssl.SSLContext.getSocketFactory(SSLContext.java:260)
at com.sun.net.ssl.SSLContextSpiWrapper.engineGetSocketFactory(SSLSecurity.java:365)
at com.sun.net.ssl.SSLContext.getSocketFactory(SSLContext.java:168)
at org.apache.jmeter.util.JsseSSLManager.setContext(JsseSSLManager.java:101)
at org.apache.jmeter.protocol.http.sampler.HTTPSampler.setupConnection(HTTPSampler.java:160)
at org.apache.jmeter.protocol.http.sampler.HTTPSampler.sample(HTTPSampler.java:404)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:658)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:647)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:247)
at java.lang.Thread.run(Thread.java:619)

One more thing when I execute these tests from JMeter itself then I don't encounter any exception. But invocation of test from with in Maven causes this problem

Have u guys ever been able to execute test successfully on https using JMeter+Maven

Thanks in advance Tarun K

解决方案

Yes jmeter works with https i am able to get through jemter tests with maven and https, try adding the certificate to cacerts pointed by server.xml using keytool

这篇关于使用 JMeter + Maven 和 https 协议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆