• Community
  • Products
  • Marketplace Apps
  • Questions
  • Getting Error: "Error creating issue. 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"

Getting Error: "Error creating issue. 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"

Disabling the Groovyrunner plugin (https://marketplace.atlassian.com/plugins/com.onresolve.jira.groovy.groovyrunner) seemed to fix the problem. Not getting the error message anymore. Anyone else seen this before? Do you know what caused it?

We are using JIRA 5.0.4

Any help would be greatly appreciated. The plugin has a lot of features we are interested in and wish to remain using. Is there some part of it that may cause this error that we should be aware of?

6 answers

0 vote

What version of the script runner plugin are you using... maybe you need to upgrade it?

Hi Jamie,

We are using version 2.0.7 of the script runner plugin. Which seems to be the most up-to-date version (at least thats the version on the marketplace). We also have been using JIRA 5.0.4. for a while. We had the script runner enabled for at least a week or so and everything worked fine. The most recent change that we started making was using the scripts as post functions in the workflow. Could that have something to do with it?

The error it gives is a little peculiar. The link (http://confluence.atlassian.com/x/3McB) is to a page about upgrading workflow plugins for JIRA 3.2. So, I thought it might have something to do with some of the scripts that run in the workflows themselves. Any thoughts?

Thanks!

Yeah, I would say so. The exception is probably thrown by a deprecated method in your code... unless you are using the built-in scripts? If it's your code could you post it, if it's a built-in script then which one is causing the issue?

I believe we were only using the built in scripts. Specifically the custom email on transition, script field and fast-tracking an issue on transition. And most of the time these were done in the plugin itself rather than the workflows. Unfortunately I can't go in and see exactly what was wrong yet; the plugin is disabled and we are on a production instance so I can't enable it just to check. But we are looking into the log files to see if we can find anything there. So, we don't know what exactly was causing the issue.

Hrm. Well, I haven't seen that issue before. I'd recommend you try to reproduce the issue in a dev instance.

My JIRA version is 4.4 and below is my code

import static java.util.Calendar.*

def startDate = getCustomFieldValue("22/05/2013");
def endDate = getCustomFieldValue("24/06/2013");

if ((startDate == null || startDate.equals("")) || (endDate == null || endDate.equals(""))){
return 0 as Double;
}

Calendar startCal;
Calendar endCal;
startCal = Calendar.getInstance();
startCal.setTime(startDate);
endCal = Calendar.getInstance();
endCal.setTime(endDate);

def getWorkDays(Calendar startCal, Calendar endCal){
int workDays = 0;
//Return 0 if start and end are the same
if (startCal.getTimeInMillis() == endCal.getTimeInMillis()) {
++workDays;
return workDays as Double;
}

if (startCal.getTimeInMillis() > endCal.getTimeInMillis()) {
return workDays as Double;
}

while (startCal.getTimeInMillis() <= endCal.getTimeInMillis()){
// Uncomment this block to exclude Weekends and Holidays
//if (startCal.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY
// && startCal.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY
// && !isHoliday(startCal)) {
++workDays;
//}
startCal.add(Calendar.DAY_OF_MONTH, 1);
}

return workDays as Double;
}

def isHoliday(Calendar calendarDay){

def holidays = getCalendarForYear(calendarDay.get(Calendar.YEAR))

for (holiday in holidays) {
if (calendarDay.get(Calendar.YEAR) == holiday.get(Calendar.YEAR)
&& calendarDay.get(Calendar.MONTH) == holiday.get(Calendar.MONTH)
&& calendarDay.get(Calendar.DAY_OF_MONTH) == holiday.get(Calendar.DAY_OF_MONTH)){
return true;
}
}
return false;
}

def getCalendarForYear(year){
def holidays2011 = [new GregorianCalendar(2011, Calendar.SEPTEMBER, 5),
new GregorianCalendar(2011, Calendar.NOVEMBER, 24),
new GregorianCalendar(2011, Calendar.NOVEMBER, 25),
new GregorianCalendar(2011, Calendar.DECEMBER, 26),
new GregorianCalendar(2011, Calendar.DECEMBER, 27)]

def holidays2012 = [new GregorianCalendar(2012, Calendar.JANUARY, 2),
new GregorianCalendar(2012, Calendar.JANUARY, 16),
new GregorianCalendar(2012, Calendar.MAY, 28),
new GregorianCalendar(2012, Calendar.JULY, 4),
new GregorianCalendar(2012, Calendar.SEPTEMBER, 3),
new GregorianCalendar(2012, Calendar.NOVEMBER, 22),
new GregorianCalendar(2012, Calendar.NOVEMBER, 23),
new GregorianCalendar(2012, Calendar.DECEMBER, 24),
new GregorianCalendar(2012, Calendar.DECEMBER, 25),
new GregorianCalendar(2012, Calendar.DECEMBER, 31)]
def holidays2013 = [new GregorianCalendar(2013, Calendar.JANUARY, 1),
new GregorianCalendar(2013, Calendar.JANUARY, 21),
new GregorianCalendar(2013, Calendar.MAY, 27),
new GregorianCalendar(2013, Calendar.JULY, 4),
new GregorianCalendar(2013, Calendar.JULY, 5)]


switch (year) {
case "2011" :
return holidays2011;
break
case "2012" :
return holidays2012;
break
case "2013" :
return holidays2013;
break
}
}
return getWorkDays(startCal, endCal);

I have been facing this issue for the long time. Can someone help me please to resolve the issue

There is minoir change.Please refer to this code:

import static java.util.Calendar.*

def startDate = new Date("22/05/2013");
def endDate = new Date("24/06/2013");

if ((startDate == null || startDate.equals("")) || (endDate == null || endDate.equals(""))){
return 0 as Double;
}

Calendar startCal;
Calendar endCal;
startCal = Calendar.getInstance();
startCal.setTime(startDate);
endCal = Calendar.getInstance();
endCal.setTime(endDate);

def getWorkDays(Calendar startCal, Calendar endCal){
int workDays = -1;
//Return 0 if start and end are the same
if (startCal.getTimeInMillis() == endCal.getTimeInMillis()) {
++workDays;
return workDays as Double;
}

if (startCal.getTimeInMillis() > endCal.getTimeInMillis()) {
return workDays as Double;
}

while (startCal.getTimeInMillis() <= endCal.getTimeInMillis()){
// Uncomment this block to exclude Weekends and Holidays
//if (startCal.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY
// && startCal.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY
// && !isHoliday(startCal)) {
++workDays;
//}
startCal.add(Calendar.DAY_OF_MONTH, 1);
}

return workDays as Double;
}

def isHoliday(Calendar calendarDay){

def holidays = getCalendarForYear(calendarDay.get(Calendar.YEAR))

for (holiday in holidays) {
if (calendarDay.get(Calendar.YEAR) == holiday.get(Calendar.YEAR)
&& calendarDay.get(Calendar.MONTH) == holiday.get(Calendar.MONTH)
&& calendarDay.get(Calendar.DAY_OF_MONTH) == holiday.get(Calendar.DAY_OF_MONTH)){
return true;
}
}
return false;
}

def getCalendarForYear(year){
def holidays2011 = [new GregorianCalendar(2011, Calendar.SEPTEMBER, 5),
new GregorianCalendar(2011, Calendar.NOVEMBER, 24),
new GregorianCalendar(2011, Calendar.NOVEMBER, 25),
new GregorianCalendar(2011, Calendar.DECEMBER, 26),
new GregorianCalendar(2011, Calendar.DECEMBER, 27)]

def holidays2012 = [new GregorianCalendar(2012, Calendar.JANUARY, 2),
new GregorianCalendar(2012, Calendar.JANUARY, 16),
new GregorianCalendar(2012, Calendar.MAY, 28),
new GregorianCalendar(2012, Calendar.JULY, 4),
new GregorianCalendar(2012, Calendar.SEPTEMBER, 3),
new GregorianCalendar(2012, Calendar.NOVEMBER, 22),
new GregorianCalendar(2012, Calendar.NOVEMBER, 23),
new GregorianCalendar(2012, Calendar.DECEMBER, 24),
new GregorianCalendar(2012, Calendar.DECEMBER, 25),
new GregorianCalendar(2012, Calendar.DECEMBER, 31)]
def holidays2013 = [new GregorianCalendar(2013, Calendar.JANUARY, 1),
new GregorianCalendar(2013, Calendar.JANUARY, 21),
new GregorianCalendar(2013, Calendar.MAY, 27),
new GregorianCalendar(2013, Calendar.JULY, 4),
new GregorianCalendar(2013, Calendar.JULY, 5)]


switch (year) {
case "2011" :
return holidays2011;
break
case "2012" :
return holidays2012;
break
case "2013" :
return holidays2013;
break
}
}
return getWorkDays(startCal, endCal);

I have the same issue - were you able to solve it?

Hi Oskari have you solved this issue?

I had the same issue and found that the field type and scripted fied type was mismatched.

Check the script field type (Text Field, Number Field... etc) and also verify the Search Template type <custom= field/ your field name > edit (Text Field,  Number Field...etc) – Both should match the same based on the script output. 

You can find the error if you test your code with any JIRA issue. There should be a field under the script console, named as "Preview with issue" --Type the issue key and test it. 

 

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

357 views 0 6
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you