Generating correct manifest.mf file when creating jar file for native elasticsearch plugin

Hi sorry but I am new to java and elasticsearch. I have written a simple
native script in intellij which compiles into classes fine. I then use the
command line jar command to create the jar from the class files. A
MANIFEST.MF file is generated but is always empty (apart from version and
created by). When I put the jar into the elastic search lib directory and
add the following lines to the elasticsearch.yml

script.native:
MyNativeScript.type: com.elasticsearch.locationscript.CustomScriptFactory

Unfortunately I get the following errors

Initialization Failed ...

  1. No implementation for
    java.util.Set<org.elasticsearch.script.ScriptEngineService> was bound.2)
    NoClassSettingsException[Failed to load class setting [type] with value
    [com.elasticsearch.locationscript.CustomScriptFactory]]

ClassNotFoundException[com.elasticsearch.locationscript.CustomScriptFactory]

I have tried to compile a simple helloworld jar and I found this did not
work either UNTIL I modified the auto-generated (empty) Manifest file.

Any help or a point to a comprehensive tutorial covering how to create the
jar correctly would be much appreciated!!

ttyl

Matt

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/32f808bb-941f-4639-9a7d-dd57252d959e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

In Java, you have to add "Class-Path" to MANIFEST.MF or the class loader
will get confused about dependencies. It depends on the class path when you
start Elastisearch.

Also, in ES, simply adding extra jars is not the preferred method for
extensions.

It is supposed that you put a plugin (a zip archive with jars) into the
plugins folder and use es-plugin.properties instead of fiddling with jars
in the lib folder. These jars are treated specially at start up time, and
do not need "Class-Path" in MANIFEST.MF.

See also:

Jörg

On Fri, Oct 31, 2014 at 5:08 PM, Matthew Hall matthall103@gmail.com wrote:

Hi sorry but I am new to java and elasticsearch. I have written a simple
native script in intellij which compiles into classes fine. I then use the
command line jar command to create the jar from the class files. A
MANIFEST.MF file is generated but is always empty (apart from version and
created by). When I put the jar into the Elasticsearch lib directory and
add the following lines to the elasticsearch.yml

script.native:
MyNativeScript.type: com.elasticsearch.locationscript.CustomScriptFactory

Unfortunately I get the following errors

Initialization Failed ...

  1. No implementation for
    java.util.Set<org.elasticsearch.script.ScriptEngineService> was bound.2)
    NoClassSettingsException[Failed to load class setting [type] with value
    [com.elasticsearch.locationscript.CustomScriptFactory]]

ClassNotFoundException[com.elasticsearch.locationscript.CustomScriptFactory]

I have tried to compile a simple helloworld jar and I found this did not
work either UNTIL I modified the auto-generated (empty) Manifest file.

Any help or a point to a comprehensive tutorial covering how to create the
jar correctly would be much appreciated!!

ttyl

Matt

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/32f808bb-941f-4639-9a7d-dd57252d959e%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/32f808bb-941f-4639-9a7d-dd57252d959e%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGP6xYB5gHpN%2BauVRby9DKwAijqR_zATesK%2Bimo5JcH%2Bw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Hi thanks for the reply! I actually made a mistake in my post :/. I meant
native scripts rather than plugins. I tried adding the class-path to
Manifest.mf before but this did not work. Thanks for your suggestions
anyway and sorry about my typo!

Matt

On Sat, Nov 1, 2014 at 4:54 PM, joergprante@gmail.com <joergprante@gmail.com

wrote:

In Java, you have to add "Class-Path" to MANIFEST.MF or the class loader
will get confused about dependencies. It depends on the class path when you
start Elastisearch.

Also, in ES, simply adding extra jars is not the preferred method for
extensions.

It is supposed that you put a plugin (a zip archive with jars) into the
plugins folder and use es-plugin.properties instead of fiddling with jars
in the lib folder. These jars are treated specially at start up time, and
do not need "Class-Path" in MANIFEST.MF.

See also:

Elasticsearch Platform — Find real-time answers at scale | Elastic

Jörg

On Fri, Oct 31, 2014 at 5:08 PM, Matthew Hall matthall103@gmail.com
wrote:

Hi sorry but I am new to java and elasticsearch. I have written a simple
native script in intellij which compiles into classes fine. I then use the
command line jar command to create the jar from the class files. A
MANIFEST.MF file is generated but is always empty (apart from version and
created by). When I put the jar into the Elasticsearch lib directory and
add the following lines to the elasticsearch.yml

