Connection Jira cloud instance fails for jira macro

Hi all,

I have a local xwiki installation and installed the Jira macro and the Jira Administration extensions.

In the extension, I have defined the desired jira instance (cloud version).

I have set id (“main”), username and password. I am (probably) having trouble setting the propert URL. I have tried

https://MYSITE.atlassian.net

as well as

https://MYSITE.atlassian.net/jira

but when using the macro like below, I get an error message:

{{jira id="main"}}
MYPROJECT-1234
{{/jira}}

The message reads

Failed to execute the JIRA macro. Cause: [Content is not allowed in prolog.]. Click on this message for details.

I assume either the URL is wrong (credentials are correct) or I need to enable some settings within the Jira cloud instance?

What am I missing?

Thank you in advance
best regards!

Hi, could you click on the message as mentioned and provide the details?

You could also open your browser dev tools and find the URL called on your jira instance and open a browser tab and paste that URL to see what’s the problem. And report it here with the URL that’s been generated.

Thanks

Hi,

clicking on the message does not do anything, strangely?

Also, in the network tab of my dev tools I cannot find a call to *.atlassian.net, which I would expect if the call was made client-side, right?

Perhaps there’s some other misconfiguration problem?

Thank you for your help!

if you get “Content is not allowed in prolog” then it means the URL has been called IMO. Also you should be able to click for sure. Inspect the HTML DOM with your browser dev tool to see the details.

Thanks

Is this an ajax call or is it loaded server-side, I wonder, as I cannot find a request made from my browser. However: while the message is not clickable, you are right, it’s in the dom (project and site names changed of course):

org.xwiki.rendering.macro.MacroExecutionException: Failed to retrieve JIRA data from [https://mysite.atlassian.net] for JQL [issueKey in (MYPROJECT-13070)]
	at org.xwiki.contrib.jira.macro.internal.source.AbstractJIRADataSource.getXMLDocument(AbstractJIRADataSource.java:96)
	at org.xwiki.contrib.jira.macro.internal.source.ListJIRADataSource.getData(ListJIRADataSource.java:78)
	at org.xwiki.contrib.jira.macro.internal.JIRAMacro.execute(JIRAMacro.java:87)
	at org.xwiki.contrib.jira.config.internal.AsyncJIRAMacro.executeCodeMacro(AsyncJIRAMacro.java:92)
	at org.xwiki.contrib.jira.config.internal.JIRABlockAsyncRenderer.execute(JIRABlockAsyncRenderer.java:110)
	at org.xwiki.rendering.async.internal.block.AbstractBlockAsyncRenderer.render(AbstractBlockAsyncRenderer.java:157)
	at org.xwiki.rendering.async.internal.block.AbstractBlockAsyncRenderer.render(AbstractBlockAsyncRenderer.java:54)
	at org.xwiki.rendering.async.internal.AsyncRendererJob.runInternal(AsyncRendererJob.java:109)
	at org.xwiki.job.AbstractJob.runInContext(AbstractJob.java:243)
	at org.xwiki.job.AbstractJob.run(AbstractJob.java:220)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: org.jdom2.input.JDOMParseException: Error on line 1: Content is not allowed in prolog.
	at org.jdom2.input.sax.SAXBuilderEngine.build(SAXBuilderEngine.java:232)
	at org.jdom2.input.sax.SAXBuilderEngine.build(SAXBuilderEngine.java:253)
	at org.jdom2.input.SAXBuilder.build(SAXBuilder.java:1091)
	at org.xwiki.contrib.jira.macro.internal.source.HTTPJIRAFetcher.retrieveRemoteDocument(HTTPJIRAFetcher.java:108)
	at org.xwiki.contrib.jira.macro.internal.source.HTTPJIRAFetcher.fetch(HTTPJIRAFetcher.java:73)
	at org.xwiki.contrib.jira.macro.internal.source.AbstractJIRADataSource.getXMLDocument(AbstractJIRADataSource.java:94)
	... 12 more
Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.
	at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
	at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
	at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
	at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
	at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
	at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentScannerImpl$PrologDispatcher.dispatch(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
	at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
	at org.jdom2.input.sax.SAXBuilderEngine.build(SAXBuilderEngine.java:217)
	... 17 more

Server side. The stack trace doesn’t help much, it just says that the XML returned by your JIRA instance for that URL doesn’t contain valid XML. There’s probably an error. Maybe your instance is not public and you need to provide credentials, etc.

So you need to find the URL but indeed it doesn’t show up in the browser network tab since it’s not a client side request but one done server side…

I checked the source code and the URL is:

https://mysite.atlassian.net/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?jqlQuery=issueKey in (MYPROJECT-13070)

Can you try opening it in your browser to see what you get?

Exactly, the site is hosted directly by atlassian and cannot be accessed without user credentials. When logging in to the site with the same credentials I apply in the Jira Administration module, I initially got a

XSRF Security Token Missing

message.

Upon “Retry operation” (which seems to regenerate the token) I receive an rss xml file which probably is what the module expects to be delivered.

Apparently some kind of access configuration issue then.

Sorry for getting back so late, but I was on vacation.

I thought form token checking for Jira could be disabled, but apparently this is no longer true since Jira 5.X. So the problem still persists for accessing Jira tasks from within xWiki

I am surely not the only one using the cloud hosted version of Jira, so any ideas of what I may be missing?

Cheers
Arngrim

hmm I don’t see any existing jira issue regarding this at https://jira.xwiki.org/issues/?jql=project%20%3D%20"JIRA%20Components"%20%20AND%20resolution%20%3D%20Unresolved

Maybe you could report a new issue with the max details in the description and links to the jira documentation explaining how authentication should be done by jira clients?

Thanks

I am using a cloud version of Jira as well and im getting a similar error.

Any updates on this? I can’t seem to find any relevant issues in Jira.

Thanks.

I unfortunately did not find the time yet to gather the information to setup the JIRA task for this.

Unfortunately therefore up until now this is still not functional for me.

For the Jira cloud, an API token is needed instead of the password, in the password field of the XWiki Jira config from the administration section. The token can be created from Atlassian account.

Hope it helps,
Alex