Open ashishprajapat2 opened 6 years ago
Which version of Jenkins are you using? What is the URI to create the JenkinsServer object? What is the content of the HttpResponseException (statusCode, message)?
Jenkins version: 2.121.2 URI is the Jenkins host address (https://*****.com) Status: 500
Is there any message in the Jenkins log that explains the 500 error?
it was saying "Internal Server Error" . Now i am using Rest APIs directly.
even getJobs can trigger this issue... This problem troubling me
at com.offbytwo.jenkins.client.validator.HttpResponseValidator.validateResponse(HttpResponseValidator.java:11) at com.offbytwo.jenkins.client.JenkinsHttpClient.get(JenkinsHttpClient.java:152) at com.offbytwo.jenkins.JenkinsServer.getJobs(JenkinsServer.java:169) at com.offbytwo.jenkins.JenkinsServer.getJobs(JenkinsServer.java:127)
got same 500 error
I do have the same issue with a current Jenkins. Any update on this or information I can provide? I see it directly when fetching the getJobs. The request works fine when doing in the browser, but the browser asks for the login. It is a default jenkins with the admin user/password provided through the environment (the Kubernetes Helm chart from the official repository). If I disable the security, then everyhing works fine.
@remmeier @chongye89 I have same issue related to createJob() method with/without crumb. I am not able to figure out what is causing this exception. I am getting 403 forbidden :
Exception in thread "main" org.apache.http.client.HttpResponseException: status code: 403, reason phrase: Forbidden
at com.offbytwo.jenkins.client.validator.HttpResponseValidator.validateResponse(HttpResponseValidator.java:11)
at com.offbytwo.jenkins.client.JenkinsHttpClient.post_xml(JenkinsHttpClient.java:375)
at com.offbytwo.jenkins.JenkinsServer.createJob(JenkinsServer.java:389)
at com.hcl.OffByTwoJenkins.main(OffByTwoJenkins.java:46)
I am using below code to create job:
HttpClientBuilder builder = HttpClientBuilder.create();
JenkinsHttpClient client = new JenkinsHttpClient(uri, addAuthentication(builder, uri, userName, passwordOrToken));
JenkinsServer jenkins = new JenkinsServer(client);
String sourceXML = readFile("src/main/resources/config.xml");
System.out.println(String.format("Installed Jenkins Version >> %s", jenkins.getVersion().getLiteralVersion()));
jenkins.createJob(null,"test-nov1", sourceXML,false);
nothing worked for me so far. If any one of you are able to resolve, please help me too to overcome this issue. However @remmeier said, if I select option "any user can do any thing" in /configSecurity then it is working fine. I want when "Any logged in user can do any thing" option is selected in jenkins security and this should work.
org.apache.http.client.HttpResponseException: at com.offbytwo.jenkins.client.validator.HttpResponseValidator.validateResponse(HttpResponseValidator.java:11) at com.offbytwo.jenkins.client.JenkinsHttpClient.post(JenkinsHttpClient.java:261) at com.offbytwo.jenkins.client.JenkinsHttpClient.post(JenkinsHttpClient.java:221) at com.offbytwo.jenkins.model.Job.build(Job.java:88)
Getting HTTP HttpResponseException for every API except getVersion(). Below is the exception i am getting: org.apache.http.client.HttpResponseException: at com.offbytwo.jenkins.client.validator.HttpResponseValidator.validateResponse(HttpResponseValidator.java:11) at com.offbytwo.jenkins.client.JenkinsHttpClient.get(JenkinsHttpClient.java:152) at com.offbytwo.jenkins.JenkinsServer.getJobs(JenkinsServer.java:169) at com.offbytwo.jenkins.JenkinsServer.getJobs(JenkinsServer.java:127) at Jenkins.main(Jenkins.java:70) I am just creating the JenkinsServer Object using the URI and username and password and hitting the methods, But getting the above exception. Seems like it is failing at validating the API. Please Help.