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

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 03:29:00

问题


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.


回答1:


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




回答2:


may be you forgot to add <bean class="packagename.classname" /> in projectname.xml file



来源:https://stackoverflow.com/questions/28629225/no-handler-found-for-portlet-request-mode-view-phase-render-phase

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!