script.native:
MyNativeScript.type:
com.elasticsearch.locationscript.CustomScriptFactory

Unfortunately I get the following errors

Initialization Failed ...

  1. No implementation for
    java.util.Set<org.elasticsearch.script.ScriptEngineService> was bound.2)
    NoClassSettingsException[Failed to load class setting [type] with value
    [com.elasticsearch.locationscript.CustomScriptFactory]]

ClassNotFoundException[com.elasticsearch.locationscript.CustomScriptFactory]

I have tried to compile a simple helloworld jar and I found this did not
work either UNTIL I modified the auto-generated (empty) Manifest file.

Any help or a point to a comprehensive tutorial covering how to create
the jar correctly would be much appreciated!!

ttyl

Matt

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/32f808bb-941f-4639-9a7d-dd57252d959e%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/32f808bb-941f-4639-9a7d-dd57252d959e%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/_nQm8Y4EE9o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGP6xYB5gHpN%2BauVRby9DKwAijqR_zATesK%2Bimo5JcH%2Bw%40mail.gmail.com
https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGP6xYB5gHpN%2BauVRby9DKwAijqR_zATesK%2Bimo5JcH%2Bw%40mail.gmail.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAOAWKWFkzCUqrdoo4iO8YqZuYscV_ex7qNzELr9H-1JruXX7Qg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Yes, I understood native scripts. They should go into a plugin. Quoting the
docs:

"Plugins are a way to enhance the basic elasticsearch functionality in a
custom manner. They range from adding custom mapping types, custom
analyzers (in a more built in fashion), native scripts, custom discovery
and more."

Jörg

On Mon, Nov 3, 2014 at 10:12 AM, Matthew Hall matthall103@gmail.com wrote:

Hi thanks for the reply! I actually made a mistake in my post :/. I meant
native scripts rather than plugins. I tried adding the class-path to
Manifest.mf before but this did not work. Thanks for your suggestions
anyway and sorry about my typo!

Matt

On Sat, Nov 1, 2014 at 4:54 PM, joergprante@gmail.com <
joergprante@gmail.com> wrote:

In Java, you have to add "Class-Path" to MANIFEST.MF or the class loader
will get confused about dependencies. It depends on the class path when you
start Elastisearch.

Also, in ES, simply adding extra jars is not the preferred method for
extensions.

It is supposed that you put a plugin (a zip archive with jars) into the
plugins folder and use es-plugin.properties instead of fiddling with jars
in the lib folder. These jars are treated specially at start up time, and
do not need "Class-Path" in MANIFEST.MF.

See also:

Elasticsearch Platform — Find real-time answers at scale | Elastic

Jörg

On Fri, Oct 31, 2014 at 5:08 PM, Matthew Hall matthall103@gmail.com
wrote:

Hi sorry but I am new to java and elasticsearch. I have written a
simple native script in intellij which compiles into classes fine. I then
use the command line jar command to create the jar from the class files. A
MANIFEST.MF file is generated but is always empty (apart from version and
created by). When I put the jar into the Elasticsearch lib directory and
add the following lines to the elasticsearch.yml

script.native:
MyNativeScript.type:
com.elasticsearch.locationscript.CustomScriptFactory

Unfortunately I get the following errors

Initialization Failed ...

  1. No implementation for
    java.util.Set<org.elasticsearch.script.ScriptEngineService> was bound.2)
    NoClassSettingsException[Failed to load class setting [type] with value
    [com.elasticsearch.locationscript.CustomScriptFactory]]

ClassNotFoundException[com.elasticsearch.locationscript.CustomScriptFactory]

I have tried to compile a simple helloworld jar and I found this did not
work either UNTIL I modified the auto-generated (empty) Manifest file.

Any help or a point to a comprehensive tutorial covering how to create
the jar correctly would be much appreciated!!

ttyl

Matt

