Sriptrunner Console mistake 7.0.9

Christoph Lasecki January 26, 2016

We use JIRA 7.0.9:

  • Behind an IIS with AJP Connector (Redirected to /jira)
  • And Adaptavist ScriptRunner for JIRA 4.2.0.5
  • MSSQL2012

Now here is my Problem:


if i develop a Custemfield like this:

enableCache = {-> false}
import org.apache.log4j.Category
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.ApplicationUser
import com.opensymphony.workflow.WorkflowContext
import com.atlassian.jira.issue.Issue
def Issue issue = issue

def customFieldManager= ComponentAccessor.getCustomFieldManager()
def versionCF= customFieldManager.getCustomFieldObjectByName("Versionsnummer")

def val=versionCF.getValue(issue)
def date=issue.getCreated().format('yyyyMMddHHmm')
def year =issue.getCreated().format('yyyy')
String ISSN = issue
def ISSNR = ISSN.split("-")
def STRG = ""
if (val){
    STRG= year+"/"+ISSNR[1]+"/"+date+"/"+ISSNR[0]+"/v:"+val
} else {
    STRG= year+"/"+ISSNR[1]+"/"+date+"/"+ISSNR[0]+"/v:"+"0"
}
if (STRG){
    return STRG
} else {
    log.error("Invalid: " + STRG);
}
return 0


I see only:

image2016-1-26 14:14:59.png


OK i Updatet now the script and say save: 

I see that my test was successfull:

image2016-1-26 14:16:13.png

image2016-1-26 14:16:42.png


In the logfile it says to me:

 

2016-01-26 14:15:29,893 ajp-nio-8009-exec-49 ERROR USER 855x27396x1 rdr55x XXX.XXX.XXX.XXX /rest/scriptrunner/latest/canned/com.onresolve.scriptrunner.canned.common.StaticCompilationChecker [c.a.p.r.c.error.jersey.ThrowableExceptionMapper] Uncaught exception thrown by REST service: Could not initialize USERss com.onresolve.scriptrunner.runner.stc.ScriptCompileContext$ContextByName
java.lang.NoUSERssDefFoundError: Could not initialize USERss com.onresolve.scriptrunner.runner.stc.ScriptCompileContext$ContextByName
	at com.onresolve.scriptrunner.runner.stc.ScriptCompileContext.fromLabel(ScriptCompileContext.groovy:86)
	at com.onresolve.scriptrunner.runner.stc.ScriptCompileContext$fromLabel.call(Unknown Source)
	at com.onresolve.scriptrunner.canned.common.StaticCompilationChecker.getContextFromParams(StaticCompilationChecker.groovy:81)
	at com.onresolve.scriptrunner.canned.common.StaticCompilationChecker$getContextFromParams.callCurrent(Unknown Source)
	at com.onresolve.scriptrunner.canned.common.StaticCompilationChecker.doScript(StaticCompilationChecker.groovy:103)
2016-01-26 14:15:29,908 ajp-nio-8009-exec-46 ERROR USER 855x27397x1 rdr55x XXX.XXX.XXX.XXX /rest/scriptrunner/latest/canned/com.onresolve.scriptrunner.canned.common.StaticCompilationChecker [c.a.p.r.c.error.jersey.ThrowableExceptionMapper] Uncaught exception thrown by REST service: Could not initialize USERss com.onresolve.scriptrunner.runner.stc.ScriptCompileContext$ContextByName
java.lang.NoUSERssDefFoundError: Could not initialize USERss com.onresolve.scriptrunner.runner.stc.ScriptCompileContext$ContextByName
	at com.onresolve.scriptrunner.runner.stc.ScriptCompileContext.fromLabel(ScriptCompileContext.groovy:86)
	at com.onresolve.scriptrunner.runner.stc.ScriptCompileContext$fromLabel.call(Unknown Source)
	at com.onresolve.scriptrunner.canned.common.StaticCompilationChecker.getContextFromParams(StaticCompilationChecker.groovy:81)
	at com.onresolve.scriptrunner.canned.common.StaticCompilationChecker$getContextFromParams.callCurrent(Unknown Source)
	at com.onresolve.scriptrunner.canned.common.StaticCompilationChecker.doScript(StaticCompilationChecker.groovy:103)
