Liferay Enterprise Search
- [LES]: How to install and run the Elastic Support Diagnostics Troubleshooting Utility
 - [LES] About Elasticsearch License expiration
 - [LES] Elasticsearch Virtual Machine Considerations
 - [LES] Getting Started with Liferay Enterprise Search
 - [LES] How to use a load balancer with Elasticsearch?
 - [LES] Installing the Learning-to-Rank plugin on Elasticsearch fails with "IllegalStateException: ltr requires Java 14"
 - [LES] What is the recommended Java heap size for Elasticsearch?
 - [LES] Which node types are charged as part of the Liferay Enterprise Search Subscription
 - Easily customize Liferay's search behavior with Blueprints
 - Elasticsearch 7.17 End of Life (EOL) Timeline and Liferay DXP Elasticsearch Compatibility Update & FAQ
 - Liferay Enterprise Search Experiences (Blueprints) 1.1.0 for DXP 7.3 Release Highlights & Upgrade Instructions
 
[LES] Installing the Learning-to-Rank plugin on Elasticsearch fails with "IllegalStateException: ltr requires Java 14"
Environment
- Liferay DXP 7.2+
 - Elasticsearch 7.14+ with Java version below 14
 - Learning-to-Rank plugin for Elasticsearch
 
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:
- [Fork and) clone https://github.com/o19s/elasticsearch-learning-to-rank
 - Make sure you have JDK8 or JDK11 installed ant configured in your environment (JAVA_HOME, PATH)
 - Navigate to your local copy of the repository
 - 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 - Edit the main 
build.gradlefile inside the repository root similar to this commit - 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.