Hello everyone,
We've recently updated to Jira DC 8.20.7 on our Staging Environment, which comes bundled with Java 11. We're currently using Scriptrunner (Post Functions) to connect and upload documents to a SOAP service and a SR custom REST Endpoint to retrieve the documents afterwards via SOAP.
This worked nicely with javax.xml.soap, but as this is no longer bundled with Java 11, we've switched to jakarta.xml.soap from the maven repo.
However, this creates a curious error:
Inside a postfunction that is triggered manually by a user via Workflow step, we can use the jakarta SOAP classes normally. Everything works as before.
HOWEVER,
inside the Scriptrunner console, as well as inside a REST Endpoint, we get the error that the SOAP Connection Factory is not found.
jakarta.xml.soap.SOAPException: Unable to create SOAP connection factory: Error while searching for service [jakarta.xml.soap.SOAPConnectionFactory]
at jakarta.xml.soap.SOAPConnectionFactory.newInstance(SOAPConnectionFactory.java:58)
at jakarta.xml.soap.SOAPConnectionFactory$newInstance.call(Unknown Source)
So basically, the code below works in a post function when I push a workflow button, but not when I paste it into the console/REST Endpoint:
import jakarta.xml.soap.*
SOAPConnectionFactory factory = SOAPConnectionFactory.newInstance();
( no type checking errors are displayed)
How can we fix this? We extracted the jar files from the package (https://search.maven.org/artifact/jakarta.xml.ws/jakarta.xml.ws-api/4.0.0/jar ) into WEB-INF/lib - are we missing a step? Do they need to be installed properly? If yes, how?
I have so far avoided installing custom jar files in the lib directory manually.
This makes upgrades so much simpler.
What may happen here is that your library is either not correctly registered or overwritten by some other dependency.
Instead, I'd recommend you import it dynamically in your script with a grab statement;
import jakarta.xml.soap.*
@Grab(group='jakarta.xml.ws', module='jakarta.xml.ws-api', version='4.0.0')
SOAPConnectionFactory factory = SOAPConnectionFactory.newInstance();
This will download the jar file in your jira user's <home>/.m2 directory
The first time you execute, you might get an error about unable to download grape, but try again.
Beyond that, I can't help further as I'm still on java 8 and I don't think this jakarta library is available for java 8.
Hello @PD Sheehan ,
thank you very much for your quick reply!
We would have liked to avoid using custom jar files too, but unfortunately, we have literally no choice now, as the SOAP Service is not administrated by us. Out of curiosity, do you have any experience with downgrading Java, especially when it comes bundled with Jira?
We've looked at the grape solution before, but it got us a bunch of errors:
General error during conversion: Error grabbing grapes -- /home/jira/.groovy/grapes/resolved-caller-all-caller-working84.xml (Permission denied)
I'm guessing this is something our server admin might be able to resolve by changing permissions, so we'll pursue this option further. I will check back in when we know more.
Could it also be possible to directly copy the jar in the home/.m2 directory?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I always install jira from the Zip archive (in linux). I don't think that ships with a bundled java.
Maybe this kbase article can help you switch java version:https://confluence.atlassian.com/jirakb/change-the-java-version-used-by-jira-server-765594330.html
Yes if you share the grab error with your sysadmins, they should be able to help you..
I've never attempted to manually copy .m2 files. That might work if your jira can't contact and download files from the mvn repository.
But you'll still need to have the @grab statement in your script to instruct groovy to look for that package in its cache (the .m2 directory).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The SOAP and XML-RPC remote APIs features have been deprecated and removed from Jira since Jira 7.0 for Server. Hence, it would help if you used the REST protocol instead.
Please visit this Atlassian Documentation for more information.
If you still want to do it with SOAP protocol, you could refer to this Documentation and test it on the ScriptRunner Console. However, I cannot guarantee that this will work.
This question has also been discussed previously. You can visit this community discussion for more information.
Thank you and Kind regards,
Ram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Ram Kumar Aravindakshan _Adaptavist_
thank you for your quick reply.
I have to confess that you answer is slightly confusing to me - we're not using the SOAP features OF Jira, we're using Jira to access a remote SOAP webservice on a different non-Jira system. There is no REST API for this system, and it's not administered by us. We have no choice but to use SOAP.
And our problem is strictly speaking, that Scriptrunner can't use a library equally in all places. That it's a SOAP library is just for context, but I'm guessing we could have similar problems maybe with other jars?
The Documentation (baeldung.com) link mentions declaring the dependency in a pom.xml - is there an guide on how to do that when we're using Scriptrunners Custom REST Endpoints?
The question you linked is sadly not helpful, as it would require us a) to rebuild our entire rather complex script, and b) non of the user seemed to get it working.
Thank you very much,
Johanna
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Johanna Spielauer ,
Have you managed to solve your issue?
We are facing the exact same issue (following a Jira upgrade to 8.20.8, Rest Endpoint, SOAP connection error, etc.) but just with a different class (javax.xml.soap), see below the error:
javax.xml.soap.SOAPException: Unable to create SOAP connection factory: Error while searching for service [javax.xml.soap.SOAPConnectionFactory]
In addition to what you did (adding the relevant jar file to WEB-INF/lib) we also added the relevant dependency into '/opt/atlassian/jira/atlassian-jira/META-INF/maven/com.atlassian.jira/atlassian-jira-webapp', as follows:
<dependency>
<groupId>javax.xml.soap</groupId>
<artifactId>javax.xml.soap-api</artifactId>
<version>1.4.0</version>
<scope>provided</scope>
</dependency>
However, we still get the same error.
Have you tried to add the relevant dependency into the maven directory?
I'd love to hear what is your current status and if you managed in the end to overcome the issue, we are a little bit stuck right now.
@PD Sheehan I also tried to import javax.xml.soap using Grab, but my SOAP call still doesn't work.
Do you have any idea what else can be done?
Thanks,
Adiel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @adiels ,
unfortunately we were not able to solve our problem. The grab statements worked, but the error remained the same. The problem seems to lead somewhere with the SAAJ Messaging libraries, and I tried adding every library under the sun to get it working, but eventually gave up. (Curiously, when trying to re-install the jakarta library on the server, Jira wouldn't start up again..)
As we have no experience with the maven directory, we didn't try adding the dependency because we have no idea how/where.
We were considering implementing the SOAP part on a separate (non-Jira) server running older Java, and calling this server from Jira via REST - which is a truckload of work probably...
I was also considering trying to chain it somehow, because as I said, when you trigger the post function manually, it works. But that would have been a really ugly workaround.
In the end, we talked to our Atlassian consultant and they know of the problem, so we'll be paying to get it fixed. It didn't seem to be an easy fix from what I could gather, as the problem seems to be inside one of the libraries (maybe?).
I hope you find a workaround of fix on your end!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.