Friday, November 11, 2011

Vaadin Portlet Sizing ... this just in...

I have been having very strange an frustrating results with the portlet sizing using Vaadin. I have been experimenting with this a lot and have found the major source of my pain.

With portlet development you basically have 3 strategies you can employ (and will likely use a combination of the three).

1 - size the portlet main window and resize your components to that.
2 - size the portlet dynamically to the size of its containing components and let them drive the size of the overall portlet.
3 - size and position the components using style sheets.

The current portlet I am woking on uses expandable panels and need to use method 1.

I tried setting the size on the application main window in Vaadin without much success... so I started trying to debug the layouts. I recently installed Vaadin 6.7.1 One of the very nice features they have is the ability to analyze your layouts from the Vaadin debug window. To use this, open the debug window by appending ?debug to the end of the url to the page your portlet resides on. Click the AL button and watch your portal log files to view data.

The original code I used was:

 Window window = new Window();  
 window.setContent(mainLayout);  
 window.setWidth("1000px");  
 window.setHeight("600px");  
 MainMessagingView messagesView = new MainMessagingView();  
 messagesView.setSizeFull();  
 window.removeAllComponents();  
 window.addComponent(messagesView);  

This resulted in the portlet components not displaying.

The Vaadin Layout Analyzer showed:

  Window/12863f7 "" (height: MAIN WINDOW)  
  - VerticalLayout/b6992a (height: UNDEFINED)  
   - MainMessagingView/373de2 debugId: mainmessageviewinapplication (height: RELATIVE, 100.0 %)  
 Layout problem detected: Component with relative height inside a VerticalLayout with no height defined.  
 Relative sizes were replaced by undefined sizes, components may not render as expected.  

This was very strange to me as it was showing an extra Vertical Layout between the mainWindow and the Component I was putting on it. Upon further inspection I learned that Vaadin requires a Layout be set on the main window. If one is not set, it will put one a VerticalLayout on itself with size set to Undefined.

To fix this issue, I just added a new VerticalLayout of my own, and explicitly set the size to setSizeFull(). All components sized properly after that.

 Window window = new Window();  
                window.setContent(mainLayout);  
                window.setWidth("1000px");  
                window.setHeight("600px");  
                VerticalLayout mainLayout = new VerticalLayout();  
                mainLayout.setSizeFull();  
                window.setContent(mainLayout);  
                MainMessagingView messagesView = new MainMessagingView();  
                messagesView.setSizeFull();  
                window.removeAllComponents();  
                window.addComponent(messagesView);  

Thursday, November 3, 2011

Vaading portlet sizing in Liferay

We have been doing a lot of work using Vaadin as our component library for the creation of Liferay portlets. This library has been great. One of the most frustrating pieces has been getting the sizing and layouts of the components to work properly. These are a few of the things I have found:

There are several issues with the sizing of the portlets:
1 - since they are within the portal, they do not consume the full area of the browser as a servlet application would.
2 - Liferay controls the sizing of the portlet.
3 - The browser could be resized..

There are a couple of strategies for the sizing, and you have to examine every element in your dom tree to ensure you are being consistent or it could result in a seemingly inexplicable 'blank' portlet.

Strategy 1 - size the portlet to the size of the components in the portlet.

Generally in this strategy, size the components at the leaves of your component tree, and set all of the parent layouts, panels, etc. to .setSizeUndefined();

If you do this... make sure you set the expandRatio() on all of the sized components so that the layouts know how to properly expand the components as the browser size changes.

Strategy 2 - set the full size of the portlet and display scroll bars if the browser changes.

This one to me is a little screwy in Liferay. This is due to the fact that Liferay does not set the actual size of the portlet container, which makes the dynamic sizing settings (setSizeFull, and setSizeUndefined, or setHeight(100%) not work properly).

One way to combat this is to explicitly set the size of the main window with main.setWidth() and main.setHeight(). Then set all child Layouts and Panels to setSizeFull().

A possibly better way to handle this is to add a setting to the portlet.xml file with the size of the portlet like so..

<init-param>
            <name>style</name>
            <value>height:600px</value>
        </init-param>

This *should* allow dynamic changing of the size via stylesheet later.

*TIP: Firebug is your friend in this. If the sizing is off for your portlet, the data will still exist in the dom, but it will just not be visisble on the screen. Firebug will show you the data, and you can typically see which element is causing the sizing issue if you navigate the dom in Firebug.

Sunday, January 9, 2011

