Jira Ticketing setup help

jira
ticketing
#1

My organisation is looking at migrating to Jira Service desk, so I 'm trying to configure the Jira Plugin to test how we get alerts raised.

my jira.properties is as follows:

jira.host=https://testing-xray.atlassian.net/
jira.username=USERNAME
jira.password=PASSWORD
jira.project=VIC
jira.type=10014
jira.resolve=Resolve
jira.reopen=Reopen Issue
jira.status.open=OPEN,WORK In PROGRESS
jira.status.closed=CLOSED
jira.status.cancelled=CANCELED

But when I test from karaf with jira:verify, I get an error “Error executing command: Could not connect to jira server”

the karaf.kog file shows the following:

2019-05-07T01:39:31,901 ERROR org.apache.karaf.shell.core:4.1.5(47) [Karaf ssh console user null] org.apache.karaf.shell.support.ShellUtil: Exception caught while executing command
java.lang.RuntimeException: Could not connect to jira server
	at org.opennms.netmgt.ticketer.jira.commands.VerifyCommand.verifyConnection(VerifyCommand.java:182) [312:org.opennms.features.jira-troubleticketer:23.0.4]
	at org.opennms.netmgt.ticketer.jira.commands.VerifyCommand.execute(VerifyCommand.java:71) [312:org.opennms.features.jira-troubleticketer:23.0.4]
	at org.opennms.netmgt.ticketer.jira.commands.VerifyCommand.doExecute(VerifyCommand.java:86) [312:org.opennms.features.jira-troubleticketer:23.0.4]
	at org.apache.karaf.shell.console.AbstractAction.execute(AbstractAction.java:34) [47:org.apache.karaf.shell.core:4.1.5]
	at org.apache.karaf.shell.console.OsgiCommandSupport.execute(OsgiCommandSupport.java:41) [47:org.apache.karaf.shell.core:4.1.5]
	at org.apache.karaf.shell.commands.basic.AbstractCommand.execute(AbstractCommand.java:34) [47:org.apache.karaf.shell.core:4.1.5]
	at org.apache.karaf.shell.compat.CommandTracker$1.execute(CommandTracker.java:120) [47:org.apache.karaf.shell.core:4.1.5]
	at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) [47:org.apache.karaf.shell.core:4.1.5]
	at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) [47:org.apache.karaf.shell.core:4.1.5]
	at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:571) [47:org.apache.karaf.shell.core:4.1.5]
	at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:497) [47:org.apache.karaf.shell.core:4.1.5]
	at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:386) [47:org.apache.karaf.shell.core:4.1.5]
	at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:417) [47:org.apache.karaf.shell.core:4.1.5]
	at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) [47:org.apache.karaf.shell.core:4.1.5]
	at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) [47:org.apache.karaf.shell.core:4.1.5]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
	at java.lang.Thread.run(Thread.java:748) [?:?]
Caused by: java.util.concurrent.ExecutionException: RestClientException{statusCode=Optional.of(401), errorCollections=[]}
	at com.google.common.util.concurrent.AbstractFuture$Sync.getValue(AbstractFuture.java:299) ~[?:?]
	at com.google.common.util.concurrent.AbstractFuture$Sync.get(AbstractFuture.java:286) ~[?:?]
	at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:116) ~[?:?]
	at com.google.common.util.concurrent.ForwardingFuture.get(ForwardingFuture.java:63) ~[?:?]
	at com.atlassian.jira.rest.client.internal.async.DelegatingPromise.get(DelegatingPromise.java:102) ~[?:?]
	at org.opennms.netmgt.ticketer.jira.commands.VerifyCommand.verifyConnection(VerifyCommand.java:175) ~[?:?]
	... 18 more
Caused by: com.atlassian.jira.rest.client.api.RestClientException: org.codehaus.jettison.json.JSONException: A JSONObject text must begin with '{' at character 10 of 








<html>

<head>
    <title>Unauthorized (401)</title>
    





<!--[if IE]><![endif]-->
<script type="text/javascript" >
    var contextPath = '';
    var DeferScripts = { deferState: 'disabled' };
</script>
<script>
window.WRM=window.WRM||{};window.WRM._unparsedData=window.WRM._unparsedData||{};window.WRM._unparsedErrors=window.WRM._unparsedErrors||{};
WRM._unparsedData["com.atlassian.plugins.atlassian-plugins-webresource-plugin:context-path.context-path"]="\"\"";
WRM._unparsedData["com.atlassian.plugins.atlassian-plugins-webresource-rest:curl.cross-origin-resources"]="false";

Which looks to me like JSON data is expected but instead I’m getting HTML code saying “unauthorized”.

Is this a problem with how I have configured the Jira plugin, or an issue with the user I’m trying to connect as, or is there some other issue here?

Regards,
John

#2

Check your username/password credentials. The “401” error in the logs indicates a permissions problem.

#3

While basic auth is technically supported, the Security for other integrations page here: https://developer.atlassian.com/cloud/jira/platform/security-for-other-integrations/ informs that an api token is required, not the user’s password.

#4

So does the Opennms Jira plugin support that? The opennms Jira documentation doesnt talk about API keys. Or do I put the API token in the password field?

#5

The api token would go in the password field, which I confirmed using basic auth with postman to do a simple query.

1 Like
#6

Ok thanks. I’ll try generating an API key.

#7

I did already so you have it in a DM message in slack.

1 Like