Blacklisting OSGi Components
The Component Blacklist is a convenient way to manage multiple OSGi Declarative Service Components (components). The list is an OSGi configuration that DXP uses to disable components. These lists save you the trouble of modifying them individually with the Application Manager or Gogo shell.
The blacklist can be exported from the Control Panel to an OSGi configuration (.config
) file. Modifying the file and deploying it to DXP has these additional effects:
- Persists the changes across DXP server startups
- Propagates the changes from a local cluster node to all the other nodes.
Blacklisting components using the UI and a config file is demonstrated.
Blacklisting Components
Follow these steps to disable OSGi components:
-
In the Control Panel, navigate to Configuration → System Settings → Module Container. The Component Blacklist screen appears.
-
In the Component Blacklist screen, add the names of components to disable, and click the Save button. The components disable immediately.
-
To export the blacklist, click on the Component Blacklist module’s Actions button () and then click Export. The blacklist configuration file then downloads (
com.liferay.portal.component.blacklist.internal.ComponentBlacklistConfiguration.config
). Here are contents of the file produced from the example list:blacklistComponentNames=["com.liferay.portal.security.ldap.internal.authenticator.LDAPAuth","com.liferay.ip.geocoder.sample.web.internal.portlet.IPGeocoderSamplePortlet "]
-
Add the names of any components not already listed (e.g., components of modules not yet installed) that you want to prevent from enabling.
ImportantConfiguration values can’t contain extra spaces. Extra spaces can short-circuit lists or invalidate the configuration entry.
-
To deploy the configuration file, copy it into the folder
[Liferay Home]/osgi/configs
. The Liferay Home folder is typically the app server’s parent folder.
Re-enabling Blacklisted Components
To re-enable and permit enabling of blacklisted OSGi components, follow these steps:
-
Open the configuration file
[Liferay Home]/osgi/configs/com.liferay.portal.component.blacklist.internal.ComponentBlacklistConfiguration.config
. -
Remove the names of the components from the
blacklistComponentNames
list and save the file.
To enable all the blacklisted components, remove the configuration file.
To temporarily re-enable a blacklisted component, remove its name from the Component Blacklist Configuration module in System Settings and click Update. If you’re using a component blacklist config file (in the [Liferay Home]/osgi/configs
folder) and want the component to enable on subsequent server startup, make sure to remove the component’s name from the file.
Congratulations! Now you can manage multiple components using a simple list.