Skip to main content

Posts

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 = Portle...

Basic Log4j tutorial

Step 1 : create file log4j.properties 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 log4j.logger.com.cisco.project=TRACE Step 2 : add these lines to web.xml <context-param> <param-name>log4jConfigLocation</param-name> <param-value>classpath:log4j.properties</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 priv...

Liferay 5.2.3 Solr Integration

Liferay Solr Integration Environment: Liferay 5.2.3 or 5.2.5 Solr 1.4 solr-web-5.2.3.1.war Follow these steps Step 1: Add the below line to catalina.sh 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-5.2.3.1/WEB-INF/conf/schema.xml 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-5.2.3.1 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 portal-ext.properties dl.hook.impl=com.liferay.documentlibrary.util.JCRHook jcr.initialize.on.startup=true jcr.workspace.name=liferay jcr.node.documentlibrary=documentlibrary jcr.jackrabbit.repository.root=${liferay.home}/data/jackrabbit jcr.jackrabbit.config.file.path=${jcr.jackrabbit.repository.root}/repository.xml jcr.jackrabbit.repository.home=${jcr.jackrabbit.repository.root}/home jcr.jackrabbit.credentials.username=none jcr.jackrabbit.credentials.password=none 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>--> <!-- Data...