I am trying to connect to JIRA using jira-java-client(provided by atlassian)

Ashish_Ranjan
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 18, 2020

CODE DETAILS: Here is my build.gradle file(app level)

apply plugin: 'com.android.application'

android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.appautomation"
minSdkVersion 15
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
testImplementation group: 'junit', name: 'junit', version: '4.12'
testImplementation group: 'io.appium', name: 'java-client', version: '6.1.0'
testImplementation group: 'org.testng', name: 'testng', version: '6.14.3'

// https://mvnrepository.com/artifact/com.atlassian.jira/jira-rest-java-client-core
implementation group: 'com.atlassian.jira', name: 'jira-rest-java-client-core', version: '5.1.1-e0dd194'
// https://mvnrepository.com/artifact/com.atlassian.jira/jira-rest-java-client-api
implementation group: 'com.atlassian.jira', name: 'jira-rest-java-client-api', version: '5.1.1-e0dd194'

// https://mvnrepository.com/artifact/io.atlassian.fugue/fugue
compileOnly group: 'io.atlassian.fugue', name: 'fugue', version: '4.7.2'

// https://mvnrepository.com/artifact/org.slf4j/slf4j-simple
testImplementation group: 'org.slf4j', name: 'slf4j-simple', version: '2.0.0-alpha1'

// https://mvnrepository.com/artifact/com.atlassian.httpclient/atlassian-httpclient-api
implementation group: 'com.atlassian.httpclient', name: 'atlassian-httpclient-api', version: '0.23.2'

}

And this is my Java code for connection and fetching an issue

import com.atlassian.jira.rest.client.api.JiraRestClient;
import com.atlassian.jira.rest.client.internal.async.AsynchronousJiraRestClientFactory;
import java.net.URI;
import java.net.URISyntaxException;

import io.atlassian.util.concurrent.Promise;
import utils.LogUtils;

public class JiraIntegration {
private final String EMAIL = "rahul.vig@jifflenow.com";
private final String USERNAME = EMAIL;
private final String PASSWORD = "DHPfuy5LaNH9uijTeeqO203E";

public void jiraConnectionSetup() throws URISyntaxException {
try {
final URI jiraServerURI = new URI("https://jirajifflenow.atlassian.net/");
final JiraRestClient jiraRestClient = new AsynchronousJiraRestClientFactory().createWithBasicHttpAuthentication(jiraServerURI, USERNAME, PASSWORD);
Promise issuePromise = jiraRestClient.getIssueClient().getIssue("MOBILE-2773");
LogUtils.setInfo("Here is you Issue" + issuePromise);
} catch (ExceptionInInitializerError e) {
LogUtils.setError("Error happened " + e.getCause());
e.printStackTrace();
}

}
}

 ERROR 

Exception in thread "main" java.lang.ExceptionInInitializerError
at com.atlassian.httpclient.apache.httpcomponents.ApacheAsyncHttpClient.getRegistry(ApacheAsyncHttpClient.java:233)
at com.atlassian.httpclient.apache.httpcomponents.ApacheAsyncHttpClient.<init>(ApacheAsyncHttpClient.java:158)
at com.atlassian.httpclient.apache.httpcomponents.ApacheAsyncHttpClient.<init>(ApacheAsyncHttpClient.java:102)
at com.atlassian.httpclient.apache.httpcomponents.DefaultHttpClientFactory.doCreate(DefaultHttpClientFactory.java:61)
at com.atlassian.httpclient.apache.httpcomponents.DefaultHttpClientFactory.create(DefaultHttpClientFactory.java:36)
at com.atlassian.jira.rest.client.internal.async.AsynchronousHttpClientFactory.createClient(AsynchronousHttpClientFactory.java:65)
at com.atlassian.jira.rest.client.internal.async.AsynchronousJiraRestClientFactory.create(AsynchronousJiraRestClientFactory.java:36)
at com.atlassian.jira.rest.client.internal.async.AsynchronousJiraRestClientFactory.createWithBasicHttpAuthentication(AsynchronousJiraRestClientFactory.java:42)
at JiraTest.createJiraRestClient(JiraTest.java:27)
at JiraTest.setup(JiraTest.java:12)
at SuiteBuilder.main(SuiteBuilder.java:20)
Caused by: java.lang.RuntimeException: Stub!
at org.apache.http.conn.ssl.AbstractVerifier.<init>(AbstractVerifier.java:57)
at org.apache.http.conn.ssl.AllowAllHostnameVerifier.<init>(AllowAllHostnameVerifier.java:54)
at org.apache.http.nio.conn.ssl.SSLIOSessionStrategy.<clinit>(SSLIOSessionStrategy.java:67)
... 11 more

 I have looked in for this issue but didn't got any promising result.

Let me know what I am missing the implementation.

0 answers

Suggest an answer

Log in or Sign up to answer