Issue
- After configuring the "ehcache.multi.vm.config.location" property in portal-ext.properties, the following errors occurred.
ERROR [SCR Component Actor][ROOT:47] bundle com.liferay.portal.cache.ehcache.impl:4.0.33 (439)[com.liferay.portal.cache.ehcache.internal.MultiVMEhcachePortalCacheManager(2201)] : The activate method has thrown an exception
java.lang.NullPointerException: Configuration path is null
at com.liferay.portal.cache.ehcache.internal.configurator.EhcachePortalCacheManagerConfigurator.getConfigurationObjectValuePair(EhcachePortalCacheManagerConfigurator.java:59) ~[?:?]
ERROR [SystemExecutorServiceUtil-5][ROOT:47] bundle com.liferay.portal.cache.ehcache.impl:4.0.33 (439)[com.liferay.portal.cache.ehcache.internal.MultiVMEhcachePortalCacheManager(2201)] : The activate method has thrown an exception
java.lang.NullPointerException: Configuration path is null
WARN [SystemExecutorServiceUtil-5][ROOT:53] bundle com.liferay.portal.cache.impl:4.0.33 (1371)[com.liferay.portal.cache.internal.MultiVMPoolImpl(6303)] : Could not get service from ref {com.liferay.portal.kernel.cache.PortalCacheManager}={component.id=2201, component.name=com.liferay.portal.cache.ehcache.internal.MultiVMEhcachePortalCacheManager, service.id=2549, portal.cache.manager.name=MULTI_VM_PORTAL_CACHE_MANAGER, service.scope=bundle, service.bundleid=439}
Environment
- Quarterly Release
Resolution
-
Reason for an error occured:
- The issue arises due to the incorrect path
"/Liferay_Home/liferay-multi-vm.xml"and the use of the same file name,"liferay-multi-vm.xml".
- The issue arises due to the incorrect path
-
Reason for not using the same file name:
- By default, in Liferay's portal.properties (located within the
portal-impl.jar), the following properties are configured:
# Set the classpath to the location of the Ehcache config file for internal # caches. Edit the file specified in the property # "ehcache.multi-vm.config.location" to enable clustered cache. # # Env: LIFERAY_EHCACHE_PERIOD_MULTI_PERIOD_VM_PERIOD_CONFIG_PERIOD_LOCATION # Env: LIFERAY_EHCACHE_PERIOD_SINGLE_PERIOD_VM_PERIOD_CONFIG_PERIOD_LOCATION # ehcache.single.vm.config.location=/ehcache/liferay-single-vm.xml ehcache.multi.vm.config.location=/ehcache/liferay-multi-vm.xml- The file name
liferay-multi-vm.xmlis already in use and is present within the following location:osgi/portal/com.liferay.portal.cache.ehcache.impl.jarin theehcachefolder. - This conflict causes the issue. Changing the file name ensures there is no overlap with the default configurations provided by Liferay.
- Additionally, it is a good practice to modify both the package/directory name and the file name to make it clearer and more obvious what changes were made.
- By default, in Liferay's portal.properties (located within the
-
To resolve the error follow the below steps:
-
-
Create a Folder:
- Navigate to the
classesdirectory at the path:tomcat/webapps/ROOT/WEB-INF/classes. - Create a folder such as 'cache' in the "classes" folder
- Navigate to the
-
Modify the File Name:
- Rename the file from
liferay-multi-vm.xmlto a different name, such asmodule-multi-vm.xmland paste it into a location:tomcat/webapps/ROOT/WEB-INF/classes/cache.
- Rename the file from
-
Add the below property with the correct location using the relative path:
- Example:
ehcache.multi.vm.config.location=cache/module-multi-vm.xml - Note: Use the relative path shown in the above example instead of the absolute one.
- Example:
-
Restart the server:
- Delete the $LIFERAY_HOME/OSGi/state folder.
- Delete the $LIFERAY_HOME/Work folder
- Delete the tomcat-version/temp folder
- Delete the tomcat-version/work folder
Note:
1) Try the above action in a lower environment first, if all works well according to you, then only move to the production environment at your discretion.
2) Keep the backup of your existing environment before performing the above action.
3) Perform these operations in application server downtime, because these steps require the restart of the server. -
Create a Folder:
-