Debugging failed portlet deployments in Liferay 6 / Tomcat 6

We are migrating from a Liferay 5.2.3/Glassfish v2.1 build to Liferay 6 / Tomcat 6. Several of the portlets which are deploying properly have been failing upon deployment. Find below a list of the steps to enable a high enough level of debugging in Tomcat to facilitate the debugging of this condition.

The behaviour is that I would deploy the portlet to the Liferay /deploy folder... Liferay would deploy, Tomcat would deploy, then upon Tomcat attempting to load the servlet context after deployment the logs would show the error:

INFO: Container org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/TestBackEndPortlet-1.0-SNAPSHOT] has not been started
Jan 9, 2011 11:37:14 AM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
Jan 9, 2011 11:37:14 AM org.apache.catalina.core.StandardContext start
SEVERE: Context [/TestBackEndPortlet-1.0-SNAPSHOT] startup failed due to previous errors

The steps to enable logging are are follows:

1 - Get tomcat-juli.jar and tomcat-juli-adapters.jar from the tomcat downloads page under 'extras'

2 - copy tomcat-juli.jar to %catalina_home%\bin folder (overwriting the one that is there).

3 - copy tomcat-juli-adapters.jar to %catalina_home%\lib folder

4 - create a log4j.properties file or log4j.xml file and add it to the %catalina_home%\lib folder
5 - download log4j.jar from the log4j site, copy to %catalina_home%\lib

6 - I also renamed the log4j.properties file in the %cataline_home%\webapps\ROOT\WEB-INF\classes folder to prevent any possible conflict. Not entirely sure if this is required or not.

Sample log4j.xml

