Liferay Enterprise Search

[LES] Installing the Learning-to-Rank plugin on Elasticsearch fails with "IllegalStateException: ltr requires Java 14"

Environment

Symptom

Installation of the Learning-to-Rank (LTR) plugin on Elasticsearch fails with the following error:

-> Installing https://github.com/o19s/elasticsearch-learning-to-rank/releases/download/v1.5.8-es7.17.1/ltr-plugin-v1.5.8-es7.17.1.zip
-> Downloading https://github.com/o19s/elasticsearch-learning-to-rank/releases/download/v1.5.8-es7.17.1/ltr-plugin-v1.5.8-es7.17.1.zip
[=================================================] 100%  
-> Failed installing https://github.com/o19s/elasticsearch-learning-to-rank/releases/download/v1.5.8-es7.17.1/ltr-plugin-v1.5.8-es7.17.1.zip
-> Rolling back https://github.com/o19s/elasticsearch-learning-to-rank/releases/download/v1.5.8-es7.17.1/ltr-plugin-v1.5.8-es7.17.1.zip
-> Rolled back https://github.com/o19s/elasticsearch-learning-to-rank/releases/download/v1.5.8-es7.17.1/ltr-plugin-v1.5.8-es7.17.1.zip
Exception in thread "main" java.lang.IllegalStateException: ltr requires Java 14:, your system: 8
at org.elasticsearch.jdk.JarHell.checkJavaVersion(JarHell.java:253)
at org.elasticsearch.plugins.PluginsService.verifyCompatibility(PluginsService.java:397)
at org.elasticsearch.plugins.cli.InstallPluginAction.loadPluginInfo(InstallPluginAction.java:831)
at org.elasticsearch.plugins.cli.InstallPluginAction.installPlugin(InstallPluginAction.java:887)
at org.elasticsearch.plugins.cli.InstallPluginAction.execute(InstallPluginAction.java:245)
at org.elasticsearch.plugins.cli.InstallPluginCommand.execute(InstallPluginCommand.java:88)
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:77)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112)
at org.elasticsearch.cli.MultiCommand.execute(MultiCommand.java:95)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112)
at org.elasticsearch.cli.Command.main(Command.java:77)
at org.elasticsearch.plugins.cli.PluginCli.main(PluginCli.java:36)

Resolution

The LTR plugin requires Java 14+ as runtime for Elasticsearch starting with Elasticsearch 7.14. This means that your Elasticsearch nodes must be using Java 14 as the minimum version.

Resolution DXP 7.3-7.4

The recommended resolution for Liferay DXP 7.3 and 7.4 deployments is to update the Java version of your Elasticsearch cluster nodes to Java 14+ based on the Elasticsearch and JVM Support Matrix. Remember: the Java REST Client (used inside the Elasticsearch 7 connector of DXP 7.3 and 7.4) communicates with Elasticsearch over HTTP. This communication protocol does not require Java serialization between DXP and Elasticsearch as opposed to the previous Transport Client-based connectors. This means that your Elasticsearch nodes can run on different JVM than what your DXP deployment is using. (You can learn more about the connectors here.)

Resolution DXP 7.2

(This approach also applicable to Liferay DXP 7.3-7.4 deployments, though not recommended due to the extra steps.)

The Transport Client (used inside the Elasticsearch connectors for Liferay DXP 7.2) relies on Java serialization. Because of this, the Major version and the Vendor of the JVM used by DXP and Elasticsearch must be the same. As Liferay DXP 7.2 does not support Java 14+ at this moment, you need to re-compile the plugin manually to be compatible with Java 8 and Java 11:

  1. [Fork and) clone https://github.com/o19s/elasticsearch-learning-to-rank
  2. Make sure you have JDK8 or JDK11 installed ant configured in your environment (JAVA_HOME, PATH)
  3. Navigate to your local copy of the repository
  4. Create a new branch off of the required version based on the available tags, for example git checkout -b v1.5.8-es7.17.1-jdk8 v1.5.8-es7.17.1
  5. Edit the main build.gradle file inside the repository root similar to this commit
  6. Follow the Build and Deploy Locally instructions to build the plugin zip file and install it on your Elasticsearch node/s

Related

https://issues.liferay.com/browse/LPS-148574


Elastic, Elasticsearch, and X-Pack are trademarks of Elasticsearch BV, registered in the U.S. and in other countries.

On this page