angle-left Back

RE: javax.portlet.PortletException: Path /view.jsp is not accessible by thi

Pascal Collberg, modified 6 Months ago.

javax.portlet.PortletException: Path /view.jsp is not accessible by this po

New Member Posts: 2 Join Date: 5/26/15 Recent Posts

I am trying to set up friendly urls. To start with I have followed this tutorial:

Even though the tutorial is written for Liferay 6 I am trying to set this up in Liferay 7.

I have created a Liferay Workspace Project containing a module called friendly-web. This module is an mvc-portlet project. The portlet class looks like this (mostly copied from the tutorial):

@Component(immediate = true, property = { "com.liferay.portlet.display-category=category.sample",
"com.liferay.portlet.instanceable=true", "javax.portlet.display-name=friendly-web Portlet",
"javax.portlet.init-param.template-path=/", "javax.portlet.init-param.view-template=/view.jsp",
"" + FriendlyWebPortletKeys.FriendlyWeb, "javax.portlet.resource-bundle=content.Language",
",user" }, service = Portlet.class)
public class FriendlyWebPortlet extends MVCPortlet {
public void addEmployee(ActionRequest actionRequest, ActionResponse actionResponse)
throws IOException, PortletException {
System.out.println("Add Method");
public void deleteEmployee(ActionRequest actionRequest, ActionResponse actionResponse)
throws IOException, PortletException {
System.out.println("Delete Method=>" + ParamUtil.getInteger(actionRequest, "userId"));

In src/main/resources/META-INF/resources there are three files:

  • init.jsp that I have not touched so it is like it was generated by the SDK.
  • display.jsp - a simple jsp printing a message
  • view.jsp (mostly copied from the tutorial):

<%@ include file="/init.jsp" %>

<!-- Action URL -->
<portlet:actionURL var="addEmployeeURL" name="addEmployee">

<!-- Delete URL -->
<portlet:actionURL var="deleteEmployeeURL" name="deleteEmployee">
<portlet:param name="userId" value="1"/>

<!-- Render URLs -->
<portlet:renderURL var="viewRenderURL">
<portlet:param name="mvcPath" value="/view.jsp"/>

<portlet:renderURL var="displayRenderURL">
<portlet:param name="mvcPath" value="/display.jsp"/>

<a href="<%= addEmployeeURL%>">Add URL</a><br>
<a href="<%= deleteEmployeeURL%>">Delete URL</a><br>
<a href="<%= viewRenderURL%>">Go to View </a><br>
<a href="<%= displayRenderURL%>">Go to Display</a><br>

Then I add a friendly url mapper that looks like this:

immediate = true,
property = {
"" + FriendlyWebPortletKeys.FriendlyWeb,
service = FriendlyURLMapper.class
public class FriendlyWebFriendlyUrlMapper extends DefaultFriendlyURLMapper {
public String getMapping() {
return _MAPPING;
private static final String _MAPPING = "FriendlyWeb";

and routes.xml:

<?xml version="1.0"?>
<!DOCTYPE routes PUBLIC "-//Liferay//DTD Friendly URL Routes 7.0.0//EN" "">

<generated-parameter name="mvcPath">/{placeHolder}.jsp</generated-parameter>
<ignored-parameter name="p_p_id" />
<implicit-parameter name="p_p_mode">view</implicit-parameter>

<!-- For Delete -->
<generated-parameter name="javax.portlet.action">{placeHolder1}</generated-parameter>
<generated-parameter name="userId">{placeHolder2}</generated-parameter>
<implicit-parameter name="p_p_lifecycle">1</implicit-parameter>

<!-- For ADD -->
<generated-parameter name="javax.portlet.action">{placeHolder}</generated-parameter>
<implicit-parameter name="p_p_lifecycle">1</implicit-parameter>

I had to change some paths from the tutorial to make everything work but I still run into one issue. If I add the portlet to a page and then press either one of the "Add URL" or "Delete URL" links I get an error that says:

javax.portlet.PortletException: Path /view.jsp is not accessible by this portlet
at com.liferay.portal.kernel.portlet.LiferayPortlet.checkPath(
at com.liferay.portal.kernel.portlet.bridges.mvc.MVCPortlet.include(
at com.liferay.portal.kernel.portlet.bridges.mvc.MVCPortlet.include(
at com.liferay.portal.kernel.portlet.bridges.mvc.MVCPortlet.doDispatch(
at javax.portlet.GenericPortlet.render(
at com.liferay.portal.kernel.portlet.bridges.mvc.MVCPortlet.render(
at com.liferay.portlet.FilterChainImpl.doFilter(
at com.liferay.portlet.ScriptDataPortletFilter.doFilter(
at com.liferay.portlet.FilterChainImpl.doFilter(
at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(
at com.liferay.portal.kernel.servlet.PortletServlet.service(
at javax.servlet.http.HttpServlet.service(
at org.eclipse.equinox.http.servlet.internal.registration.EndpointRegistration.service(
at org.eclipse.equinox.http.servlet.internal.servlet.ResponseStateHandler.processRequest(
at org.eclipse.equinox.http.servlet.internal.context.DispatchTargets.doDispatch(
at org.eclipse.equinox.http.servlet.internal.servlet.RequestDispatcherAdaptor.include(
at com.liferay.portlet.InvokerPortletImpl.invoke(
at com.liferay.portlet.InvokerPortletImpl.invokeRender(
at com.liferay.portlet.InvokerPortletImpl.render(

I am fairly new to Liferay development so I have a hard time understanding why the portlet should not have access to this path. The view.jsp should be on that specific path.

Can someone shed some light on this? What is preventing the portlet from accessing this jsp? The tutorial is made for Liferay 6 I think. Is something new introduced in Liferay 7 that I have not taken into account?

Tomas Polesovsky, modified 5 Months ago.

RE: javax.portlet.PortletException: Path /view.jsp is not accessible by thi

LIFERAY STAFF Liferay Master Posts: 654 Join Date: 2/13/09 Recent Posts
Hi Pascal,

this happens when the JSPs cannot be found in expected locations.

Please see:

Please make sure the JSPs are stored inside your JAR in correct location, i.e. directly in root folder or /META-INF/resources folder.

Pascal Collberg, modified 5 Months ago.

RE: javax.portlet.PortletException: Path /view.jsp is not accessible by thi

New Member Posts: 2 Join Date: 5/26/15 Recent Posts
Thanks Tomas!

I'll try it out.