<?xml version="1.0"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
    <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}:%L] %m%n" />
        </layout>
    </appender>

    <category name="com.ecyrd.jspwiki">
        <priority value="ERROR" />
    </category>

    <category name="com.germinus.easyconf">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.documentlibrary">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.jdbc">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.mail.service.impl.MailServiceImpl">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.mail.util">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.mail.util.DummyHook">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.mail.util.MailSessionFactoryBean">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.bean.BeanLocatorImpl">
        <priority value="WARN" />
    </category>

    <category name="com.liferay.portal.comm.CommLink">
        <priority value="DEBUG" />
    </category>

    <category name="com.liferay.portal.dao.jdbc.aop">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.dao.jdbc.util.DataSourceFactoryBean">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.deploy">
        <priority value="FINEST" />
    </category>

    <category name="com.liferay.portal.deploy.hot.HookHotDeployListener">
        <priority value="FINEST" />
    </category>

    <category name="com.liferay.portal.deploy.hot.PluginPackageHotDeployListener">
        <priority value="FINEST" />
    </category>

    <category name="com.liferay.portal.deploy.hot.ThemeLoaderHotDeployListener">
        <priority value="FINEST" />
    </category>

    <category name="com.liferay.portal.editor">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.editor.fckeditor.ConnectorAction">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.events.EventsProcessor">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.events.FixOracleAction">
        <priority value="INFO" />
    </category>

    <category name="com.liferay.portal.events.GarbageCollectorAction">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.events.LogMemoryUsageAction">
        <priority value="DEBUG" />
    </category>

    <category name="com.liferay.portal.events.LoginPostAction">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.events.LoginPreAction">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.events.LogoutPostAction">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.events.LogoutPreAction">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.events.LogSessionIdAction">
        <priority value="DEBUG" />
    </category>

    <category name="com.liferay.portal.events.LogThreadCountAction">
        <priority value="DEBUG" />
    </category>

    <category name="com.liferay.portal.events.ServicePreAction">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.events.ShutdownHook">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.image.ImageProcessorImpl">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.kernel.bean.PortalBeanLocatorUtil">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.kernel.deploy">
        <priority value="FINEST" />
    </category>

    <category name="com.liferay.portal.kernel.servlet.PortletContextListener">
        <priority value="INFO" />
    </category>

    <category name="com.liferay.portal.kernel.util.JavaProps">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.kernel.util.ServerDetector">
        <priority value="INFO" />
    </category>

    <category name="com.liferay.portal.lucene">
        <priority value="INFO" />
    </category>

    <category name="com.liferay.portal.lucene.IndexWriterFactory">
        <priority value="INFO" />
    </category>

    <category name="com.liferay.portal.lucene.LuceneFileExtractor">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.mirage">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.model.Image">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.model.ModelHintsUtil">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.plugin.PluginPackageUtil">
        <priority value="INFO" />
    </category>

    <category name="com.liferay.portal.pop">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.search.lucene.LuceneIndexSearcherImpl">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.security.auth.LDAPAuth">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.security.ldap">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.security.ldap.PortalLDAPUtil">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.security.permission.AdvancedPermissionChecker">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.security.permission.BasicPermissionChecker">
        <priority value="INFO" />
    </category>

    <category name="com.liferay.portal.security.permission.ResourceActionsUtil">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.security.pwd.RegExpToolkit">
        <priority value="WARN" />
    </category>

    <category name="com.liferay.portal.service.impl.LayoutLocalServiceImpl">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.service.impl.PermissionLocalServiceImpl">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.service.impl.PortalLocalServiceImpl">
        <priority value="INFO" />
    </category>

    <category name="com.liferay.portal.service.impl.PortalServiceImpl">
        <priority value="INFO" />
    </category>

    <category name="com.liferay.portal.service.impl.PortletLocalServiceImpl">
        <priority value="WARN" />
    </category>

    <category name="com.liferay.portal.service.impl.ReleaseLocalServiceImpl">
        <priority value="INFO" />
    </category>

    <category name="com.liferay.portal.service.impl.ResourceLocalServiceImpl">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.service.impl.ServiceComponentLocalServiceImpl">
        <priority value="INFO" />
    </category>

    <category name="com.liferay.portal.service.impl.ThemeServiceImpl">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.service.persistence.PermissionPool">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.service.persistence.ResourcePool">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.servlet">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.servlet.FriendlyURLServlet">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.servlet.ImageServlet">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.servlet.LanguageServlet">
        <priority value="WARN" />
    </category>

    <category name="com.liferay.portal.servlet.LuceneServlet">
        <priority value="INFO" />
    </category>

    <category name="com.liferay.portal.servlet.MainServlet">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.servlet.PortalSessionListener">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.servlet.SharedSessionUtil">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.servlet.SoftwareCatalogServlet">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.servlet.filters">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.servlet.filters.autologin.AutoLoginFilter">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.servlet.filters.compression">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.servlet.filters.doubleclick">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.servlet.filters.layoutcache">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.servlet.filters.sessionid.SessionIdFilter">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.servlet.filters.sessionid.SessionIdServletRequest">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.servlet.filters.strip">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.servlet.filters.velocity.VelocityFilter">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.servlet.filters.virtualhost.VirtualHostFilter">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.spring">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.spring.context.ArrayApplicationContext">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.spring.context.PortalApplicationContext">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.spring.context.PortletApplicationContext">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.spring.context.TunnelApplicationContext">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.spring.hibernate.DialectDetector">
        <priority value="INFO" />
    </category>

    <category name="com.liferay.portal.struts">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.struts.MultiMessageResources">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.struts.PortalRequestProcessor">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.struts.PortletRequestProcessor">
        <priority value="WARN" />
    </category>

    <category name="com.liferay.portal.struts.StrutsURLEncoder">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.struts.StrutsUtil">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.theme.ThemeLoader">
        <priority value="INFO" />
    </category>

    <category name="com.liferay.portal.tools.BaseDeployer">
        <priority value="FINEST" />
    </category>

    <category name="com.liferay.portal.tools.PortletDeployer">
        <priority value="FINEST" />
    </category>

    <category name="com.liferay.portal.tools.ThemeDeployer">
        <priority value="FINEST" />
    </category>

    <category name="com.liferay.portal.tools.sql.DBUtil">
        <priority value="INFO" />
    </category>

    <category name="com.liferay.portal.upgrade">
        <priority value="INFO" />
    </category>

    <category name="com.liferay.portal.util">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.util.CookieKeys">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.util.EntityResolver">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.util.MimeTypesUtil">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.util.PortalInstances">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.util.PortalImpl">
        <priority value="INFO" />
    </category>

    <category name="com.liferay.portal.velocity">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.velocity.ClassLoaderVelocityResourceListener">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.velocity.LiferayResourceLoader">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.velocity.ServletVelocityResourceListener">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.velocity.VelocityContextPool">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.verify">
        <priority value="INFO" />
    </category>

    <category name="com.liferay.portal.verify.VerifyUser">
        <priority value="INFO" />
    </category>

    <category name="com.liferay.portal.webdav">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portal.xml.SAXReaderImpl">
        <priority value="WARN" />
    </category>

    <category name="com.liferay.portlet.InvokerPortlet">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portlet.RenderRequestFactory">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portlet.RenderResponseFactory">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portlet.admin">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portlet.admin.action.EditServerAction">
        <priority value="INFO" />
    </category>

    <category name="com.liferay.portlet.alfrescocontent">
        <priority value="WARN" />
    </category>

    <category name="com.liferay.portlet.alfrescocontent.util.AlfrescoOpenSearchImpl">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portlet.blogs.service.impl.BlogsEntryLocalServiceImpl">
        <priority value="INFO" />
    </category>

    <category name="com.liferay.portlet.documentlibrary.webdav">
        <priority value="WARN" />
    </category>

    <category name="com.liferay.portlet.enterpriseadmin.action.EditUserPortraitAction">
        <priority value="INFO" />
    </category>

    <category name="com.liferay.portlet.journal">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portlet.journal.lar.JournalContentPortletDataHandlerImpl">
        <priority value="WARN" />
    </category>

    <category name="com.liferay.portlet.journal.service.impl.JournalContentSearchLocalServiceImpl">
        <priority value="INFO" />
    </category>

    <category name="com.liferay.portlet.journal.util.JournalUtil">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portlet.journal.util.PropertiesTransformerListener">
        <priority value="WARN" />
    </category>

    <category name="com.liferay.portlet.journal.util.RegexTransformerUtil">
        <priority value="INFO" />
    </category>

    <category name="com.liferay.portlet.journalcontent.JournalContentPortletLayoutListener">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portlet.journalcontent.util.JournalContentUtil">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portlet.mail">
        <priority value="WARN" />
    </category>

    <category name="com.liferay.portlet.messageboards.pop.MessageListenerImpl">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portlet.messageboards.service.impl.MBCategoryLocalServiceImpl">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portlet.messageboards.service.impl.MBMessageLocalServiceImpl">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portlet.messageboards.util.MBUtil">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portlet.portletconfiguration.action">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portlet.shopping.action.PayPalNotificationAction">
        <priority value="DEBUG" />
    </category>

    <category name="com.liferay.portlet.tags.util.TagsUtil">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portlet.wsrp">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.portlet.wiki.importers">
        <priority value="WARN" />
    </category>

    <category name="com.liferay.util.JNDIUtil">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.util.dao">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.util.dao.orm.CustomSQLUtil">
        <priority value="INFO" />
    </category>

    <category name="com.liferay.util.mail">
        <priority value="WARN" />
    </category>

    <category name="com.liferay.util.servlet.ServletResponseUtil">
        <priority value="ERROR" />
    </category>

    <category name="com.liferay.wsrp">
        <priority value="ERROR" />
    </category>

    <category name="com.opensymphony.oscache">
        <priority value="ERROR" />
    </category>

    <category name="com.opensymphony.oscache.plugins.clustersupport.JavaGroupsBroadcastingListener">
        <priority value="ERROR" />
    </category>

    <category name="com.sample">
        <priority value="INFO" />
    </category>

    <category name="com.sun.faces">
        <priority value="ERROR" />
    </category>

    <category name="de.hunsicker">
        <priority value="ERROR" />
    </category>

    <category name="de.nava.informa">
        <priority value="ERROR" />
    </category>

    <category name="httpclient.wire">
        <priority value="ERROR" />
    </category>

    <category name="net.htmlparser.jericho">
        <priority value="ERROR" />
    </category>

    <category name="net.sf.ehcache">
        <priority value="ERROR" />
    </category>

    <category name="net.sf.hibernate">
        <priority value="ERROR" />
    </category>

    <category name="org.apache.axis">
        <priority value="INFO" />
    </category>

    <category name="org.apache.bsf">
        <priority value="FATAL" />
    </category>

    <category name="org.apache.commons.digester">
        <priority value="ERROR" />
    </category>

    <category name="org.apache.commons.beanutils">
        <priority value="ERROR" />
    </category>

    <category name="org.apache.commons.fileupload">
        <priority value="ERROR" />
    </category>

    <category name="org.apache.commons.httpclient">
        <priority value="ERROR" />
    </category>

    <category name="org.apache.commons.validator">
        <priority value="ERROR" />
    </category>

    <category name="org.apache.jackrabbit">
        <priority value="ERROR" />
    </category>

    <category name="org.apache.myfaces">
        <priority value="ERROR" />
    </category>

    <category name="org.apache.struts">
        <priority value="ERROR" />
    </category>

    <category name="org.apache.struts.action.RequestProcessor">
        <priority value="ERROR" />
    </category>

    <category name="org.apache.struts.tiles.TilesRequestProcessor">
        <priority value="ERROR" />
    </category>

    <category name="org.apache.velocity">
        <priority value="ERROR" />
    </category>

    <category name="org.apache.wsrp4j">
        <priority value="ERROR" />
    </category>

    <category name="org.apache.xbean">
        <priority value="ERROR" />
    </category>

    <category name="org.hibernate">
        <priority value="ERROR" />
    </category>

    <category name="org.jabsorb">
        <priority value="ERROR" />
    </category>

    <category name="org.jgroups">
        <priority value="ERROR" />
    </category>

    <category name="org.openid4java">
        <priority value="ERROR" />
    </category>

    <category name="org.pdfbox">
        <priority value="INFO" />
    </category>

    <category name="org.portletbridge">
        <priority value="INFO" />
    </category>

    <category name="org.quartz">
        <priority value="ERROR" />
    </category>

    <category name="org.springframework">
        <priority value="ERROR" />
    </category>

    <category name="com.sun">
        <priority value="ERROR" />
    </category>

    <category name="org.apache.catalina.startup.HostConfig">
        <priority value="FINEST" />
    </category>
    
    <category name="org.apache.catalina.core.StandardContext">
        <priority value="FINEST" />
    </category>
    
    <category name="org.apache.jasper.servlet.JspServlet">
        <priority value="INFO" />
    </category>

    <root>
        <priority value="INFO" />
        <appender-ref ref="CONSOLE" />
    </root>
    
