Sometimes on portlet development, we need to write and read file inside WEB-INf folder …
if we use tomcat as web apllication server, liferay automatically create context.xml on META-INF folderwith the following content :
antiJARLocking=”true”
antiResourceLocking=”true”
The fact that application is ran from temp folder is most likely due to configuration in META-INF/context.xml (see Tomcat docs for more information about in this subject).
so if invoke the following code to get real path :
PortletUtils.getRealPath(getPortletContext(), “”)
it will return temp folder, not webapps folder.
to avoid this thing happen, change context.xml above with the following line :
antiJARLocking=”false”
antiResourceLocking=”false”
then restart the application server.
this will solve the realpath problem, and now the application will return webappas folder not temp folder …
(tested on liferay 5.2.3, tomcat 6.0.18)
One thought on “Liferay at glance [realPath problem]”