I used JIRA REST client api and am running it from java main program,
This is the simple code, which Try to hit the JIRA server (JIRA 6.1)
public static void main (String args[]) {
new Main().doIt();
}
public void doIt() {
System.out.println("Start .. ");
String url = "https://jira.com";
String userName = "sdfsdfsdf";
String password = "sdfsfsfsf";
AsynchronousJiraRestClientFactory factory = new AsynchronousJiraRestClientFactory();
JiraRestClient client = factory.createWithBasicHttpAuthentication(URI.create(url), userName, password) ;
System.out.println("JiraRestClient created successfully .. ");
}
Every time when I run this program, i get "ClassNotFoundException", there by I find the dependencies and put the JAR file in my LIB folder,
While doing so, I get strange exception which is the result of HTTPCLIENT and HTTPCLIENTCACHE jar files. Below-screenshot shows the lib-files in my classpath
And the exception which I get is
Start ..
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.http.impl.client.cache.CacheConfig.setNeverCache1_0ResponsesWithQueryString(Z)V
at com.atlassian.httpclient.apache.httpcomponents.DefaultHttpClient.<init>(DefaultHttpClient.java:155)
at com.atlassian.jira.rest.client.internal.async.AsynchronousHttpClientFactory.createClient(AsynchronousHttpClientFactory.java:53)
at com.atlassian.jira.rest.client.internal.async.AsynchronousJiraRestClientFactory.create(AsynchronousJiraRestClientFactory.java:35)
at com.atlassian.jira.rest.client.internal.async.AsynchronousJiraRestClientFactory.createWithBasicHttpAuthentication(AsynchronousJiraRestClientFactory.java:41)
at com.arun.main.Main.doIt(Main.java:22)
at com.arun.main.Main.main(Main.java:13)
Can anyone suggest me on this Please ?
Found the correct Jar file that has this method. The jar file can be downloaded from the link below:
https://www.versioneye.com/java/org.apache.httpcomponents:httpclient-cache/4.2.1-atlassian-2
EDIT small clarification around this.. Even if your pom.xml doesn't have entry for this jar.. just add -
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient-cache</artifactId>
<version>4.2.1-atlassian-2</version>
</dependency>