</log4j:configuration>



Wednesday, December 29, 2010

Tuning Eclipse Helios / Liferay 6 development environment

We are doing Liferay 6 / JSF + facelet / icefaces portlet development. Our eclipse development environment is far from friendly though. I have been testing many different options for the development of these portlets including the liferay ide plugins, various maven archetypes for generating these portlets, etc.

My goal is to get a seamless hot-deploy working within the eclipse environment to allow my development team to make a change, save and have the change automatically propagated to their local tomcat 6/ liferay 6 environment for easy testing and debugging.

I have configured my environment according to the instruction on the Liferay IDE documentation site.

I have been able to successfully launch the liferay 6 server via the eclipse servers perspective, but it is very slow and sporadic. Sometimes it will debug sometimes it will not and will timeout after 300ms. I removed all of the portlets from tomcat 6 which I am not using to speed the liferay/tomcat loading time. I have managed to get the startup down to 155 700ms, but that still seems extremely slow to me. I am going to attempt to get that down to something more in the range of 30 seconds if possible. This blog is a chronicle of my attempts and the results. No idea if any of this stuff will help, but even if not, hopefully it will save someone else from wasting time trying this stuff...

Test 1 - Tuning Eclipse settings. First thing I am going to do is optimize my Eclipse environment. This is a brand new install of Eclipse Helios, and I have yet to tune up any JVM settings or anything. I am not sure how the actual debugging is wired up, but I presume Eclipse launches Tomcat in its own container, then 'connects' to it via the debugger, so this should have little effect on the overall Liferay loading, but this needs to be done anyway, so I will try this first.

