No handler found for portlet request: mode 'view', phase 'RENDER_PHASE'

Matt picture Matt · Feb 20, 2015 · Viewed 9.7k times · Source

I develop a portlet in Spring MVC which is deployed in Liferay. Apparently, I have a problem with render phase of view mode of portlet.

Controller for view mode

package graphui.controller;

import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.portlet.ModelAndView;
import org.springframework.web.portlet.bind.annotation.ActionMapping;
import org.springframework.web.portlet.bind.annotation.RenderMapping;

/**
 *
 * Controller for VIEW mode of portlet.
 */
@Controller("graphViewController")
@RequestMapping(value = "VIEW")
public class GraphViewController{

    @ActionMapping
    public void handleActionRequest(ActionRequest request, ActionResponse response)throws Exception {
        return;
    }

    @RenderMapping
    public ModelAndView handleRenderRequest(RenderRequest request, RenderResponse response, ModelMap model) {

      model.addAttribute("nodes", "123");
      model.addAttribute("edges", "123");
      return new ModelAndView("index", model);

    }

}

index.jsp

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="c" 
           uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>

    </head>

    <body>

    </body>

      <script type="text/javascript">

            var nodes = ${nodes};
            var edges = ${edges};

      </script>

</html>

Tomcat log output

ERROR [http-bio-8080-exec-29][render_portlet_jsp:132] null
org.springframework.web.portlet.NoHandlerFoundException: No handler found for portlet request: mode 'view', phase 'RENDER_PHASE', parameters map[[empty]]
    at javax.portlet.GenericPortlet.render(GenericPortlet.java:233)
    at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:103)
    at com.liferay.portlet.ScriptDataPortletFilter.doFilter(ScriptDataPortletFilter.java:55)
    at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:100)
    at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:64)
    at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:112)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:96)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749)
    at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:605)
    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:544)
    at com.liferay.portlet.InvokerPortletImpl.invoke(InvokerPortletImpl.java:604)
    at com.liferay.portlet.InvokerPortletImpl.invokeRender(InvokerPortletImpl.java:677)
    at com.liferay.portlet.InvokerPortletImpl.render(InvokerPortletImpl.java:379)
    at org.apache.jsp.html.portal.render_005fportlet_jsp._jspService(render_005fportlet_jsp.java:1230)

Does anybody know where could be the problem? Thank you.

Answer

Matt picture Matt · Feb 22, 2015

base-package path in context:component-scan was set wrong.