Zerok
Zerok

Reputation: 227

Liferay ERROR [RuntimePageImpl-16] is not a valid include

I'm struggling with the doView() method and initializing parameters from the portlet.xml. What I've been trying so far, is to just redirect to another view when I click a button, or a link. For that, I created two JSP:

view.jsp vista2.jsp

I define them in portlet.xml:

<portlet>
    <portlet-name>res-prot</portlet-name>
    <display-name>Res Prot</display-name>
    <portlet-class>com.test.ResProt</portlet-class>
    <init-param>
        <name>view-jsp</name>
        <value>html/resprot/view.jsp</value>
    </init-param>
    <init-param>
        <name>vista2-jsp</name>
        <value>/vista2.jsp</value>
    </init-param>   
    (...)

Then, I initialize them in the init() method:

String viewJSP;
String vista2JSP;

public void init() throws PortletException {
    viewJSP = getInitParameter("view-jsp");
    vista2JSP = getInitParameter("vista2-jsp");
}

Finally, I call to the doView() method, which calls the viewJSP if a parameter "navegacion" is empty:

@Override
    public void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException {
        String destino = viewJSP;

        try {
            // we redirect only if "navegacion" is sent from the jsp
            if (renderRequest.getParameter("navegacion") != null){
                if(renderRequest.getParameter("navegacion").equalsIgnoreCase("vista2JSP")){
                    destino = vista2JSP;
                }
            }
            System.out.println("DESTINO: "+destino);
            include(destino, renderRequest, renderResponse);
        } catch (Exception e) {
            e.printStackTrace();

        }
    }

Then, in the vista2.jsp I just use a renderURL to do that call, but I don't even get there. I get this error and the portlet shows empty:

09:21:41,402 ERROR [RuntimePageImpl-16][MVCPortlet:357] html/resprot/view.jsp is not a valid include

This is how this dirty project is organized (remember that this is only for testing purposes):

enter image description here

What's failing here?

EDIT:

If I begin the route by "/", it throws a different error:

DESTINO: /html/resprot/view.jsp java.lang.NullPointerException at com.liferay.portal.kernel.portlet.LiferayPortlet.isValidPath(LiferayPortlet.java:425) at com.liferay.portal.kernel.portlet.LiferayPortlet.checkPath(LiferayPortlet.java:193) at com.liferay.util.bridges.mvc.MVCPortlet.include(MVCPortlet.java:360) at com.liferay.util.bridges.mvc.MVCPortlet.include(MVCPortlet.java:378) at com.test.ResProt.doView(ResProt.java:52) at com.liferay.portal.kernel.portlet.LiferayPortlet.doDispatch(LiferayPortlet.java:235) at com.liferay.util.bridges.mvc.MVCPortlet.doDispatch(MVCPortlet.java:314) at javax.portlet.GenericPortlet.render(GenericPortlet.java:262) at com.test.ResProt.render(ResProt.java:35) 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:731) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) 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:119) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748) at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:604) at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:543) at com.liferay.portlet.InvokerPortletImpl.invoke(InvokerPortletImpl.java:583) at com.liferay.portlet.InvokerPortletImpl.invokeRender(InvokerPortletImpl.java:656) at com.liferay.portlet.InvokerPortletImpl.render(InvokerPortletImpl.java:362) at org.apache.jsp.html.portal.render_005fportlet_jsp._jspService(render_005fportlet_jsp.java:1239) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:731) at com.liferay.portal.servlet.DirectRequestDispatcher.include(DirectRequestDispatcher.java:57) at com.liferay.portal.servlet.ClassLoaderRequestDispatcherWrapper.doDispatch(ClassLoaderRequestDispatcherWrapper.java:78) at com.liferay.portal.servlet.ClassLoaderRequestDispatcherWrapper.include(ClassLoaderRequestDispatcherWrapper.java:53) at com.liferay.portlet.PortletContainerImpl._doRender(PortletContainerImpl.java:638) at com.liferay.portlet.PortletContainerImpl.render(PortletContainerImpl.java:135) at com.liferay.portlet.SecurityPortletContainerWrapper.render(SecurityPortletContainerWrapper.java:141) at com.liferay.portlet.RestrictPortletContainerWrapper.render(RestrictPortletContainerWrapper.java:126) at com.liferay.portal.kernel.portlet.PortletContainerUtil.render(PortletContainerUtil.java:156) at com.liferay.portal.layoutconfiguration.util.PortletRenderer._render(PortletRenderer.java:125) at com.liferay.portal.layoutconfiguration.util.PortletRenderer.access$4(PortletRenderer.java:107) at com.liferay.portal.layoutconfiguration.util.PortletRenderer$PortletRendererCallable.doCall(PortletRenderer.java:180) at com.liferay.portal.layoutconfiguration.util.PortletRenderer$PortletRendererCallable.doCall(PortletRenderer.java:1) at com.liferay.portal.kernel.executor.CopyThreadLocalCallable.call(CopyThreadLocalCallable.java:69) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask._runTask(ThreadPoolExecutor.java:682) at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask.run(ThreadPoolExecutor.java:593) at java.lang.Thread.run(Thread.java:745)