Changed the eclipse.ini as follows... startup now at 93665ms.

-startup
plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.1.R36x_v20100810
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vm
C:/java/jdk1.6.0_21/bin
-vmargs
-server
-Dosgi.requiredJavaVersion=1.6
-Xmn100m
-Xss1m
-XgcPrio:deterministic
-XpauseTarget:20
-XX:PermSize=400M
-XX:MaxPermSize=500M
-XX:CompileThreshold=10
-XX:MaxGCPauseMillis=10
-XX:MaxHeapFreeRatio=70
-XX:+UnlockExperimentalVMOptions
-XX:+DoEscapeAnalysis
-XX:+UseG1GC
-XX:+UseFastAccessorMethods
-XX:+AggressiveOpts
-Xms256m
-Xmx512m

Servlet Filters

Turned off servlet filters in the portlet-ext.properties file as follows:

com.liferay.portal.servlet.filters.cache.CacheFilter=false
com.liferay.portal.servlet.filters.audit.AuditFilter=false
com.liferay.portal.servlet.filters.sso.cas.CASFilter=false
com.liferay.portal.servlet.filters.sso.ntlm.NtlmFilter=false
com.liferay.portal.sharepoint.SharepointFilter=false
com.liferay.portal.servlet.filters.virtualhost.VirtualHostFilter=false
com.liferay.portal.servlet.filters.sso.opersso.OpenSSOFilter=false