Hi,
I am creating a plugin which automatically creates an issue upon receiving a custom email. Upon adding the issue to the JIRA instance, the exception below is logged. I notice that the exception only occurs when certain custom fields are added to the issue.
2015-08-19 16:43:03,319 atlassian-scheduler-quartz1.clustered_Worker-2 ERROR anonymous QC_email-handler [tutorial.jira.mailhandlerdemo.MailHandler] com.atlassian.jira.workflow.WorkflowException: Error occurred while creating issue. This could be due to a plugin being incompatible with this version of JIRA. For more details please consult the logs, and see: http://confluence.atlassian.com/x/3McB 2015-08-19 16:43:03,320 atlassian-scheduler-quartz1.clustered_Worker-2 ERROR anonymous QC_email-handler [tutorial.jira.mailhandlerdemo.MailHandler] com.atlassian.jira.issue.managers.DefaultIssueManager.createIssue(DefaultIssueManager.java:671) com.atlassian.jira.issue.managers.DefaultIssueManager.createIssueObject(DefaultIssueManager.java:776) com.atlassian.jira.service.util.handler.DefaultMessageHandlerContext.createIssueWithIssueManager(DefaultMessageHandlerContext.java:261) com.atlassian.jira.service.util.handler.DefaultMessageHandlerContext.createIssue(DefaultMessageHandlerContext.java:154) com.atlassian.jira.service.services.mail.DelegatingMessageHandlerContext.createIssue(DelegatingMessageHandlerContext.java:48) com.example.plugins.tutorial.jira.mailhandlerdemo.MailHandler.handleMessage(MailHandler.java:214) com.atlassian.jira.service.services.mail.MailFetcherService$1.process(MailFetcherService.java:438) com.atlassian.jira.service.services.mail.MailFetcherService$MessageProviderImpl.getAndProcessMail(MailFetcherService.java:304) com.atlassian.jira.service.services.mail.MailFetcherService.runImpl(MailFetcherService.java:426) com.atlassian.jira.service.services.file.AbstractMessageHandlingService.run(AbstractMessageHandlingService.java:263) com.atlassian.jira.service.JiraServiceContainerImpl.run(JiraServiceContainerImpl.java:66) com.atlassian.jira.service.ServiceRunner.runService(ServiceRunner.java:77) com.atlassian.jira.service.ServiceRunner.runServiceId(ServiceRunner.java:54) com.atlassian.jira.service.ServiceRunner.runJob(ServiceRunner.java:37) com.atlassian.scheduler.core.JobLauncher.runJob(JobLauncher.java:136) com.atlassian.scheduler.core.JobLauncher.launchAndBuildResponse(JobLauncher.java:101) com.atlassian.scheduler.core.JobLauncher.launch(JobLauncher.java:80) com.atlassian.scheduler.quartz1.Quartz1Job.execute(Quartz1Job.java:32) org.quartz.core.JobRunShell.run(JobRunShell.java:223) org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549) 2015-08-19 16:43:03,320 atlassian-scheduler-quartz1.clustered_Worker-2 ERROR anonymous
Below is a code snippet of the problem. The code loops through all my custom fields and adds them to the issue.
for(CustomFieldValue customField : customFieldIds){ if(issueMap.containsKey(customField.getType())){ try{ CustomField myCustomField = cfm.getCustomFieldObject(customField.getID()); //cfm is the CustomFieldManager issue.setCustomFieldValue(myCustomField,issueMap.get(customField.getType()));//issue is a MutableIssue }catch(Exception e){ LOG.error("Error Found: " + e.getMessage()); } } } context.createIssue(reporter,issue);
Upon debugging it was confirmed that the problematic custom fields have the correct values. Moreover it is important to note that the issue is created without any problems when the mentioned custom fields are not set. Finally, the custom field ID is always given correctly to the CustomFieldManager (cfm).
The JIRA version is 6.4.9.
Thanks!
Community moderators have prevented the ability to post new answers.
Looks like a ClassCastException occurs inside WorkflowManager.createIssue(). Try debugger maybe to track down the cause for that. There should be an exception chain printed with a stack trace, what does the error handling in your mail handler look like?
Through logging I could understand that a CreateException is thrown from the MessageHandlerContext context. The stacktrace obtained is shown in the first code snippet above. What is baffling about the problem is that only a select few custom fields are problematic and cause error.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.