--
You received this message because you are subscribed to the Google
Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/32f808bb-941f-4639-9a7d-dd57252d959e%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/32f808bb-941f-4639-9a7d-dd57252d959e%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/_nQm8Y4EE9o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGP6xYB5gHpN%2BauVRby9DKwAijqR_zATesK%2Bimo5JcH%2Bw%40mail.gmail.com
https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGP6xYB5gHpN%2BauVRby9DKwAijqR_zATesK%2Bimo5JcH%2Bw%40mail.gmail.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CAOAWKWFkzCUqrdoo4iO8YqZuYscV_ex7qNzELr9H-1JruXX7Qg%40mail.gmail.com
https://groups.google.com/d/msgid/elasticsearch/CAOAWKWFkzCUqrdoo4iO8YqZuYscV_ex7qNzELr9H-1JruXX7Qg%40mail.gmail.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAKdsXoHpbsqKN41b5E7ZvATxWoWaJbe7fTfOWozDpCqzYN4vDw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Thanks Jorge, unfortunately when I tried to install the plugin using the
plugin manager I get an error:

Exception in thread "main" java.lang.NoClassDefFoundError:
org.elasticsearch.plugins.PluginManager
at gnu.java.lang.MainThread.run(libgcj.so.7rh)
Caused by: java.lang.ClassNotFoundException:
org.elasticsearch.plugins.PluginManager not found in
gnu.gcj.runtime.SystemClassLoader{urls=,
parent=gnu.gcj.runtime.ExtensionClassLoader{urls=, parent=null}}
at java.net.URLClassLoader.findClass(libgcj.so.7rh)
at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
at gnu.java.lang.MainThread.run(libgcj.so.7rh)

I have also tried installing the plugin by following the instructions
from

"Registering them can either be done by settings, for example:
script.native.my.type set to sample.MyNativeScriptFactory will register a
script named my. Another option is in a plugin, access ScriptModule and
call registerScript on it."

if I register the script using the settings file (elasticsearch.yml) I get
the error (as before)

Initialization Failed ...

  1. No implementation for
    java.util.Set<org.elasticsearch.script.ScriptEngineService> was bound.2)
    NoClassSettingsException[Failed to load class setting [type] with value
    [com.elasticsearch.locationscript.CustomScriptFactory]]

ClassNotFoundException[com.elasticsearch.locationscript.CustomScriptFactory]

I also tried the steps here as the problems seem identical

Redirecting to Google Groups
https://groups.google.com/a/elasticsearch.com/forum/#!msg/users/BcaI0z-LAtU/bfFIjsHP4Q8J

but with no luck :frowning:

Thanks

Matt

On Mon, Nov 3, 2014 at 9:18 AM, joergprante@gmail.com <joergprante@gmail.com

wrote:

Yes, I understood native scripts. They should go into a plugin. Quoting
the docs:

"Plugins are a way to enhance the basic elasticsearch functionality in a
custom manner. They range from adding custom mapping types, custom
analyzers (in a more built in fashion), native scripts, custom discovery
and more."

Jörg

On Mon, Nov 3, 2014 at 10:12 AM, Matthew Hall matthall103@gmail.com
wrote:

Hi thanks for the reply! I actually made a mistake in my post :/. I meant
native scripts rather than plugins. I tried adding the class-path to
Manifest.mf before but this did not work. Thanks for your suggestions
anyway and sorry about my typo!

Matt

On Sat, Nov 1, 2014 at 4:54 PM, joergprante@gmail.com <
joergprante@gmail.com> wrote:

In Java, you have to add "Class-Path" to MANIFEST.MF or the class loader
will get confused about dependencies. It depends on the class path when you
start Elastisearch.

Also, in ES, simply adding extra jars is not the preferred method for
extensions.

It is supposed that you put a plugin (a zip archive with jars) into the
plugins folder and use es-plugin.properties instead of fiddling with jars
in the lib folder. These jars are treated specially at start up time, and
do not need "Class-Path" in MANIFEST.MF.

See also:

Elasticsearch Platform — Find real-time answers at scale | Elastic

Jörg

On Fri, Oct 31, 2014 at 5:08 PM, Matthew Hall matthall103@gmail.com
wrote:

Hi sorry but I am new to java and elasticsearch. I have written a
simple native script in intellij which compiles into classes fine. I then
use the command line jar command to create the jar from the class files. A
MANIFEST.MF file is generated but is always empty (apart from version and
created by). When I put the jar into the Elasticsearch lib directory and
add the following lines to the elasticsearch.yml

script.native:
MyNativeScript.type:
com.elasticsearch.locationscript.CustomScriptFactory

Unfortunately I get the following errors

Initialization Failed ...

  1. No implementation for
    java.util.Set<org.elasticsearch.script.ScriptEngineService> was bound.2)
    NoClassSettingsException[Failed to load class setting [type] with value
    [com.elasticsearch.locationscript.CustomScriptFactory]]