2016-01-26 14:15:29,955 ajp-nio-8009-exec-46 ERROR USER 855x27403x1 rdr55x XXX.XXX.XXX.XXX /rest/scriptrunner/latest/canned/com.onresolve.scriptrunner.canned.common.StaticCompilationChecker [c.a.p.r.c.error.jersey.ThrowableExceptionMapper] Uncaught exception thrown by REST service: Could not initialize USERss com.onresolve.scriptrunner.runner.stc.ScriptCompileContext$ContextByName
java.lang.NoUSERssDefFoundError: Could not initialize USERss com.onresolve.scriptrunner.runner.stc.ScriptCompileContext$ContextByName
	at com.onresolve.scriptrunner.runner.stc.ScriptCompileContext.fromLabel(ScriptCompileContext.groovy:86)
	at com.onresolve.scriptrunner.runner.stc.ScriptCompileContext$fromLabel.call(Unknown Source)
	at com.onresolve.scriptrunner.canned.common.StaticCompilationChecker.getContextFromParams(StaticCompilationChecker.groovy:81)
	at com.onresolve.scriptrunner.canned.common.StaticCompilationChecker$getContextFromParams.callCurrent(Unknown Source)
	at com.onresolve.scriptrunner.canned.common.StaticCompilationChecker.doScript(StaticCompilationChecker.groovy:103)

 

Now comes something i don't Understand. If i try the same on my Developer Host, Evrything is fine

In my productive JIRA the Field Works fine, but the Console not so i've tried it on my develop host. 

Same Script whithout changes but the Version of JIRA isn't 7.0.9 it is 

And here works everything fine ?!?!? 


image2016-1-26 14:26:22.png

 

What is my mistake ???????????????????????????????

 

regards 

 

Christoph

 

UPDATE:

 

If changed know from IIS to Apache and from AJP to HTTP/1.1 Connector and get a little bit diffrent Result:

2016-01-26 18:43:30,228 http-nio-8081-exec-11 WARN USER 1123x575x1 1m79tca XXX.XXX.XXX.XXX /rest/scriptrunner-jira/latest/scriptfields/11013/preview [c.o.scriptrunner.runner.ScriptFieldManagerImpl] Cannot get property 'name' on null object
java.lang.NullPointerException: Cannot get property 'name' on null object
        at org.codehaus.groovy.runtime.NullObject.getProperty(NullObject.java:60)
        at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:172)
        at org.codehaus.groovy.runtime.callsite.NullCallSite.getProperty(NullCallSite.java:47)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:296)
        at com.onresolve.scriptrunner.runner.ScriptFieldManagerImpl.getPreview(ScriptFieldManagerImpl.groovy:350)
        at com.onresolve.scriptrunner.runner.rest.jira.ScriptFieldsEndpoint.previewScriptField(ScriptFieldsEndpoint.groo
vy:91)
        ... 3 filtered
        at java.lang.reflect.Method.invoke(Method.java:497)
        at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
        ... 13 filtered
        at com.atlassian.plugins.rest.module.RestDelegatingServletFilter$JerseyOsgiServletContainer.doFilter(RestDelegat
ingSer
vletFilter.java:178)
        ... 1 filtered
        at com.atlassian.plugins.rest.module.RestDelegatingServletFilter.doFilter(RestDelegatingServletFilter.java:73)
        ... 106 filtered
        at com.atlassian.plugins.rest.module.servlet.RestSeraphFilter.doFilter(RestSeraphFilter.java:40)
        ... 73 filtered
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:745)

5 answers

0 votes
Christoph Lasecki January 29, 2016

I find the problem it ist the AJP Connector. I've updated today to JIRA 7.0.10. On this downtime i've changed from AJP to ARR Connector (Rewrite Rules IIS) after that evrything is fine. But its slower than the AJP connector sad 

 

0 votes
Christoph Lasecki January 26, 2016

Hi Jamie,

No i've replaced my User shortcut, maybe i've replaced to much. 

At this moment i don't understand the problem, i've testet with some kind of Browser with this Result:

If i do evrything right the script, it finished the  run in cfConsole and show me the Result. If i force a mistake like to play with the return Values like this: 

image2016-1-27 9:37:35.png

 

I see only image2016-1-27 9:37:56.png

 

In The JIRA Log is see it:

 

3
2016-01-27 09:37:15,989 ajp-nio-8009-exec-11 ERROR USER 577x11138x1 1g9a7ui XX.XX.XX.XX /rest/scriptrunner-jira/lates
t/scriptfields/11013/preview [c.o.scriptrunner.customfield.GroovyCustomField] *****************************************
********************************************
2016-01-27 09:37:15,989 ajp-nio-8009-exec-11 ERROR USER 577x11138x1 1g9a7ui XX.XX.XX.XX /rest/scriptrunner-jira/lates
t/scriptfields/11013/preview [c.o.scriptrunner.customfield.GroovyCustomField] Script field failed on issue: CRM-15, fie
ld: Angebotsnummer-SCRIPT
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script22.groovy: 30: expecting '}', found 'STRG' @ line 30, column 14.
       return 0 STRG
                ^
