Liferay - Unable to extend session error

If you are experiencing the following error in Liferay log [extend_session_jsp:445] Unable to extend session for portlet-name, and your portlet name contains hyphen character '-', here is a fix for Liferay 6.1.1 version:

  • copy com.liferay.portal.tools.deploy.PortletDeployer.java from Liferay sources to your Liferay Ext project
  • add following code to the getServletContent() method (at line 236)

sb.append("<servlet-mapping>");
sb.append("<servlet-name>");
sb.append(servletName);
sb.append("</servlet-name>");
sb.append("<url-pattern>/");
sb.append(portletElement.elementText("portlet-name"));
sb.append("/*</url-pattern>");
sb.append("</servlet-mapping>");

  • deploy Liferay Ext module
  • redeploy the portlet