Plugin implementing onModule with no parameters or more than one parameter – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 2.3-2.3

Briefly, this error occurs when an Elasticsearch plugin is incorrectly implemented. The onModule method should only have one parameter. If it has no parameters or more than one, Elasticsearch will throw this error. To resolve this issue, you should review your plugin’s code and ensure that the onModule method only has one parameter. If you’re using a third-party plugin, consider reaching out to the plugin’s developer or community for support. Alternatively, you could try updating the plugin or Elasticsearch to the latest version, as the issue might have been fixed in a newer release.

This guide will help you check for common problems that cause the log ” Plugin: {} implementing onModule with no parameters or more than one parameter ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: plugins.

Log Context

Log “Plugin: {} implementing onModule with no parameters or more than one parameter” classname is PluginsService.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

// this is a deprecated final method; so all Plugin subclasses have it
                if (method.getParameterTypes().length == 1 && method.getParameterTypes()[0].equals(IndexModule.class)) {
                    continue;
                }
                if (method.getParameterTypes().length == 0 || method.getParameterTypes().length > 1) {
                    logger.warn("Plugin: {} implementing onModule with no parameters or more than one parameter"; plugin.name());
                    continue;
                }
                Class moduleClass = method.getParameterTypes()[0];
                if (!Module.class.isAssignableFrom(moduleClass)) {
                    logger.warn("Plugin: {} implementing onModule by the type is not of Module type {}"; plugin.name(); moduleClass);

 

How helpful was this guide?

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?