Issue
- The error java.lang.RuntimeException: Unable to install analysis-icu plugin error is produced when starting Liferay using an embedded Elasticsearch
- This error prevents the embedded Elasticsearch to start correctly.
2022-01-21 13:05:06.079 WARN [Elasticsearch Initialization Thread][EmbeddedElasticsearchConnection:297] Liferay is configured to use embedded Elasticsearch as its search engine. Do NOT use embedded Elasticsearch in production. Embedded Elasticsearch is useful for development and demonstration purposes. Refer to the documentation for details on the limitations of embedded Elasticsearch. Remote Elasticsearch connections can be configured in the Control Panel. 2022-01-21 13:05:06.676 ERROR [main][ElasticsearchEngineConfigurator:93] bundle com.liferay.portal.search.elasticsearch6.impl:3.0.89.hotfix-6159-7210 (107)[com.liferay.portal.search.elasticsearch6.internal.ElasticsearchEngineConfigurator(112)] : The activate method has thrown an exception java.lang.RuntimeException: Unable to initialize Elasticsearch engine at com.liferay.portal.search.elasticsearch6.internal.ElasticsearchEngineConfigurator.initialize(ElasticsearchEngineConfigurator.java:130) at com.liferay.portal.search.elasticsearch6.internal.ElasticsearchEngineConfigurator.activate(ElasticsearchEngineConfigurator.java:65) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) [...] at com.liferay.portal.bootstrap.ModuleFrameworkImpl._registerService(ModuleFrameworkImpl.java:1571) at com.liferay.portal.bootstrap.ModuleFrameworkImpl.lambda$_registerApplicationContext$4(ModuleFrameworkImpl.java:1524) at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133) at com.liferay.portal.bootstrap.ModuleFrameworkImpl._registerApplicationContext(ModuleFrameworkImpl.java:1509) at com.liferay.portal.bootstrap.ModuleFrameworkImpl.registerContext(ModuleFrameworkImpl.java:324) at com.liferay.portal.module.framework.ModuleFrameworkUtilAdapter.registerContext(ModuleFrameworkUtilAdapter.java:72) at com.liferay.portal.util.InitUtil.registerContext(InitUtil.java:290) at com.liferay.portal.tools.DBUpgrader.main(DBUpgrader.java:125) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at com.liferay.portal.tools.db.upgrade.client.DBUpgraderLauncher.main(DBUpgraderLauncher.java:55) Caused by: java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unable to install analysis-icu plugin at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191) at com.liferay.portal.search.elasticsearch6.internal.ElasticsearchEngineConfigurator.initialize(ElasticsearchEngineConfigurator.java:127) ... 126 more Caused by: java.lang.RuntimeException: Unable to install analysis-icu plugin at com.liferay.portal.search.elasticsearch6.internal.connection.EmbeddedElasticsearchConnection.installPlugin(EmbeddedElasticsearchConnection.java:384) at com.liferay.portal.search.elasticsearch6.internal.connection.EmbeddedElasticsearchConnection.installPlugins(EmbeddedElasticsearchConnection.java:400) at com.liferay.portal.search.elasticsearch6.internal.connection.EmbeddedElasticsearchConnection.createNode(EmbeddedElasticsearchConnection.java:355) at com.liferay.portal.search.elasticsearch6.internal.connection.EmbeddedElasticsearchConnection.createClient(EmbeddedElasticsearchConnection.java:308) at com.liferay.portal.search.elasticsearch6.internal.connection.BaseElasticsearchConnection.connect(BaseElasticsearchConnection.java:65) at com.liferay.portal.search.elasticsearch6.internal.connection.ElasticsearchConnectionManager.connect(ElasticsearchConnectionManager.java:71) at com.liferay.portal.search.elasticsearch6.internal.ElasticsearchEngineConfigurator.lambda$initialize$0(ElasticsearchEngineConfigurator.java:114) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.lang.Thread.run(Thread.java:834) Caused by: java.nio.file.FileSystemException: /opt/liferay-dxp-7.2.10.1-sp1/data/elasticsearch6/plugins/analysis-icu/analysis-icu-client-6.8.15.jar: Operation not permitted at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:100) at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111) at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116) at java.base/sun.nio.fs.UnixFileAttributeViews$Posix.setMode(UnixFileAttributeViews.java:254) at java.base/sun.nio.fs.UnixFileAttributeViews$Posix.setPermissions(UnixFileAttributeViews.java:276) at java.base/java.nio.file.Files.setPosixFilePermissions(Files.java:2079) at org.elasticsearch.plugins.InstallPluginCommand.setFileAttributes(InstallPluginCommand.java:945) at org.elasticsearch.plugins.InstallPluginCommand.access$000(InstallPluginCommand.java:123) at org.elasticsearch.plugins.InstallPluginCommand$1.visitFile(InstallPluginCommand.java:855) at org.elasticsearch.plugins.InstallPluginCommand$1.visitFile(InstallPluginCommand.java:846) at java.base/java.nio.file.Files.walkFileTree(Files.java:2724) at java.base/java.nio.file.Files.walkFileTree(Files.java:2796) at org.elasticsearch.plugins.InstallPluginCommand.movePlugin(InstallPluginCommand.java:846) at org.elasticsearch.plugins.InstallPluginCommand.installPlugin(InstallPluginCommand.java:822) at org.elasticsearch.plugins.InstallPluginCommand.install(InstallPluginCommand.java:786) at org.elasticsearch.plugins.InstallPluginCommand.execute(InstallPluginCommand.java:232) at org.elasticsearch.plugins.InstallPluginCommand.execute(InstallPluginCommand.java:217) at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) at org.elasticsearch.cli.MultiCommand.execute(MultiCommand.java:77) at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) at org.elasticsearch.cli.Command.main(Command.java:90) at com.liferay.portal.search.elasticsearch6.internal.connection.PluginManagerImpl.main(PluginManagerImpl.java:136) at com.liferay.portal.search.elasticsearch6.internal.connection.PluginManagerImpl.lambda$install$0(PluginManagerImpl.java:77) at com.liferay.portal.search.elasticsearch6.internal.connection.PluginJarConflictCheckSuppression.lambda$execute$0(PluginJarConflictCheckSuppression.java:27) at com.liferay.portal.search.elasticsearch6.internal.connection.PluginJarConflictCheckSuppression.execute(PluginJarConflictCheckSuppression.java:39) at com.liferay.portal.search.elasticsearch6.internal.connection.PluginJarConflictCheckSuppression.execute(PluginJarConflictCheckSuppression.java:25) at com.liferay.portal.search.elasticsearch6.internal.connection.PluginManagerImpl.install(PluginManagerImpl.java:74) at com.liferay.portal.search.elasticsearch6.internal.connection.EmbeddedElasticsearchPluginManager.downloadAndExtract(EmbeddedElasticsearchPluginManager.java:96) at com.liferay.portal.search.elasticsearch6.internal.connection.EmbeddedElasticsearchPluginManager.install(EmbeddedElasticsearchPluginManager.java:56) at com.liferay.portal.search.elasticsearch6.internal.connection.EmbeddedElasticsearchConnection.installPlugin(EmbeddedElasticsearchConnection.java:381) ... 8 more
Environment
- DXP 7.2
Resolution
The error is happening in the embedded Elasticsearch when preparing the [LIFERAY_HOME]/data/elasticsearch6/plugin directory with the different Elasticsearch modules
At this moment:- Liferay extracts the Elasticsearch plugins from the Elasticsearch LPKG file
- Liferay copies them to a temporary folder and for each one.
- Liferay executes the
org.elasticsearch.plugins.InstallPluginCommand
command from Elasticsearch code to move the plugins to their final location and install them.
Caused by: java.nio.file.FileSystemException: [LIFERAY_HOME]/data/elasticsearch6/plugins/analysis-icu/analysis-icu-client-6.8.15.jar: Operation not permitted
error is thrown when the embedded Elasticsearch cannot access or modify the JAR file permissions.
To solve the problem, check that:
- The [LIFERAY_HOME]/data/elasticsearch6 and [LIFERAY_HOME]/data/elasticearch6/plugin folders are owned by the user used to execute the Liferay server and it has enough permissions to create subfolders and files
- The [LIFERAY_HOME]/data/elasticsearch6 folder is a path to a local file system, i. e: it is not a mounted NFS or similar network drive.
- The touch and chmod commands work correctly in this folder: for example, these lines should work:
- touch [LIFERAY_HOME]/data/elasticearch6/plugin/dummy
- chmod 644 [LIFERAY_HOME]/data/elasticearch6/plugin/dummy
- If these lines don't work, there would be a filesystem problem at the operating system level.