Using Portal Properties for Separate Liferay Instances

Much like the file, portal-${instance}.properties files override properties set in and other files for a specific Liferay instance. This article outlines the steps necessary to enable these portal properties files for a single instance.


Note: This solution is not applicable for DXP 7.3 and above.
  1. Go to Control Panel > Server Administration > Portal Instance and note the Web ID's of the two (or more) portal instances that you have. If you have not created a second instance, create one in this step.
  2. Shut down the Liferay server, and navigate to ${tomcat_Home}/webapps/ROOT/WEB-INF/classes and create a property file for each portal instance. Title each file in the following manner:

    So for instance, the Web ID of the default Liferay instance is Therefore, the portal-{$instance}.properties file for this instance would be called:
  3. In the same path, create a file, and add the following line to the file:
  4. Open sentev.bat (or in Linux) in {$tomcat_Home}/bin and add the following line to the Java Settings:
  5. Open the portal-{$instance}.properties files and add the following line to each of them

    Give a value of false to at least one of these files, and a value of true to the others.

  6. Start the portal and see that this property is properly applied according to the setting given this property. Also, look at the stacktrace and look to see that the portal-{$instance}.properties files had loaded. The logs should show an output simliar to below if the files are loaded properly:
    Loading file:/D:/Customer_Environment/liferay-portal-6.1.20-ee-ga2/ for {companyId=10154,}
    Loading file:/D:/Customer_Environment/liferay-portal-6.1.20-ee-ga2/tomcat-7.0.27/webapps/ROOT/WEB-INF/classes/ for {companyId=10154,} ...
    Loading file:/D:/Customer_Environment/liferay-portal-6.1.20-ee-ga2/ for {companyId=10435,}
    Loading file:/D:/Customer_Environment/liferay-portal-6.1.20-ee-ga2/tomcat-7.0.27/webapps/ROOT/WEB-INF/classes/ for {companyId=10435,}

    If the property terms.of.use.required= properly applied to each instance, and the two portal-${instance}.properties files both loaded in the stacktrace, then the portal-${instance}.properties have been utilized successfully.


Limited Properties

Not every property is configurable on an instance-by-instance basis. Most properties, in fact, are not configurable by instance. In many cases, two separate bundles work better to meet customers' needs. If using portal instances with distinct property sets is a requirement, however, this list comprises the types of properties that are configurable by instance:

  • Google Apps
  • Facebook Connect SSO
  • CAS
  • OpenSSO
  • Admin Portlet
  • SiteMinder
  • LDAP Content Delivery Network
  • Email section under Flags portlet
  • Email section under Configure email notification settings for discussions.
  • Trash
  • OpenSSO
  • Email notification session under Discussion Tag Library
  • NTLM
  • Openid
  • Users

Note: If you would like to find out if a specific property is configurable per-instance, review the source code to see if the properties are using the CompanyId in the method. For example, the property has CompanyId connected to it:


Therefore, the above example passes the Company ID in the method. This is one way to see if a property should be configurable by a per instance basis. If the Company ID is not passed in its method, it is likely that it cannot be configured by instance.


Best Practice

Liferay recommends configuring properties on a per-instance basis via the Control Panel and not through distinct Portal-{$instance}.properties files. See this description in the file:

# Each portal instance can have its own overriden property file following
# the convention To enable this feature, set
# the "company-id-properties" system property to true.
# To enable:
# java ... -Dcompany-id-properties=true
# The read order will now be:, then,
# and then
# Note that not all properties can have different values per company. This
# functionality is only available for legacy reasons. The preferred way to
# configure a portal instance is through the Control Panel.
0 人中有 0 人觉得有帮助