ClassNotFoundException[com.elasticsearch.locationscript.CustomScriptFactory]

I have tried to compile a simple helloworld jar and I found this did
not work either UNTIL I modified the auto-generated (empty) Manifest file.

Any help or a point to a comprehensive tutorial covering how to create
the jar correctly would be much appreciated!!

ttyl

Matt

--
You received this message because you are subscribed to the Google
Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/32f808bb-941f-4639-9a7d-dd57252d959e%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/32f808bb-941f-4639-9a7d-dd57252d959e%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/_nQm8Y4EE9o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGP6xYB5gHpN%2BauVRby9DKwAijqR_zATesK%2Bimo5JcH%2Bw%40mail.gmail.com
https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGP6xYB5gHpN%2BauVRby9DKwAijqR_zATesK%2Bimo5JcH%2Bw%40mail.gmail.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CAOAWKWFkzCUqrdoo4iO8YqZuYscV_ex7qNzELr9H-1JruXX7Qg%40mail.gmail.com
https://groups.google.com/d/msgid/elasticsearch/CAOAWKWFkzCUqrdoo4iO8YqZuYscV_ex7qNzELr9H-1JruXX7Qg%40mail.gmail.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/_nQm8Y4EE9o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CAKdsXoHpbsqKN41b5E7ZvATxWoWaJbe7fTfOWozDpCqzYN4vDw%40mail.gmail.com
https://groups.google.com/d/msgid/elasticsearch/CAKdsXoHpbsqKN41b5E7ZvATxWoWaJbe7fTfOWozDpCqzYN4vDw%40mail.gmail.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAOAWKWEit9CM7zropMyGAODpBOttTp8eyFwvoyVPFQtdGVfG2A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Thanks Jorg, unfortunately when I tried to install the plugin using the
plugin manager I get an error:

Exception in thread "main" java.lang.NoClassDefFoundError:
org.elasticsearch.plugins.PluginManager
at gnu.java.lang.MainThread.run(libgcj.so.7rh)
Caused by: java.lang.ClassNotFoundException:
org.elasticsearch.plugins.PluginManager not found in
gnu.gcj.runtime.SystemClassLoader{urls=,
parent=gnu.gcj.runtime.ExtensionClassLoader{urls=, parent=null}}
at java.net.URLClassLoader.findClass(libgcj.so.7rh)
at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
at gnu.java.lang.MainThread.run(libgcj.so.7rh)

I have also tried installing the plugin by following the instructions
from

"Registering them can either be done by settings, for example:
script.native.my.type set to sample.MyNativeScriptFactory will register a
script named my. Another option is in a plugin, access ScriptModule and
call registerScript on it."

if I register the script using the settings file (elasticsearch.yml) I get
the error (as before)

Initialization Failed ...

  1. No implementation for
    java.util.Set<org.elasticsearch.script.ScriptEngineService> was bound.2)
    NoClassSettingsException[Failed to load class setting [type] with value
    [com.elasticsearch.locationscript.CustomScriptFactory]]

ClassNotFoundException[com.elasticsearch.locationscript.CustomScriptFactory]

I also tried the steps here as the problems seem identical

Redirecting to Google Groups
https://groups.google.com/a/elasticsearch.com/forum/#!msg/users/BcaI0z-LAtU/bfFIjsHP4Q8J

but with no luck :frowning:

Thanks

Matt

On Mon, Nov 3, 2014 at 9:18 AM, joergprante@gmail.com <joergprante@gmail.com

wrote:

Yes, I understood native scripts. They should go into a plugin. Quoting
the docs:

"Plugins are a way to enhance the basic elasticsearch functionality in a
custom manner. They range from adding custom mapping types, custom
analyzers (in a more built in fashion), native scripts, custom discovery
and more."

Jörg

On Mon, Nov 3, 2014 at 10:12 AM, Matthew Hall matthall103@gmail.com
wrote:

Hi thanks for the reply! I actually made a mistake in my post :/. I meant
native scripts rather than plugins. I tried adding the class-path to
Manifest.mf before but this did not work. Thanks for your suggestions
anyway and sorry about my typo!

Matt

On Sat, Nov 1, 2014 at 4:54 PM, joergprante@gmail.com <
joergprante@gmail.com> wrote:

