Posts

Showing posts from March, 2021

Liferay 7: Global Resource Bundle

Image
   Global Resource Bundle for Liferay 7 Overview Liferay Resource Bundle is used for messages translation on the portal. Each module may have it’s own Resource Bundle. This article explains how to create a “global” one, with translations available for any other module, including the Liferay core modules. Implementation 1. Create a module with the following structure: 2. Define dependencies in build.grade : dependencies {     compileOnly group : "com.liferay.portal" , name : "com.liferay.portal.kernel"     compileOnly group : "com.liferay.portal" , name : "com.liferay.util.taglib"     compileOnly group : "javax.portlet" , name : "portlet-api"     compileOnly group : "javax.servlet" , name : "javax.servlet-api"     compileOnly group : "jstl" , name : "jstl"     compileOnly group : "org.osgi" , name : "osgi.cmpn" } 3. Create a bundle descriptor bnd.bdn : Bundle-Name : Li

Liferay Blacklist Configuration

Image
 How to Remove a Bundle from the Blacklist in Liferay 7 Overview This article will explain how to remove a bundle from the Liferay’s Blacklist with the settings in the Control Panel. Preface Liferay may add your bundle into a “black list” if you, for example, uninstall your bundle in the Apps Manager: In this case any subsequent deploys will not actually deploy your bundle, and you’ll see something like this in logs: 2021-03-23 07:49:58.854 INFO  [com.liferay.portal.kernel.deploy.auto.AutoDeployScanner][AutoDeployDir:261] Processing journal.edit.article.hook-1.0.2.jar 2021-03-23 07:51:09.765 INFO  [fileinstall-/opt/liferay/osgi/modules][BundleBlacklist:188] Stopping blacklisted bundle journal.edit.article.hook_1.0.2  To make your bundle available again - you need to remove it from the blacklist. Configuration To remove the bundle from the blacklist, you need: Go to Control Panel -> Configuration -> System Settings; Click on “Module Container” in “Platform” section: Check if your

HttpClient and Liferay 7 OSGi modules

 HttpClient and Liferay 7 OSGi modules Overview Apache HttpClient is a popular library, which simplifies interaction with remote HTTP server or API. But, as with any third-party library, it’s tricky to make it work inside Liferay’s OSGi world. This article explains how to do it. Configuration build.gradle: compileOnly group : "org.apache.httpcomponents" , name : "httpclient" , version : "4.5.11" compileOnly group : "org.apache.httpcomponents" , name : "httpcore" , version : "4.4.13" bnd.bnd: Bundle-Name : LifeDev HttpClient Sample Bundle-SymbolicName : com.lifedev.httpclient.sample Bundle-Version : 1.0.0 Export-Package : com.lifedev.httpclient.sample.constants -includeresource : \   lib/httpclient.jar=httpclient-4.5.11.jar;lib :=true,\   lib/httpcore.jar=httpcore-4.4.13.jar;lib :=true,\    lib/commons-codec.jar=commons-codec-1.13.jar;lib:=true Note: “-includeresource” part is important here. Otherwise, you may get errors like: