Where to place a custom listener for script runner version 2

Jaime C. November 15, 2012

I am trying to know where to place a custom listener with groovy script runner version 2 using the plugins 2 layout, JIRA 5.1.1. What I have is my .groovy compiled class.

I have tried various places within $ATLAS_HOME/plugins, for example $ATLAS_HOME/plugins/classes/<package>/<file>

but I always get this error at the time I configure the listener, which I don't know if it is related to the missplaced groovy file or if it is something else:

/secure/admin/groovy/CannedScriptListener.jspa [jira.web.dispatcher.JiraWebworkActionDispatcher] Exception thrown from action 'CannedScriptListener', returning 404
java.lang.NoClassDefFoundError: groovy/lang/GroovyObject
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClassCond(Unknown Source)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at java.security.SecureClassLoader.defineClass(Unknown Source)
        at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2818)
        at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1159)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1647)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:717)
        at groovy.lang.GroovyClassLoader$InnerLoader.loadClass(GroovyClassLoader.java:449)
        at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:564)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSite.invoke(PojoMetaMethodSite.java:189)
        at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:53)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:124)
        at com.onresolve.jira.groovy.canned.workflow.listeners.CustomListener.doValidate(CustomListener.groovy:42)
        at com.onresolve.jira.groovy.canned.CannedScript$doValidate.call(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
        at com.onresolve.jira.groovy.canned.CannedScript$doValidate.call(Unknown Source)
        at com.onresolve.jira.groovy.CannedScriptRunner.getValidationErrors(CannedScriptRunner.groovy:44)
        at com.onresolve.jira.groovy.CannedScriptRunner$getValidationErrors.callCurrent(Unknown Source)
        at com.onresolve.jira.groovy.CannedScriptRunner.doExecute(CannedScriptRunner.groovy:203)
        at com.onresolve.jira.groovy.CannedScriptListener.super$6$doExecute(CannedScriptListener.groovy)
        at sun.reflect.GeneratedMethodAccessor2247.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1054)
        at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:128)
        at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuper0(ScriptBytecodeAdapter.java:148)
        at com.onresolve.jira.groovy.CannedScriptListener.doExecute(CannedScriptListener.groovy:33)
        at webwork.action.ActionSupport.execute(ActionSupport.java:165)
        at com.atlassian.jira.action.JiraActionSupport.execute(JiraActionSupport.java:82)
        at webwork.interceptor.DefaultInterceptorChain.proceed(DefaultInterceptorChain.java:39)
        at webwork.interceptor.NestedInterceptorChain.proceed(NestedInterceptorChain.java:31)
        at webwork.interceptor.ChainedInterceptor.intercept(ChainedInterceptor.java:16)
        at webwork.interceptor.DefaultInterceptorChain.proceed(DefaultInterceptorChain.java:35)
        at webwork.dispatcher.GenericDispatcher.executeAction(GenericDispatcher.java:221)
        at webwork.dispatcher.GenericDispatcher.executeAction(GenericDispatcher.java:150)

In $ATLAS_HOME/plugins, groovy runner stuff seems to be inplace:

&gt; find . -name "*groovy*"
./.osgi-plugins/felix/felix-cache/bundle104/version0.0/bundle.jar-embedded/META-INF/lib/groovy-all-1.8.5-scriptrunner.jar
./.osgi-plugins/transformed-plugins/plugin.5152546024196832681.groovyrunner-2.0.10_1352819313000.jar
./installed-plugins/plugin.5152546024196832681.groovyrunner-2.0.10.jar

BR

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Alexey Paveliev
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.
December 13, 2012

My root admin updated /opt/atlassian/jira/bin/setenv.sh:

with

PLUGINS_OPTS="-Dplugin.resource.directories=/home/YOUR_LOGIN/jira-plugins"

JAVA_OPTS="-Xms${JVM_MINIMUM_MEMORY} -Xmx${JVM_MAXIMUM_MEMORY} ${JAVA_OPTS} ${JVM_REQUIRED_ARGS} ${DISABLE_NOTIFICATIONS} ${JVM_SUPPORT_RECOMMENDED_ARGS} ${JVM_EXTRA_ARGS} ${JIRA_HOME_MINUSD} ${PLUGINS_OPTS}"

So now I can copy groovy sources there without need of root access

0 votes
Henning Tietgens
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.
November 15, 2012
Jaime C. November 15, 2012

I had tried that also and it does not work. Same error as above and also, which did not detail before, redirected to a jira error (not-found) webpage. I dont get the red error message saying "Problem loading class".

I was under the impression that using the WEB-INF path was not going to work when script runner (and groovy-all) is now a osgi plugin, thinking that it is not posible to load classes in WEB-INF from there. But that is that, just an impression.

Jaime C. November 15, 2012

To be more clear about above, I alsot tried placing it in WEB-INF/classes/<package>/<groovy>. Same effect.

As additional info, the ExampleListener included in groovy runner does work.

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.
November 15, 2012

It should work as in your comment above. Can you make sure you *don't* have a groovy jar under web-inf/lib.

Jaime C. November 16, 2012

No, no groovy jar under web-inf/lib. Hard for me to explain how grrovy.lang.GroovyClassLoader is found fine, but groovy.lang.GroovyObject is not found somehow, as they are in the same jar. There must really be a mixup with the class loaders.

This is the root of the excpetion by the way, but missing a lot of stack trace

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
        at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.ClassNotFoundException: groovy.lang.GroovyObject
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
        ... 190 more

Would it be useful to try an earlier runner version like 1.7 and go web-inf all the way?

TAGS
AUG Leaders

Atlassian Community Events