In Java, you have to add "Class-Path" to MANIFEST.MF or the class loader
will get confused about dependencies. It depends on the class path when you
start Elastisearch.

Also, in ES, simply adding extra jars is not the preferred method for
extensions.

It is supposed that you put a plugin (a zip archive with jars) into the
plugins folder and use es-plugin.properties instead of fiddling with jars
in the lib folder. These jars are treated specially at start up time, and
do not need "Class-Path" in MANIFEST.MF.

See also:

Elasticsearch Platform — Find real-time answers at scale | Elastic

Jörg

On Fri, Oct 31, 2014 at 5:08 PM, Matthew Hall matthall103@gmail.com
wrote:

Hi sorry but I am new to java and elasticsearch. I have written a
simple native script in intellij which compiles into classes fine. I then
use the command line jar command to create the jar from the class files. A
MANIFEST.MF file is generated but is always empty (apart from version and
created by). When I put the jar into the Elasticsearch lib directory and
add the following lines to the elasticsearch.yml

script.native:
MyNativeScript.type:
com.elasticsearch.locationscript.CustomScriptFactory

Unfortunately I get the following errors

Initialization Failed ...

  1. No implementation for
    java.util.Set<org.elasticsearch.script.ScriptEngineService> was bound.2)
    NoClassSettingsException[Failed to load class setting [type] with value
    [com.elasticsearch.locationscript.CustomScriptFactory]]

ClassNotFoundException[com.elasticsearch.locationscript.CustomScriptFactory]

I have tried to compile a simple helloworld jar and I found this did
not work either UNTIL I modified the auto-generated (empty) Manifest file.

Any help or a point to a comprehensive tutorial covering how to create
the jar correctly would be much appreciated!!

ttyl

Matt

--
You received this message because you are subscribed to the Google
Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/32f808bb-941f-4639-9a7d-dd57252d959e%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/32f808bb-941f-4639-9a7d-dd57252d959e%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/_nQm8Y4EE9o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGP6xYB5gHpN%2BauVRby9DKwAijqR_zATesK%2Bimo5JcH%2Bw%40mail.gmail.com
https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGP6xYB5gHpN%2BauVRby9DKwAijqR_zATesK%2Bimo5JcH%2Bw%40mail.gmail.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CAOAWKWFkzCUqrdoo4iO8YqZuYscV_ex7qNzELr9H-1JruXX7Qg%40mail.gmail.com
https://groups.google.com/d/msgid/elasticsearch/CAOAWKWFkzCUqrdoo4iO8YqZuYscV_ex7qNzELr9H-1JruXX7Qg%40mail.gmail.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/_nQm8Y4EE9o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CAKdsXoHpbsqKN41b5E7ZvATxWoWaJbe7fTfOWozDpCqzYN4vDw%40mail.gmail.com
https://groups.google.com/d/msgid/elasticsearch/CAKdsXoHpbsqKN41b5E7ZvATxWoWaJbe7fTfOWozDpCqzYN4vDw%40mail.gmail.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAOAWKWF13Ne7pp2ER0NUKT6dyFX1dPLtawsxWrzOB7d1Pi%2Bfhw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

It is hard to guess what commands you executed and what your environment is.

You have to set up a useable IDE environment. Currently:

  • I recommend IntelliJ IDEA Community Edition
  • Java JDK 7u65 or Java JDK 8u25
  • Maven 3.2.3
  • Elasticsearch 1.3 or 1.4.Beta1

With IDE support and Maven, detecting dependencies like JVM and
Elasticsearch jars is a snap.

For example, you could fire up a simple plugin

then change the code to add your native script, and save it as your project.

Jörg

On Mon, Nov 3, 2014 at 3:56 PM, Matthew Hall matthall103@gmail.com wrote:

Thanks Jorg, unfortunately when I tried to install the plugin using the
plugin manager I get an error:

Exception in thread "main" java.lang.NoClassDefFoundError:
org.elasticsearch.plugins.PluginManager
at gnu.java.lang.MainThread.run(libgcj.so.7rh)
Caused by: java.lang.ClassNotFoundException:
org.elasticsearch.plugins.PluginManager not found in
gnu.gcj.runtime.SystemClassLoader{urls=,
parent=gnu.gcj.runtime.ExtensionClassLoader{urls=, parent=null}}
at java.net.URLClassLoader.findClass(libgcj.so.7rh)
at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
at gnu.java.lang.MainThread.run(libgcj.so.7rh)

