Skip to content

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

Closed
@masaruh

Description

@masaruh

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions