Skip to main content


Showing posts from March, 2010
How to Access Spring Application Context from JSR-168 Portlet
Step 1 :
Make sure you have spring-webmvc-portlet.jar in your project classpath
Step 2 : Make sure you defined your spring files in web.xml like this <context-param> <param-name>contextConfigLocation</param-name> <param-value> classpath:applicationContext-dao.xml classpath:applicationContext-services.xml classpath:applicationContext-schedule.xml classpath:applicationContext-ajax.xml </param-value> </context-param>
Optional <servlet> <servlet-name>context</servlet-name> <servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet>
Step 3 : Access like this.
PortletContext pc = this.getPortletContext(); ApplicationContext context = PortletApplicationContextUtils.getWebApp…

Basic Log4j tutorial

Step 1 :
create file in $project_home/src/
log4j.appender.portlet = org.apache.log4j.FileAppender # log file will be in tomcat/logs/ log4j.appender.portlet.File = ${catalina.home}/logs/privatemessage.log log4j.appender.portlet.Append = false log4j.appender.portlet.layout = org.apache.log4j.PatternLayout log4j.appender.portlet.layout.ConversionPattern = %d{ABSOLUTE} [%t] %-5p %-30.30c{2} %x - %m %n
# only log errors log4j.rootCategory=WARN, portlet # log trace messages from this package and sub packages

Step 2 :
add these lines to web.xml <context-param> <param-name>log4jConfigLocation</param-name> <param-value></param-value> </context-param>
Step 3 : Use logger in your java classes, before add log4j library to your project classpath // add imports import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory;
// define private static Log logger = LogFa…

Liferay 5.2.3 Solr Integration

Liferay Solr Integration
Environment: Liferay 5.2.3 or 5.2.5 Solr 1.4 solr-web-
Follow these steps
Step 1:
Add the below line to or catalina.bat, i.e setting the $SOLR_HOME dir (/content/liferay/data/solr)
set JAVA_OPTS=%JAVA_OPTS% -Dsolr.solr.home="C:\solr1"
Step 2:
Copy conf directory from solr downloaded (apache-solr-1.4.0\example\solr\conf) to the $SOLR_HOME (/content/liferay/data/solr) from step 1
Step 3:
Replace $SOLR_HOME/conf/schema.xml with solr-web-
Step 4: Edit $SOLR_HOME/conf/solrconfig.xml change this line with appropriate dir ... to /content/liferay/data/solr/data/
Step 5: Restart
Step 6: deploy your solr-web from control panel or deploy dir, also you can download that from here solr-web-
Step 7: run reindex in liferay control panel->server administration
Step 8: Restart

Liferay Jackrabbit Oracle integration

Follow these steps to integrate Liferay, Jackrabbit, and Oracle.

Step 1 :

Copy the below lines into


Step 2 :

Replace the content of liferay-installation/data/jackrabbit/repository.xml with below xml text and then restart
<?xml version="1.0"?> <Repository> <!--<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem"> <param name="path" value="${rep.home}/repository" /> </FileSystem>--> <!-- Database File System (Cluster Configu…