I have also tried installing the plugin by following the instructions
from
Elasticsearch Platform — Find real-time answers at scale | Elastic

"Registering them can either be done by settings, for example:
script.native.my.type set to sample.MyNativeScriptFactory will register a
script named my. Another option is in a plugin, access ScriptModule and
call registerScript on it."

if I register the script using the settings file (elasticsearch.yml) I
get the error (as before)

Initialization Failed ...

  1. No implementation for
    java.util.Set<org.elasticsearch.script.ScriptEngineService> was bound.2)
    NoClassSettingsException[Failed to load class setting [type] with value
    [com.elasticsearch.locationscript.CustomScriptFactory]]

ClassNotFoundException[com.elasticsearch.locationscript.CustomScriptFactory]

I also tried the steps here as the problems seem identical

Redirecting to Google Groups
https://groups.google.com/a/elasticsearch.com/forum/#!msg/users/BcaI0z-LAtU/bfFIjsHP4Q8J

but with no luck :frowning:

Thanks

Matt

On Mon, Nov 3, 2014 at 9:18 AM, joergprante@gmail.com <
joergprante@gmail.com> wrote:

Yes, I understood native scripts. They should go into a plugin. Quoting
the docs:

"Plugins are a way to enhance the basic elasticsearch functionality in a
custom manner. They range from adding custom mapping types, custom
analyzers (in a more built in fashion), native scripts, custom discovery
and more."

Jörg

On Mon, Nov 3, 2014 at 10:12 AM, Matthew Hall matthall103@gmail.com
wrote:

Hi thanks for the reply! I actually made a mistake in my post :/. I
meant native scripts rather than plugins. I tried adding the class-path to
Manifest.mf before but this did not work. Thanks for your suggestions
anyway and sorry about my typo!

Matt

On Sat, Nov 1, 2014 at 4:54 PM, joergprante@gmail.com <
joergprante@gmail.com> wrote:

In Java, you have to add "Class-Path" to MANIFEST.MF or the class
loader will get confused about dependencies. It depends on the class path
when you start Elastisearch.

Also, in ES, simply adding extra jars is not the preferred method for
extensions.

It is supposed that you put a plugin (a zip archive with jars) into the
plugins folder and use es-plugin.properties instead of fiddling with jars
in the lib folder. These jars are treated specially at start up time, and
do not need "Class-Path" in MANIFEST.MF.

See also:

Elasticsearch Platform — Find real-time answers at scale | Elastic

Jörg

On Fri, Oct 31, 2014 at 5:08 PM, Matthew Hall matthall103@gmail.com
wrote:

Hi sorry but I am new to java and elasticsearch. I have written a
simple native script in intellij which compiles into classes fine. I then
use the command line jar command to create the jar from the class files. A
MANIFEST.MF file is generated but is always empty (apart from version and
created by). When I put the jar into the Elasticsearch lib directory and
add the following lines to the elasticsearch.yml

script.native:
MyNativeScript.type:
com.elasticsearch.locationscript.CustomScriptFactory

Unfortunately I get the following errors

Initialization Failed ...

  1. No implementation for
    java.util.Set<org.elasticsearch.script.ScriptEngineService> was bound.2)
    NoClassSettingsException[Failed to load class setting [type] with value
    [com.elasticsearch.locationscript.CustomScriptFactory]]

ClassNotFoundException[com.elasticsearch.locationscript.CustomScriptFactory]

I have tried to compile a simple helloworld jar and I found this did
not work either UNTIL I modified the auto-generated (empty) Manifest file.

Any help or a point to a comprehensive tutorial covering how to create
the jar correctly would be much appreciated!!

ttyl

Matt

