Skip to content

Groovy script throws java.lang.NoClassDefFoundError: groovy/lang/Reference #16657

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
masaruh opened this issue Feb 14, 2016 · 1 comment
Closed
Labels
:Core/Infra/Scripting Scripting abstractions, Painless, and Mustache >enhancement good first issue low hanging fruit

Comments

@masaruh
Copy link
Contributor

masaruh commented Feb 14, 2016

Elasticsearch 2.2.0.

Combination of def keyword and closure gives the exception.

This gives java.lang.NoClassDefFoundError: groovy/lang/Reference:

GET index/_search
{
  "script_fields": {
    "test_script": {
      "script": {
        "inline": "def val = \"\"; p.each{ val += it }; val",
        "params": {
          "p":["aaa", "bbb", "ccc"]
        }
      }
    }
  }
}

This is fine:

GET index/_search
{
  "script_fields": {
    "test_script": {
      "script": {
        "inline": "val = \"\"; p.each{ val += it }; val",
        "params": {
          "p":["aaa", "bbb", "ccc"]
        }
      }
    }
  }
}

Adding permission org.elasticsearch.script.ClassPermission "groovy.lang.Reference" in modules/lang-groovy/plugin-security.policy seems to fix the issue.

@jasontedor
Copy link
Member

Closed by #16660

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/Scripting Scripting abstractions, Painless, and Mustache >enhancement good first issue low hanging fruit
Projects
None yet
Development

No branches or pull requests

3 participants