Details
-
Type:
Bug
-
Status: Done
-
Priority:
Low
-
Resolution: Cannot Reproduce
-
Affects Version/s: 6.15.0, 6.19.0
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Critical Points:0
Description
Sending a custom email from Script Console resulting in the following error:
java.util.ServiceConfigurationError: javax.mail.Provider: Provider com.sun.mail.imap.IMAPProvider not found
However, this only happens on Jira 8.10.0+.
Steps to Reproduce
- Install Jira 8.10.0+ and the latest version of ScriptRunner
- Send an email using this script on Script Console
- Hits "IMAPProvider class not found" error
Workaround
Manually add the class to the current thread with the code below as per this community post:
// Rest of the imports import com.atlassian.mail.server.SMTPMailServer; // Rest of the codes ClassLoader threadClassLoader = Thread.currentThread().getContextClassLoader() Thread.currentThread().setContextClassLoader(SMTPMailServer.class.classLoader) mailServer.send(email) Thread.currentThread().setContextClassLoader(threadClassLoader)
After running the script above and successfully sent an email, using back the old script seems to be working fine up until Jira is restarted.
Basically, the steps are:
- Send an email for the first time - Error
- Add the thread code - Worked
- Removed the thread code - Worked
- Restart Jira - Error again
- Then back to step 2
Additional Info
- Jira 8.9.1 - Working fine.
- Jira 8.10.0 & 8.13.2 - Error.