Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Raymond Gardner
Order of loading portal-ext.properties files
August 20, 2012 2:54 PM
Answer

Raymond Gardner

Rank: Regular Member

Posts: 115

Join Date: July 14, 2011

Recent Posts

We are using multiple portal-ext.properties files in our Liferay instances.

One gets deployed under the ROOT/WEB-INF/classes folder and can change from one deployment to the next.
The other gets deployed under the $LIFERAY_HOME folder and has limited properties in it. This one is used
for settings specific to this instance's environment, such as, which database to point to. This one will not be changed
from one deployment to the next.

The $LIFERAY_HOME properties file was being read in last and thus any settings in this file would override settings
in the other file.

However, I just installed CE GA2 and it is now reading the properties files in the reverse order:
Loading file:/.../liferay-portal-6.1.1-ce-ga2/portal-ext.properties
Loading file:/.../liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/webapps/ROOT/WEB-INF/classes/portal-ext.properties

This is causing our properties to not be set appropriately due to over lapping properties.

Isn't $LIFERAY_HOME suppose to be the final/last place for the startup process to look for a properties file?
Hitoshi Ozawa
RE: Order of loading portal-ext.properties files
August 20, 2012 3:09 PM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7949

Join Date: March 23, 2010

Recent Posts

Order of the properties files are written in the portal.properties file. Maybe, you should have used portal-bundle.properties or portal-setup-wizard.properties

##
## Properties Override
##

#
# Specify where to get the overridden properties. Updates should not be made
# on portal.properties or on portal-bundles.properties, but in
# portal-ext.properties.
#
# The default read order is: portal.properties, portal-bundle.properties,
# portal-ext.properties, and then portal-setup-wizard.properties.
#
include-and-override=portal-bundle.properties
include-and-override=${liferay.home}/portal-bundle.properties
include-and-override=portal-ext.properties
include-and-override=${liferay.home}/portal-ext.properties
include-and-override=portal-setup-wizard.properties
include-and-override=${liferay.home}/portal-setup-wizard.properties
Raymond Gardner
RE: Order of loading portal-ext.properties files
August 20, 2012 4:22 PM
Answer

Raymond Gardner

Rank: Regular Member

Posts: 115

Join Date: July 14, 2011

Recent Posts

Hitoshi Ozawa:
Order of the properties files are written in the portal.properties file. Maybe, you should have used portal-bundle.properties or portal-setup-wizard.properties

##
## Properties Override
##

#
# Specify where to get the overridden properties. Updates should not be made
# on portal.properties or on portal-bundles.properties, but in
# portal-ext.properties.
#
# The default read order is: portal.properties, portal-bundle.properties,
# portal-ext.properties, and then portal-setup-wizard.properties.
#
include-and-override=portal-bundle.properties
include-and-override=${liferay.home}/portal-bundle.properties
include-and-override=portal-ext.properties
include-and-override=${liferay.home}/portal-ext.properties
include-and-override=portal-setup-wizard.properties
include-and-override=${liferay.home}/portal-setup-wizard.properties



But the order you specify here indicates Liferay Home, item 4 in this list, gets read in after the general, item 3 in the list.
So, why is the reverse happening during my startup?

Perhaps we should switch the Liferay Home file to be the portal-setup-wizard.properties.
Hitoshi Ozawa
RE: Order of loading portal-ext.properties files
August 22, 2012 6:31 PM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7949

Join Date: March 23, 2010

Recent Posts

This won't be an answer to your question, but I'm just appending the server particular setup after the default in portal-ext.properties. Better to keep properties in one place so I'll just be able to see all setting by opening up 1 file when something goes wrong. Also, a lot easier to do a compare. I like to keep my system as simple as possible. :-)
David H Nebinger
RE: Order of loading portal-ext.properties files
August 22, 2012 7:00 PM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 11464

Join Date: September 1, 2006

Recent Posts

Since Liferay uses EasyConf for the properties handling, I leverage that for the properties files.

At the end of portal-ext.properties, include a line like:

1include-and-override=portal-ext-${portal.host}.properties


Then all you need to do is add a "-Dportal.host=someval" to the JAVA_OPTS for starting Liferay.

It will then end up including portal-ext-someval.properties in.

This way each instance should have it's own portal.host value and each one will include the values from it's own properties file.
Keith Freeman
RE: Order of loading portal-ext.properties files
August 23, 2012 1:34 PM
Answer

Keith Freeman

Rank: New Member

Posts: 11

Join Date: October 12, 2010

Recent Posts

I'm trying to do the same thing with 6.1.1-ga2, but can't get my extra properties file to load. Where did you put your "portal-ext-someval.properties" in this example? I'm putting mine in the same directory as portal-ext.properties (i.e. the directory that contains tomcat-7.0.27), and I've tried both

include-and-override=portal-ext-custom.properties

and

include-and-override=${liferay-home}/portal-ext-custom.properties

with no luck.
Hitoshi Ozawa
RE: Order of loading portal-ext.properties files
August 23, 2012 2:25 PM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7949

Join Date: March 23, 2010

Recent Posts

Take a look at the portal-developer.properties documentation.

http://www.liferay.com/community/wiki/-/wiki/Main/Liferay+Developer+Mode
Keith Freeman
RE: Order of loading portal-ext.properties files
August 27, 2012 6:34 AM
Answer

Keith Freeman

Rank: New Member

Posts: 11

Join Date: October 12, 2010

Recent Posts

Hitoshi- Not sure what you were referring to in that documentation? Are you saying I have to use the -Dexternal-properties property instead of include-and-override in my portal-ext.properties file?