Expand my Community achievements bar.

SOLVED

groovy.lang.MissingMethodException

Avatar

Level 1

Has anyone run into the issue, when attempting to run a Groovy script in the "generic" script console?

I am trying to run what I assume is a valid script (I got it from https://hashimkhan.in/aem-adobecq5-code-templates/groovy-script/  )

 

The script is:

import javax.jcr.Node

noOfPages = 0
path = '/content/dam/we-retail/en/products/apparel/'
findAllPages()


def findAllPages() {
getPage(path).recurse {
page ->
println 'Title:' + page.title
println 'Path:' + page.path
noOfPages++
}
}

 

The error I receive is:

groovy.lang.MissingMethodException: No signature of method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.getPage()

 

Has anyone run into this?

 

Thanks in advance, 

Glenn

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @geveret 

 

Download the Groovy console package from the below path:-

 

  1. Download the console package. Install this package

  2. Verify the installation.

Once package installation is done,

1. Go to system/console/configmgr and search for Groovy Console Configuration Service

2. Configure the Allowed Groups for script execution. List of group names that are authorized to use the console. By default, only the 'admin' user has permission to execute scripts.

 

Try this it should work but in case if it's not let me now what's the AEM instance version you are trying to run the groovy console on and what's the service packs deployed on it?

View solution in original post

3 Replies

Avatar

Community Advisor

@geveret I tried it in my system and it works perfectly fine. Difference between your script and mine is that I ran it for content pages instead of images and when I tried to run for assets, got a null pointer exception.  I think the script that you have mentioned works only for the content pages not for the dam assets. Try updating the content page path instead of dam path in your script and let me know if you are still facing this issue.

 

AvinashGupta01_0-1669680362698.png

 

Hope this helps!

Avatar

Level 1

Thanks for the reply, but I'm still getting the same error, regardless of the content.

I have another issue, in that I'm using the generic script console because my Groovy console does not display the buttons, and I can't execute scripts with it.  I had opened a separate ticket with Adobe on this and they have not been able to help me.  You don't by chance know why I don't see the buttons do you?

Avatar

Correct answer by
Community Advisor

Hi @geveret 

 

Download the Groovy console package from the below path:-

 

  1. Download the console package. Install this package

  2. Verify the installation.

Once package installation is done,

1. Go to system/console/configmgr and search for Groovy Console Configuration Service

2. Configure the Allowed Groups for script execution. List of group names that are authorized to use the console. By default, only the 'admin' user has permission to execute scripts.

 

Try this it should work but in case if it's not let me now what's the AEM instance version you are trying to run the groovy console on and what's the service packs deployed on it?