我正在尝试加载测试从归档数据库中获取记录的java servlet .
servlet的工作原理如下:
-
1 - 从HTTP标头中读取变量
-
2 - 使用变量查询数据库
-
3 - 返回XML
我已经设置了一个测试,我希望使用post变量触发HTTP请求,但测试不起作用,J Meter出错 .
Screenshot 1 - Shows the structure of the test
Screenshot 2 - Shows the CSV file I am reading from
我已将CSV文件放在保存测试计划的同一文件夹中!
Screenshot 3 - Shows the HTTP request
This is the error output:
线程名称:线程组1-1示例开始时间:2012-11-20 10:35:27 GMT加载时间:0延迟:0大小(字节):1113标头大小(字节):0主体大小(字节):1113样本计数: 1错误计数:1响应代码:非HTTP响应代码:java.net.URISyntaxException响应消息:非HTTP响应消息:索引13处IPv6地址的预期结束括号:http:// [http://sophos1.testserver.co .uk / servlet / archive]:61061 /响应头:HTTPSampleResult字段:ContentType:DataEncoding:null
POST Request
POST http://[http://sophos1.testserver.co.uk/servlet/archive]:61061/
POST data:
[no cookies]
Returned DATA
java.net.URISyntaxException: Expected closing bracket for IPv6 address at index 13: http://[http://sophos1.testserver.co.uk/servlet/archive]:61061/
at java.net.URI$Parser.fail(Unknown Source)
at java.net.URI$Parser.failExpecting(Unknown Source)
at java.net.URI$Parser.parseServer(Unknown Source)
at java.net.URI$Parser.parseAuthority(Unknown Source)
at java.net.URI$Parser.parseHierarchical(Unknown Source)
at java.net.URI$Parser.parse(Unknown Source)
at java.net.URI.<init>(Unknown Source)
at java.net.URL.toURI(Unknown Source)
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:232)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:62)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1075)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1064)
at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:426)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:255)
at java.lang.Thread.run(Unknown Source)
请帮忙!
谢谢
3 回答
检查
ServerName
或IP
字段中是否有空格 .这给了我这个错误:
当在开始时修剪额外的空间时,它运作良好 .
从HTTP请求采样器的服务器名称/ IP字段中删除
http://
(指向HTTP Request fields description) .查看上面描述的生成的POST请求:
请将HTTP请求配置为以下内容:
简单的方法是您可以将服务器名称留空并将路径设置为