--
You received this message because you are subscribed to the Google
Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/32f808bb-941f-4639-9a7d-dd57252d959e%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/32f808bb-941f-4639-9a7d-dd57252d959e%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/_nQm8Y4EE9o/unsubscribe
.
To unsubscribe from this group and all its topics, send an email to
elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGP6xYB5gHpN%2BauVRby9DKwAijqR_zATesK%2Bimo5JcH%2Bw%40mail.gmail.com
https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGP6xYB5gHpN%2BauVRby9DKwAijqR_zATesK%2Bimo5JcH%2Bw%40mail.gmail.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google
Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CAOAWKWFkzCUqrdoo4iO8YqZuYscV_ex7qNzELr9H-1JruXX7Qg%40mail.gmail.com
https://groups.google.com/d/msgid/elasticsearch/CAOAWKWFkzCUqrdoo4iO8YqZuYscV_ex7qNzELr9H-1JruXX7Qg%40mail.gmail.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/_nQm8Y4EE9o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CAKdsXoHpbsqKN41b5E7ZvATxWoWaJbe7fTfOWozDpCqzYN4vDw%40mail.gmail.com
https://groups.google.com/d/msgid/elasticsearch/CAKdsXoHpbsqKN41b5E7ZvATxWoWaJbe7fTfOWozDpCqzYN4vDw%40mail.gmail.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CAOAWKWF13Ne7pp2ER0NUKT6dyFX1dPLtawsxWrzOB7d1Pi%2Bfhw%40mail.gmail.com
https://groups.google.com/d/msgid/elasticsearch/CAOAWKWF13Ne7pp2ER0NUKT6dyFX1dPLtawsxWrzOB7d1Pi%2Bfhw%40mail.gmail.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEMsKUdX0%2B%2BRHMhFTAyH6R9GNuyrs5F8m9KAiD_kH8Lyw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

I'm using IntelliJ Ultimate, in a linux environment, jdk 1.70_71, I have
maven and ant but haven't used them much in the past :/.

Anyway thanks for trying to help :slight_smile:

Matt

On Mon, Nov 3, 2014 at 3:27 PM, joergprante@gmail.com <joergprante@gmail.com

wrote:

It is hard to guess what commands you executed and what your environment
is.

You have to set up a useable IDE environment. Currently:

  • I recommend IntelliJ IDEA Community Edition
  • Java JDK 7u65 or Java JDK 8u25
  • Maven 3.2.3
  • Elasticsearch 1.3 or 1.4.Beta1

With IDE support and Maven, detecting dependencies like JVM and
Elasticsearch jars is a snap.

For example, you could fire up a simple plugin

GitHub - jprante/elasticsearch-simple-action-plugin: A simple action plugin for Elasticsearch

then change the code to add your native script, and save it as your
project.

Jörg

On Mon, Nov 3, 2014 at 3:56 PM, Matthew Hall matthall103@gmail.com
wrote:

Thanks Jorg, unfortunately when I tried to install the plugin using the
plugin manager I get an error:

Exception in thread "main" java.lang.NoClassDefFoundError:
org.elasticsearch.plugins.PluginManager
at gnu.java.lang.MainThread.run(libgcj.so.7rh)
Caused by: java.lang.ClassNotFoundException:
org.elasticsearch.plugins.PluginManager not found in
gnu.gcj.runtime.SystemClassLoader{urls=,
parent=gnu.gcj.runtime.ExtensionClassLoader{urls=, parent=null}}
at java.net.URLClassLoader.findClass(libgcj.so.7rh)
at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
at gnu.java.lang.MainThread.run(libgcj.so.7rh)

I have also tried installing the plugin by following the instructions
from
Elasticsearch Platform — Find real-time answers at scale | Elastic

"Registering them can either be done by settings, for example:
script.native.my.type set to sample.MyNativeScriptFactory will register
a script named my. Another option is in a plugin, access ScriptModule and
call registerScript on it."

if I register the script using the settings file (elasticsearch.yml) I
get the error (as before)

Initialization Failed ...

  1. No implementation for
    java.util.Set<org.elasticsearch.script.ScriptEngineService> was bound.2)
    NoClassSettingsException[Failed to load class setting [type] with value
    [com.elasticsearch.locationscript.CustomScriptFactory]]

ClassNotFoundException[com.elasticsearch.locationscript.CustomScriptFactory]

I also tried the steps here as the problems seem identical

Redirecting to Google Groups
https://groups.google.com/a/elasticsearch.com/forum/#!msg/users/BcaI0z-LAtU/bfFIjsHP4Q8J

but with no luck :frowning:

Thanks

Matt

On Mon, Nov 3, 2014 at 9:18 AM, joergprante@gmail.com <
joergprante@gmail.com> wrote:

Yes, I understood native scripts. They should go into a plugin. Quoting
the docs:

"Plugins are a way to enhance the basic elasticsearch functionality in a
custom manner. They range from adding custom mapping types, custom
analyzers (in a more built in fashion), native scripts, custom discovery
and more."

Jörg