EDIT 2: If I move "view.jsp" to the root folder, keeps throwing the same error:

DESTINO: /view.jsp java.lang.NullPointerException at com.liferay.portal.kernel.portlet.LiferayPortlet.isValidPath(LiferayPortlet.java:425) at com.liferay.portal.kernel.portlet.LiferayPortlet.checkPath(LiferayPortlet.java:193) at com.liferay.util.bridges.mvc.MVCPortlet.include(MVCPortlet.java:360) at com.liferay.util.bridges.mvc.MVCPortlet.include(MVCPortlet.java:378) at com.test.ResProt.doView(ResProt.java:52) at com.liferay.portal.kernel.portlet.LiferayPortlet.doDispatch(LiferayPortlet.java:235) at com.liferay.util.bridges.mvc.MVCPortlet.doDispatch(MVCPortlet.java:314) at javax.portlet.GenericPortlet.render(GenericPortlet.java:262) at com.test.ResProt.render(ResProt.java:35) 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:731) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) 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:119) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748) at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:604) at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:543) at com.liferay.portlet.InvokerPortletImpl.invoke(InvokerPortletImpl.java:583) at com.liferay.portlet.InvokerPortletImpl.invokeRender(InvokerPortletImpl.java:656) at com.liferay.portlet.InvokerPortletImpl.render(InvokerPortletImpl.java:362) at org.apache.jsp.html.portal.render_005fportlet_jsp._jspService(render_005fportlet_jsp.java:1239) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:731) at com.liferay.portal.servlet.DirectRequestDispatcher.include(DirectRequestDispatcher.java:57) at com.liferay.portal.servlet.ClassLoaderRequestDispatcherWrapper.doDispatch(ClassLoaderRequestDispatcherWrapper.java:78) at com.liferay.portal.servlet.ClassLoaderRequestDispatcherWrapper.include(ClassLoaderRequestDispatcherWrapper.java:53) at com.liferay.portlet.PortletContainerImpl._doRender(PortletContainerImpl.java:638) at com.liferay.portlet.PortletContainerImpl.render(PortletContainerImpl.java:135) at com.liferay.portlet.SecurityPortletContainerWrapper.render(SecurityPortletContainerWrapper.java:141) at com.liferay.portlet.RestrictPortletContainerWrapper.render(RestrictPortletContainerWrapper.java:126) at com.liferay.portal.kernel.portlet.PortletContainerUtil.render(PortletContainerUtil.java:156) at com.liferay.portal.layoutconfiguration.util.PortletRenderer._render(PortletRenderer.java:125) at com.liferay.portal.layoutconfiguration.util.PortletRenderer.access$4(PortletRenderer.java:107) at com.liferay.portal.layoutconfiguration.util.PortletRenderer$PortletRendererCallable.doCall(PortletRenderer.java:180) at com.liferay.portal.layoutconfiguration.util.PortletRenderer$PortletRendererCallable.doCall(PortletRenderer.java:1) at com.liferay.portal.kernel.executor.CopyThreadLocalCallable.call(CopyThreadLocalCallable.java:69) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask._runTask(ThreadPoolExecutor.java:682) at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask.run(ThreadPoolExecutor.java:593) at java.lang.Thread.run(Thread.java:745)

Upvotes: 0

Views: 1349

Answers (1)

fabballe
fabballe

Reputation: 771

You should replace

<value>html/resprot/view.jsp</value>

By

<value>/html/resprot/view.jsp</value>

Upvotes: 1

Related Questions