Unknown protocol error when testing a website in jmeter - jmeter

When I tried to test a website. The test result was like this:
Thread Name: Test new22 1-1
Sample Start: 1970-01-01 05:30:00 IST
Load time: 0
Connect Time: 0
Latency: 0
Size in bytes: 841
Sent bytes:0
Headers size in bytes: 0
Body size in bytes: 841
Sample Count: 1
Error Count: 1
Data type ("text"|"bin"|""): text
Response code: Non HTTP response code: java.net.MalformedURLException
Response message: Non HTTP response message: unknown protocol: stagingblueridge.com
HTTPSampleResult fields:
ContentType:
DataEncoding: null
Kindly anybody help me to resolve the above issue...

Related

Promtail: "error sending batch, will retry" status=500

when starting the promtail client, it gives an error:
component=client host=loki:3100 msg="error sending batch, will retry" status=500 error="server returned HTTP status 500 Internal Server Error (500): rpc error: code = ResourceExhausted desc = grpc: received message larger than max (6780207 vs. 4194304)"
promtail config
server:
http_listen_port: 9080
grpc_listen_port: 0
positions:
filename: /tmp/positions.yaml
clients:
- url: 'http://loki:3100/loki/api/v1/push'
scrape_configs:
- job_name: server-log
pipeline_stages:
static_configs:
- targets:
- localhost
labels:
job: server-log
__path__: /opt/log/*.log
__path_exclude__: /opt/log/jck_*,*.log
I tried to start changing limits on the server, and run promtail with parameters:
/usr/local/bin/promtail-linux-amd64 -config.file=/etc/config-promtail.yml -server.grpc-max-recv-msg-size-bytes 16777216 -server.grpc-max-concurrent-streams 0 -server.grpc-max-send-msg-size-bytes 16777216 -limit.readline-rate-drop -client.batch-size-bytes 2048576
But judging by what I found, this is a grpc protocol error, or rather, in the size of the transmitted message, where the maximum is 4 mb
Changing the server parameters, not the client, solved the problem
server:
http_listen_port: 3100
grpc_listen_port: 9096
grpc_server_max_recv_msg_size: 8388608
grpc_server_max_send_msg_size: 8388608
limits_config:
ingestion_rate_mb: 15
ingestion_burst_size_mb: 30
per_stream_rate_limit: 10MB
per_stream_rate_limit_burst: 20MB
reject_old_samples: true
reject_old_samples_max_age: 168h
retention_period: 744h
max_query_length: 0h

RestTemplate vs Postman: Identical in Wireshark but only one works

I'm trying to recreate a request that works in Postman using a Spring RestTemplate. I've tried to make the requests identical, down to the fake "User-Agent" header, but for whatever reason the one from Postman returns 200 OK and the one from RestTemplate returns 301 Moved.
What could I possibly be doing wrong?
Both requests are below, "anonymized" by removing the urls and session cookie, both of which are identical - confirmed by copying one and searching the other.
This is the working request from Postman.
Frame 1541: 638 bytes on wire (5104 bits), 638 bytes captured (5104 bits) on interface en0, id 0
Transmission Control Protocol, Src Port: 51102, Dst Port: 80, Seq: 573, Ack: 840, Len: 572
Hypertext Transfer Protocol
POST <removed> HTTP/1.1\r\n
User-Agent: Java/17.0.2\r\n
Accept: text/plain, application/json, application/*+json, */*\r\n
Content-Type: application/x-www-form-urlencoded; charset=UTF-8\r\n
Cookie: JSESSIONID="<removed>"\r\n
Host: <removed>\r\n
Connection: keep-alive\r\n
Content-Length: 63\r\n
\r\n
[Full request URI: <removed>
[HTTP request 2/2]
[Prev request in frame: 1373]
[Response in frame: 1596]
File Data: 63 bytes
HTML Form URL Encoded: application/x-www-form-urlencoded
Form item: "<removed>" = "<removed>"
Key: <removed>
Value: <removed>
This is the failing request using RestTemplate.
Frame 3365: 129 bytes on wire (1032 bits), 129 bytes captured (1032 bits) on interface en0, id 0
Transmission Control Protocol, Src Port: 51110, Dst Port: 80, Seq: 509, Ack: 1, Len: 63
[2 Reassembled TCP Segments (571 bytes): #3363(508), #3365(63)]
Hypertext Transfer Protocol
POST <removed> HTTP/1.1\r\n
User-Agent: Java/17.0.2\r\n
Accept: text/plain, application/json, application/*+json, */*\r\n
Content-Type: application/x-www-form-urlencoded;charset=UTF-8\r\n
Cookie: JSESSIONID="<removed>"\r\n
Host: <removed>\r\n
Connection: keep-alive\r\n
Content-Length: 63\r\n
\r\n
[Full request URI: <removed>
[HTTP request 1/1]
[Response in frame: 3377]
File Data: 63 bytes
HTML Form URL Encoded: application/x-www-form-urlencoded
Form item: "<removed>" = "<removed>"
Key: <removed>
Value: <removed>

How to fix 401 Unauthorized issue in jmeter

Thread Name: Thread Group 1-1
Sample Start: 2019-02-08 15:51:46 IST
Load time: 1412
Connect Time: 525
Latency: 1412
Size in bytes: 1508
Sent bytes:603
Headers size in bytes: 843
Body size in bytes: 665
Sample Count: 1
Error Count: 1
Data type ("text"|"bin"|""): text
Response code: 401
Response message: Unauthorized
Response headers:
HTTP/1.1 401 Unauthorized
Public-Key-Pins-Report-Only: pin-sha256="9n0izTnSRF+W4W4JTq51avSXkWhQB8duS2bxVLfzXsY="; pin-sha256="5kJvNEMw0KjrCAu7eXY5HZdvyCS13BbA0VJG1RSP91w="; pin-sha256="njN4rRG+22dNXAi+yb8e3UMypgzPUPHlv4+foULwl1g="; max-age=86400; includeSubDomains; report-uri="https://a.forcesslreports.com/hpkp-report/00Dq0000000DFMbm";
Expect-CT: max-age=0; report-uri="https://a.forcesslreports.com/Expect-CT-report/00Dq0000000DFMbm";
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Content-Security-Policy: upgrade-insecure-requests
Referrer-Policy: origin-when-cross-origin
Cache-Control: no-cache,must-revalidate,max-age=0,no-store,private
Content-Type: text/html;charset=UTF-8
Expires: Thu, 01 Jan 1970 00:00:00 GMT
X-Powered-By: Salesforce.com ApexPages
P3P: CP="CUR OTR STA"
Transfer-Encoding: chunked
Looking into JMeter – Logging Into Salesforce for Automated Testing article you need to extract session id dynamic parameter from the very first request (Log In). The process is known as correlation
The Session ID parameter can be extracted using XPath Extractor, the relevant configuration would be something like:
The server rejects the request with a “401 Unauthorized” error because your app needs to be authorized. Usually Authentication request returns this value. So, you need to extract this token from the answer.
Add Cookie Manager to your Test Plan.
Add Regular Expressions Extractor to your auth request to Extract auth token to variable and send its value to the next request (where you get error) with
This guide also could be helpful how to test authentification with JMeter

Java issues on Jmeter

I have tried some scripting using jmeter, but I am getting issues.
Thread Name: Thread Group 1-1
Sample Start: 2014-02-10 13:57:36 IST
Load time: 1229
Latency: 0
Size in bytes: 1880
Headers size in bytes: 0
Body size in bytes: 1880
Sample Count: 1
Error Count: 1
Response code: Non HTTP response code: org.apache.http.conn.HttpHostConnectException
Response message: Non HTTP response message: Connection to http://wwwe.google.com refused
Response headers:
HTTPSampleResult fields:
ContentType:
DataEncoding: null
Please help me o this issue
You have a wrong url, change it by http://www.google.com

JMeter - Trouble sending HTTP request with POST variable?

I am trying to load test a java servlet that fetches records from an archive database.
The servlet works as follows:
1-Reads in post variables from HTTP header
2-Uses variables to query database
3-Returns XML
I have setup a test which I want to fire off HTTP requests with post variables however the test is not working, getting errors with J Meter.
Screenshot 1 - Shows the structure of the test
Screenshot 2 - Shows the CSV file I am reading from
I have placed the CSV file in the same folder that my test plan is saved in!
Screenshot 3 - Shows the HTTP request
This is the error output:
Thread Name: Thread Group 1-1 Sample Start: 2012-11-20 10:35:27 GMT
Load time: 0 Latency: 0 Size in bytes: 1113 Headers size in bytes: 0
Body size in bytes: 1113 Sample Count: 1 Error Count: 1 Response code:
Non HTTP response code: java.net.URISyntaxException Response message:
Non HTTP response message: Expected closing bracket for IPv6 address
at index 13:
http://[http://sophos1.testserver.co.uk/servlet/archive]:61061/
Response headers:
HTTPSampleResult fields: 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)
Please help!
Thanks
Remove http:// from Server Name / IP field of your HTTP Request Sampler (that's pointed in HTTP Request fields description).
Look onto your generated POST request above in description:
POST Request
POST http://[http://sophos1.testserver.co.uk/servlet/archive]:61061/
Configure your HTTP Request as the following instead:
Server Name: sophos1.testserver.co.uk
Path: /servlet/archive
Implementation: Java
The easy way is that you could leave the server name blank and set the path to
http://sophos1.testserver.co.uk/servlet/archive
Check if there are any spaces in ServerName or IP field.
This gave me this error :
Response message: Non HTTP response message: Illegal character in
authority at index 7:
When extra spaces were trimmed in the beginning, it worked well.

Resources