1 error
  • but not in the GUI

If i do the Thame with forcing HTTP/1.1 IE Connector I got the Output and here it works ?:-O 

image2016-1-27 9:44:8.png

 

 

But you see in the JIRA Log some not nice Errors like this:

 

2016-01-27 09:42:14,828 http-nio-8081-exec-22 ERROR USER 582x11194x1 10223j3 XX.XX.XX.XX /rest/scriptrunner/latest/canned/com.onresolve.scriptrunner.canned.common.StaticCompilationChecker [c.a.p.r.c.error.jersey.ThrowableExceptionMapper] Uncaught exception thrown by REST service: Could not initialize class com.onresolve.scriptrunner.runner.stc.ScriptCompileContext$ContextByName
java.lang.NoClassDefFoundError: Could not initialize class com.onresolve.scriptrunner.runner.stc.ScriptCompileContext$ContextByName
        at com.onresolve.scriptrunner.runner.stc.ScriptCompileContext.fromLabel(ScriptCompileContext.groovy:86)
        at com.onresolve.scriptrunner.runner.stc.ScriptCompileContext$fromLabel.call(Unknown Source)
        at com.onresolve.scriptrunner.canned.common.StaticCompilationChecker.getContextFromParams(StaticCompilationChecer.gro
ovy:81)
        at com.onresolve.scriptrunner.canned.common.StaticCompilationChecker$getContextFromParams$0.callCurrent(UnknownSource
)
        at com.onresolve.scriptrunner.canned.common.StaticCompilationChecker.doScript(StaticCompilationChecker.groovy:1
3)
2016-01-27 09:43:15,577 http-nio-8081-exec-9 ERROR USER 583x11196x1 10223j3 XX.XX.XX.XX /rest/scriptrunner/latest/canned/com.onresolve.scriptrunner.canned.common.StaticCompilationChecker [c.a.p.r.c.error.jersey.ThrowableExceptionMapper]
 Uncaught exception thrown by REST service: Could not initialize class com.onresolve.scriptrunner.runner.stc.ScriptCompileContext$ContextByName
java.lang.NoClassDefFoundError: Could not initialize class com.onresolve.scriptrunner.runner.stc.ScriptCompileContext$ContextByName
        at com.onresolve.scriptrunner.runner.stc.ScriptCompileContext.fromLabel(ScriptCompileContext.groovy:86)
        at com.onresolve.scriptrunner.runner.stc.ScriptCompileContext$fromLabel.call(Unknown Source)
        at com.onresolve.scriptrunner.canned.common.StaticCompilationChecker.getContextFromParams(StaticCompilationChecer.groovy:81)
        at com.onresolve.scriptrunner.canned.common.StaticCompilationChecker$getContextFromParams$0.callCurrent(UnknownSource)
        at com.onresolve.scriptrunner.canned.common.StaticCompilationChecker.doScript(StaticCompilationChecker.groovy:13)
2016-01-27 09:43:16,467 http-nio-8081-exec-14 ERROR USER 583x11197x1 10223j3 191.100.16.132 /rest/scriptrunner-jira/latest/scriptfields/11013/preview [c.o.scriptrunner.customfield.GroovyCustomField] ****************************************
*********************************************
2016-01-27 09:43:16,467 http-nio-8081-exec-14 ERROR USER 583x11197x1 10223j3 191.100.16.132 /rest/scriptrunner-jira/latest/scriptfields/11013/preview [c.o.scriptrunner.customfield.GroovyCustomField] Script field failed on issue: CRM-15, field: Angebotsnummer-SCRIPT
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script23.groovy: 30: expecting '}', found 'STRG' @ line 30, column 14.
       return 0 STRG
                ^
1 error

 

 

I dont understand what is it. I hope you can help 

 

regards 

 

Chris

0 votes
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 26, 2016

There is something weird in your setup... eg:

java.lang.NoUSERssDefFoundError: Could not initialize USERss

Something is substituting the string USERss for the string "Class" in your log... does that ring any bells?

0 votes
Christoph Lasecki January 26, 2016

 

I've found the Error but don't understand: It was my Option for the searcher

If declaired it with:

image2016-1-26 20:7:35.png

in develop Enviroment it was a Searcher: freetext. If i changed it in my productenviroment to freetext everything works fine. 

 

 

0 votes
Thanos Batagiannis _Adaptavist_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 26, 2016

Hi Christoph,

I can see there is something wrong with the preview, but did you try to click the update (despite the fact the the preview fails) to see if it works or if it throws the same errors in the logs ? Also could you please attach a screenshot with your scripted field configuration ?

Kind regards

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events