Error 401 - Unauthorized when APIs executed with different Certificate in Jmeter

43 views
Skip to first unread message

Rohit Mishra

unread,
Oct 1, 2022, 11:54:51 PM10/1/22
to jmeter-...@googlegroups.com
Hi Team,

In Jmeter, I am facing an issue related to error "401 - Unauthorized" when I am trying to run different APIs which belong to different certificates in the same load test plan.

Cert Extension is: PFX or JKS

Scenario:
API1 having Cert1 with (CertName1/Password1)
API2 having Cert2 with (CertName2/Password2)
API3 Having Cert3 with (CertName3/Password3)

Current Problem: When I am trying to run using 3 beanshell preprocessor (each preprocessor has a different certname & related password), I am getting error 401 frequently for each of API's response.

Requirement: I am looking for a solution through which we can run all APIs successfully (200 OK response) within one load test plan.

Can someone assist me to resolve this problem with a demo or way to proceed ?

Regards,
Rohit

DT

unread,
Oct 2, 2022, 2:43:01 AM10/2/22
to jmeter-plugins
  1. Beanshell PreProcessors have nothing to do with client-side certificates, you should rather take a look at Keystore Configuration and CSV Data Set Config combination instead
  2. Having 3 PreProcessors for 3 users is not something you should be doing because each thread runs all pre-processors before each sampler in its scope, you should have only one preprocessor and parameterize it accordingly
  3. Since JMeter 3.1 it's not recommended to use Beanshell for scripting

Reply all
Reply to author
Forward
0 new messages