On Mon, Nov 3, 2014 at 10:12 AM, Matthew Hall matthall103@gmail.com
wrote:

Hi thanks for the reply! I actually made a mistake in my post :/. I
meant native scripts rather than plugins. I tried adding the class-path to
Manifest.mf before but this did not work. Thanks for your suggestions
anyway and sorry about my typo!

Matt

On Sat, Nov 1, 2014 at 4:54 PM, joergprante@gmail.com <
joergprante@gmail.com> wrote:

In Java, you have to add "Class-Path" to MANIFEST.MF or the class
loader will get confused about dependencies. It depends on the class path
when you start Elastisearch.

Also, in ES, simply adding extra jars is not the preferred method for
extensions.

It is supposed that you put a plugin (a zip archive with jars) into
the plugins folder and use es-plugin.properties instead of fiddling with
jars in the lib folder. These jars are treated specially at start up time,
and do not need "Class-Path" in MANIFEST.MF.

See also:

Elasticsearch Platform — Find real-time answers at scale | Elastic

Jörg

On Fri, Oct 31, 2014 at 5:08 PM, Matthew Hall matthall103@gmail.com
wrote:

Hi sorry but I am new to java and elasticsearch. I have written a
simple native script in intellij which compiles into classes fine. I then
use the command line jar command to create the jar from the class files. A
MANIFEST.MF file is generated but is always empty (apart from version and
created by). When I put the jar into the Elasticsearch lib directory and
add the following lines to the elasticsearch.yml

script.native:
MyNativeScript.type:
com.elasticsearch.locationscript.CustomScriptFactory

Unfortunately I get the following errors

Initialization Failed ...

  1. No implementation for
    java.util.Set<org.elasticsearch.script.ScriptEngineService> was bound.2)
    NoClassSettingsException[Failed to load class setting [type] with value
    [com.elasticsearch.locationscript.CustomScriptFactory]]

ClassNotFoundException[com.elasticsearch.locationscript.CustomScriptFactory]

I have tried to compile a simple helloworld jar and I found this did
not work either UNTIL I modified the auto-generated (empty) Manifest file.

Any help or a point to a comprehensive tutorial covering how to
create the jar correctly would be much appreciated!!

ttyl

Matt

--
You received this message because you are subscribed to the Google
Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/32f808bb-941f-4639-9a7d-dd57252d959e%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/32f808bb-941f-4639-9a7d-dd57252d959e%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/_nQm8Y4EE9o/unsubscribe
.
To unsubscribe from this group and all its topics, send an email to
elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGP6xYB5gHpN%2BauVRby9DKwAijqR_zATesK%2Bimo5JcH%2Bw%40mail.gmail.com
https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGP6xYB5gHpN%2BauVRby9DKwAijqR_zATesK%2Bimo5JcH%2Bw%40mail.gmail.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google
Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CAOAWKWFkzCUqrdoo4iO8YqZuYscV_ex7qNzELr9H-1JruXX7Qg%40mail.gmail.com
https://groups.google.com/d/msgid/elasticsearch/CAOAWKWFkzCUqrdoo4iO8YqZuYscV_ex7qNzELr9H-1JruXX7Qg%40mail.gmail.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/_nQm8Y4EE9o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CAKdsXoHpbsqKN41b5E7ZvATxWoWaJbe7fTfOWozDpCqzYN4vDw%40mail.gmail.com
https://groups.google.com/d/msgid/elasticsearch/CAKdsXoHpbsqKN41b5E7ZvATxWoWaJbe7fTfOWozDpCqzYN4vDw%40mail.gmail.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CAOAWKWF13Ne7pp2ER0NUKT6dyFX1dPLtawsxWrzOB7d1Pi%2Bfhw%40mail.gmail.com
https://groups.google.com/d/msgid/elasticsearch/CAOAWKWF13Ne7pp2ER0NUKT6dyFX1dPLtawsxWrzOB7d1Pi%2Bfhw%40mail.gmail.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/_nQm8Y4EE9o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEMsKUdX0%2B%2BRHMhFTAyH6R9GNuyrs5F8m9KAiD_kH8Lyw%40mail.gmail.com
https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEMsKUdX0%2B%2BRHMhFTAyH6R9GNuyrs5F8m9KAiD_kH8Lyw%40mail.gmail.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAOAWKWE2QTBSOZ9P62JRMDnoHOP4XmuFKab8AAPu24dXn3h3uQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.