Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-33604

NullPointerException in <liferay-portlet:runtime> tag in custom portlet

    Details

    • Branch Version/s:
      6.0.x, 5.2.x, 5.1.x

      Description

      .Steps to reproduce:

      1. Create a custom portlet

      2. in view.jsp of the custom portlet, add the <liferay-portlet:runtime> tag such as:

      <%@ taglib uri="http://liferay.com/tld/portlet" prefix="liferay-portlet" %>
      <liferay-portlet:runtime portletName="56_INSTANCE_abcd" />
      

      3. Deploy the custom portlet and add it to a page. The page will display an error and NullPointerException occurs:

      1
        215:27:26,661 ERROR [InsertTag:922] ServletException in '/html/common/themes/portlet.jsp': null
        3org.apache.jasper.JasperException: java.lang.NullPointerException
        4    at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:549)
        5    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470)
        6    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
        7    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
        8    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
        9    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
       10    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
       11    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
       12    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:70)
       13    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
       14    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
       15    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
       16    at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:593)
       17    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:530)
       18    at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:954)
       19    at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:652)
       20    at com.liferay.portal.kernel.servlet.PageContextWrapper.include(PageContextWrapper.java:168)
       21    at org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:99)
       22    at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:135)
       23    at org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:760)
       24    at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:892)
       25    at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:462)
       26    at org.apache.jsp.html.portal.render_005fportlet_jsp._jspService(render_005fportlet_jsp.java:1677)
       27    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
       28    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
       29    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
       30    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
       31    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
       32    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
       33    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
       34    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
       35    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
       36    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:70)
       37    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
       38    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
       39    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
       40    at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:593)
       41    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:530)
       42    at com.liferay.portal.util.PortalImpl.renderPortlet(PortalImpl.java:4735)
       43    at com.liferay.portal.util.PortalUtil.renderPortlet(PortalUtil.java:1455)
       44    at com.liferay.portlet.layoutconfiguration.util.RuntimePortletImpl.processPortlet(RuntimePortletImpl.java:213)
       45    at com.liferay.portlet.layoutconfiguration.util.RuntimePortletImpl.processPortlet(RuntimePortletImpl.java:148)
       46    at com.liferay.portlet.layoutconfiguration.util.RuntimePortletImpl.processTemplate(RuntimePortletImpl.java:309)
       47    at com.liferay.portlet.layoutconfiguration.util.RuntimePortletImpl.processTemplate(RuntimePortletImpl.java:234)
       48    at com.liferay.portlet.layoutconfiguration.util.RuntimePortletUtil.processTemplate(RuntimePortletUtil.java:106)
       49    at org.apache.jsp.html.portal.layout.view.portlet_jsp._jspService(portlet_jsp.java:512)
       50    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
       51    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
       52    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
       53    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
       54    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
       55    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
       56    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
       57    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
       58    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
       59    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:70)
       60    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
       61    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
       62    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
       63    at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:593)
       64    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:530)
       65    at com.liferay.portal.action.LayoutAction.includeLayoutContent(LayoutAction.java:412)
       66    at com.liferay.portal.action.LayoutAction.processLayout(LayoutAction.java:680)
       67    at com.liferay.portal.action.LayoutAction.execute(LayoutAction.java:244)
       68    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
       69    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
       70    at com.liferay.portal.struts.PortalRequestProcessor.process(PortalRequestProcessor.java:174)
       71    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
       72    at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
       73    at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
       74    at com.liferay.portal.servlet.MainServlet.callParentService(MainServlet.java:533)
       75    at com.liferay.portal.servlet.MainServlet.service(MainServlet.java:510)
       76    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
       77    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
       78    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
       79    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
       80    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:113)
       81    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:113)
       82    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:113)
       83    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)
       84    at com.liferay.portal.servlet.filters.secure.SecureFilter.processFilter(SecureFilter.java:201)
       85    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)
       86    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
       87    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
       88    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)
       89    at com.liferay.portal.servlet.filters.autologin.AutoLoginFilter.processFilter(AutoLoginFilter.java:240)
       90    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)
       91    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
       92    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
       93    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:70)
       94    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
       95    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
       96    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
       97    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:471)
       98    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:402)
       99    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:329)
      100    at com.liferay.portal.servlet.FriendlyURLServlet.service(FriendlyURLServlet.java:135)
      101    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
      102    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
      103    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      104    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
      105    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)
      106    at com.liferay.portal.servlet.filters.strip.StripFilter.processFilter(StripFilter.java:304)
      107    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)
      108    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
      109    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
      110    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:113)
      111    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)
      112    at com.liferay.portal.servlet.filters.gzip.GZipFilter.processFilter(GZipFilter.java:123)
      113    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)
      114    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
      115    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
      116    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)
      117    at com.liferay.portal.servlet.filters.secure.SecureFilter.processFilter(SecureFilter.java:201)
      118    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)
      119    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
      120    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
      121    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)
      122    at com.liferay.portal.servlet.filters.i18n.I18nFilter.processFilter(I18nFilter.java:241)
      123    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)
      124    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
      125    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
      126    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)
      127    at com.liferay.portal.servlet.filters.etag.ETagFilter.processFilter(ETagFilter.java:55)
      128    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)
      129    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
      130    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
      131    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)
      132    at com.liferay.portal.servlet.filters.autologin.AutoLoginFilter.processFilter(AutoLoginFilter.java:240)
      133    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)
      134    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
      135    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
      136    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)
      137    at com.liferay.portal.servlet.filters.sso.ntlm.NtlmPostFilter.processFilter(NtlmPostFilter.java:83)
      138    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)
      139    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
      140    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
      141    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)
      142    at com.liferay.portal.sharepoint.SharepointFilter.processFilter(SharepointFilter.java:80)
      143    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)
      144    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
      145    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
      146    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)
      147    at com.liferay.portal.servlet.filters.virtualhost.VirtualHostFilter.processFilter(VirtualHostFilter.java:208)
      148    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)
      149    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
      150    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
      151    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:184)
      152    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:92)
      153    at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:738)
      154    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
      155    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
      156    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:164)
      157    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:92)
      158    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:164)
      159    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:92)
      160    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:184)
      161    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:92)
      162    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:70)
      163    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
      164    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      165    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
      166    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
      167    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
      168    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
      169    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
      170    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:928)
      171    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
      172    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
      173    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
      174    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:539)
      175    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:300)
      176    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      177    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      178    at java.lang.Thread.run(Thread.java:619)
      179Caused by: java.lang.NullPointerException
      180    at com.liferay.taglib.portlet.DefineObjectsTag.doStartTag(DefineObjectsTag.java:61)
      181    at org.apache.jsp.html.common.themes.portlet_jsp._jspService(portlet_jsp.java:439)
      182    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
      183    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
      184    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
      185    ... 173 more
      18615:27:26,671 INFO  [PortalImpl:4873] Current URL /web/guest/servicios-de-pago?p_p_id=serviciospagofamilia_WAR_Net4ParentSitioWebportlet&p_p_lifecycle=0&p_p_state=normal&p_p_mode=view&p_p_col_id=column-2&p_p_col_count=1&_serviciospagofamilia_WAR_Net4ParentSitioWebportlet_jspPage=%2Fhtml%2Ffamilia%2Fservicios_pago%2Fpagar_suscripcion.jsp generates exception: org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: ServletException in '/html/common/themes/portlet.jsp': null
      18715:27:27,991 ERROR [status_jsp:670] org.apache.jasper.JasperException: org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: ServletException in '/html/common/themes/portlet.jsp': null
      188org.apache.jasper.JasperException: org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: ServletException in '/html/common/themes/portlet.jsp': null
      189    at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:549)
      190    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455)
      191    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
      192    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
      193    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
      194    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
      195    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      

      Solution:

      In com.liferay.taglib.portlet.DefineObjectsTag.java, change the line 40:

      String lifecycle = (String)request.getAttribute(
      			PortletRequest.LIFECYCLE_PHASE);
      

      to

      String lifecycle = GetterUtil.getString(request.getAttribute(
      			PortletRequest.LIFECYCLE_PHASE), PortletRequest.RENDER_PHASE);
      

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  6 years, 5 weeks, 3 days ago