org.apache.http.client.ClientProtocolException: Unexpected response status: 403 Error

TestingXperts October 11, 2019

I recently renewed my Jira licence after getting expired, and my existing code to update test case execution in cycles fails with following error. I have verified my test id and it has not changed. Cycle Id also seems to be correct. This code used to work few days back. 

org.apache.http.client.ClientProtocolException: Unexpected response status: 403
	at jirautil.JiraUtil.updateExecutions(JiraUtil.java:293)
	at jirautil.JiraUtil.updateJiraTestResults(JiraUtil.java:246)
	at step_definitions.Hooks.afterMethodSmoke(Hooks.java:190)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at cucumber.runtime.Utils$1.call(Utils.java:40)
	at cucumber.runtime.Timeout.timeout(Timeout.java:16)
	at cucumber.runtime.Utils.invoke(Utils.java:34)
	at cucumber.runtime.java.JavaHookDefinition.execute(JavaHookDefinition.java:60)
	at cucumber.runtime.Runtime.runHookIfTagsMatch(Runtime.java:224)
	at cucumber.runtime.Runtime.runHooks(Runtime.java:212)
	at cucumber.runtime.Runtime.runAfterHooks(Runtime.java:206)
	at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:46)
	at cucumber.runtime.model.CucumberScenarioOutline.run(CucumberScenarioOutline.java:46)
	at cucumber.runtime.model.CucumberFeature.run(CucumberFeature.java:165)
	at cucumber.api.testng.TestNGCucumberRunner.runCucumber(TestNGCucumberRunner.java:63)
	at cucumber.api.testng.AbstractTestNGCucumberTests.feature(AbstractTestNGCucumberTests.java:21)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
	at org.testng.internal.Invoker.invokeMethod(Invoker.java:659)
	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:845)
	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1153)
	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
	at org.testng.TestRunner.privateRun(TestRunner.java:771)
	at org.testng.TestRunner.run(TestRunner.java:621)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:357)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:352)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:310)
	at org.testng.SuiteRunner.run(SuiteRunner.java:259)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1199)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1124)
	at org.testng.TestNG.run(TestNG.java:1032)
	at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:281)
	at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:75)
	at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:121)
	at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:290)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:242)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:121)

 

1 answer

0 votes
Charlie Misonne
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 11, 2019

403 means forbidden. A couple of thing to check?

  1. What url are you calling in your code?
  2. Have your provided basic authentication details in the http call?
  3. Are you able to login in Jira via your browser with the credentials you use in your code?
    Jira might ask you for a captcha when a lot of invalid attempts have been made.
  4. Do you have any reverse proxy in front of Jira that might respond with a 403?

Suggest an answer

Log in or Sign up to answer