title: Spring MVC Portlet and Liferay: No matching handler method found for portlet request actionUrl
body: <p>I'm developing a portlet with Spring MVC Portlet and deployed in Liferay. My intention for this portlet is to show a tree with some important info. To achieve this goal i need to request the server json files with the info that fills the tree.</p>
  
  <p>The jsp page itself loads ok. I added a link in order to test if i can get a valid json. I've been looking for help and documentation and i generate a friendly url in the jsp. But when i click the link to get the json, the server throws the following error:</p>
  
  <pre><code>12:07:40,767 ERROR [http-bio-8080-exec-5][render_portlet_jsp:154] org.springframework.web.portlet.NoHandlerFoundException: No matching handler method found for portlet request: mode 'view', phase 'ACTION_PHASE', parameters map['action' -&gt; array&lt;String&gt;['showTree']]
      at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:70)
      at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:48)
      at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:111)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
      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:72)
      at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:73)
      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:684)
      at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:593)
      at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:530)
      at com.liferay.portlet.InvokerPortletImpl.invoke(InvokerPortletImpl.java:534)
      at com.liferay.portlet.InvokerPortletImpl.invokeAction(InvokerPortletImpl.java:579)
      at com.liferay.portlet.InvokerPortletImpl.processAction(InvokerPortletImpl.java:294)
      at com.liferay.portal.action.LayoutAction.processPortletRequest(LayoutAction.java:944)
      at com.liferay.portal.action.LayoutAction.processLayout(LayoutAction.java:688)
      at com.liferay.portal.action.LayoutAction.execute(LayoutAction.java:249)
      at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
  </code></pre>
  
  <p>Maybe i forgot something important. I paste the relevant parts of my code:</p>
  
  <p>home.jsp (rendered home page)</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1-transitional.dtd"&gt;
  &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %&gt;
  &lt;%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"&gt;
  &lt;body&gt;
      &lt;!-- Add a &lt;div&gt; element where the tree should appear: --&gt;
      &lt;h1&gt;Liferay Spring Portlet MVC - Tree&lt;/h1&gt;
      &lt;p&gt;The time on the server is ${serverTime}.&lt;/p&gt;
      &lt;p&gt;Date: &lt;input type="text" id="datepicker" /&gt;&lt;/p&gt;
      &lt;div id="tree"&gt; &lt;/div&gt;
  
      &lt;portlet:actionURL var="ajaxTreeURL"&gt;
          &lt;portlet:param name="action" value="showTree"/&gt;
      &lt;/portlet:actionURL&gt;
      &lt;a href="&lt;%= ajaxTreeURL.toString() %&gt;" &gt; Go &lt;/a&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>HomeController.java (renders the page and handles the requests)</p>
  
  <pre><code>public class HomeController {
  
      private static final Logger logger = LoggerFactory.getLogger(HomeController.class);
  
      @Autowired
      private ExperimentService experimentService;
      /**
       * Simply selects the home view to render by returning its name.
       */
      @RenderMapping
      public String home(Locale locale, Model model) {
          logger.info("Welcome home! the client locale is "+ locale.toString());
  
          Date date = new Date();
          DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale);
  
          String formattedDate = dateFormat.format(date);
  
          model.addAttribute("serverTime", formattedDate);
  
          experimentService.getExperiments();
  
          return "home";
      }
  
      @RequestMapping(params= {"action=showTree"})
       public void showTreeHandler(ResourceRequest request, ResourceResponse response, Model model) throws Exception {
          OutputStream outStream = response.getPortletOutputStream();
          StringBuffer buffer = new StringBuffer();
          Map&lt;String, String&gt; testMap = new HashMap&lt;String, String&gt;();
          testMap.put("foo", "bar");
          String test = new JSONObject(testMap).toString();
          buffer.append(test);
          outStream.write(buffer.toString().getBytes());
       }
  } String home(Locale locale, Model model) {
      logger.info("Welcome home! the client locale is "+ locale.toString());
  
      Date date = new Date();
      DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale);
  
      String formattedDate = dateFormat.format(date);
  
      model.addAttribute("serverTime", formattedDate);
  
      experimentService.getExperiments();
  
      return "home";
  }
  
  @RequestMapping(params= {"action=showTree"})
   public void showTreeHandler(ResourceRequest request, ResourceResponse response, Model model) throws Exception {
      OutputStream outStream = response.getPortletOutputStream();
      StringBuffer buffer = new StringBuffer();
      Map&lt;String, String&gt; testMap = new HashMap&lt;String, String&gt;();
      testMap.put("foo", "bar");
      String test = new JSONObject(testMap).toString();
      buffer.append(test);
      outStream.write(buffer.toString().getBytes());
   }
  }
  </code></pre>
  
  <p>I add some extra config files (portlet.xml):</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  
  &lt;portlet-app
      version="2.0"
      xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
  &gt;
      &lt;portlet&gt;
          &lt;portlet-name&gt;liferay-spring-mvc&lt;/portlet-name&gt;
          &lt;display-name&gt;Liferay Spring MVC Portlet&lt;/display-name&gt;
          &lt;portlet-class&gt;org.springframework.web.portlet.DispatcherPortlet&lt;/portlet-class&gt;
          &lt;init-param&gt;
              &lt;name&gt;contextConfigLocation&lt;/name&gt;
              &lt;value&gt;/WEB-INF/spring/context-portlet.xml&lt;/value&gt;
          &lt;/init-param&gt;
          &lt;init-param&gt;
              &lt;name&gt;viewRendererUrl&lt;/name&gt;
              &lt;value&gt;/mappingUrls&lt;/value&gt;
          &lt;/init-param&gt;
          &lt;expiration-cache&gt;0&lt;/expiration-cache&gt;
          &lt;supports&gt;
              &lt;mime-type&gt;text/html&lt;/mime-type&gt;
              &lt;portlet-mode&gt;view&lt;/portlet-mode&gt;
          &lt;/supports&gt;
          &lt;portlet-info&gt;
              &lt;title&gt;Liferay Spring MVC Portlet&lt;/title&gt;
              &lt;short-title&gt;Liferay Spring MVC Portlet&lt;/short-title&gt;
              &lt;keywords&gt;liferay spring mvc portlet&lt;/keywords&gt;
          &lt;/portlet-info&gt;
          &lt;security-role-ref&gt;
              &lt;role-name&gt;administrator&lt;/role-name&gt;
          &lt;/security-role-ref&gt;
          &lt;security-role-ref&gt;
              &lt;role-name&gt;guest&lt;/role-name&gt;
          &lt;/security-role-ref&gt;
          &lt;security-role-ref&gt;
              &lt;role-name&gt;power-user&lt;/role-name&gt;
          &lt;/security-role-ref&gt;
          &lt;security-role-ref&gt;
              &lt;role-name&gt;user&lt;/role-name&gt;
          &lt;/security-role-ref&gt;
      &lt;/portlet&gt;
  &lt;/portlet-app&gt;
  </code></pre>
  
  <p>context-portlet.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:p="http://www.springframework.org/schema/p"
      xmlns:context="http://www.springframework.org/schema/context"
      xsi:schemaLocation="
          http://www.springframework.org/schema/beans
          http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
          http://www.springframework.org/schema/context
          http://www.springframework.org/schema/context/spring-context-3.0.xsd"&gt;
  
       &lt;context:annotation-config /&gt;
      &lt;!-- Autodetect annotated controllers --&gt;
      &lt;context:component-scan base-package="es.unican.meteo" /&gt;
  
      &lt;bean class="org.springframework.web.portlet.mvc.annotation.DefaultAnnotationHandlerMapping" /&gt;  
  
      &lt;bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
          &lt;property name="prefix" value="/WEB-INF/views/" /&gt;
          &lt;property name="suffix" value=".jsp" /&gt;
      &lt;/bean&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p>Can somebody help me with this issue?</p>