2 Replies Latest reply on Aug 9, 2011 7:58 AM by Cato Eik

    Error or changed implementation from 3.1 -> 3.2 causing Spring exception

    Cato Eik Newbie

      We use Spring Portlet MVC 3.0.5 with GateIn on Tomcat (3.1 Final), which work just fine.

      Looking forward to a new GateIn release (3.2), we have tried 3.2 Beta and the new 3.2 M1.

      Both giving us a Spring exception that we do not get in 3.1 and that we can not figure out.

       

      Hope that someone in this forum can help.

       

      The exception:

      org.springframework.web.portlet.NoHandlerFoundException: No matching handler method found for portlet request: mode 'view', phase 'RESOURCE_PHASE', parameters map['amp;portal:cacheLevel' -> array<String>['PAGE'], 'amp;portal:type' -> array<String>['resource'], 'amp;portal:windowState' -> array<String>['normal'], 'amp;portal:resourceID' -> array<String>['shoppingBagStatus'], 'dummy' -> array<String>['0'], 'amp;portal:isSecure' -> array<String>['false'], 'amp;portal: portletMode' -> array<String>['view']]
      at org.springframework.web.portlet.mvc.annotation.Ann otationMethodHandlerAdapter$PortletHandlerMethodRe solver.resolveHandlerMethod(AnnotationMethodHandle rAdapter.java:507)
      at org.springframework.web.portlet.mvc.annotation.Ann otationMethodHandlerAdapter.invokeHandlerMethod(An notationMethodHandlerAdapter.java:355)
      ....
      

       

      Our controller (MyController.java) method look like this:

      ...
      @ResourceMapping("shoppingBagStatus")
        public void shoppingBagStatus(@RequestParam(value = "dummy") String dummy, ResourceRequest req, ResourceResponse res, ModelMap model) throws ILException, IOException {
          try {
            String uspesifisertTekst = messageSource.getMessage("label.handlekurvTellerUspesifisert", null, req.getLocale());
            String status = shoppingCartServices.getShoppingCartCounterString(appSession.getSessionId(), uspesifisertTekst);
      
            res.setContentType(req.getResponseContentType());
            OutputStream outStream = res.getPortletOutputStream();
            StringBuffer buffer = new StringBuffer();
            buffer.append(status);
            outStream.write(buffer.toString().getBytes());
            outStream.flush();
          }
          catch (IllegalInputException iie) {
            handleIllegalInputException(iie, model);
          }
        }
      ...
      

       

      Our jsp code:

      ...
      <script type="text/javascript">
      $(document).ready(function(){
        var counter = $('#cartCounterValue');
        var url = "<portlet:resourceURL id='shoppingBagStatus' />";
          $.ajax({
              type: "POST",
              url: url,
              data: {"dummy": 0},
              success: function(result) {
                   counter.html(result);
              }
          });
      });
      </script>
      ...
      

       

      And our spring config test-portlet.xml:

      ...
      <bean id="portletModeHandlerMapping" class="org.springframework.web.portlet.handler.PortletModeHandlerMapping">
          <property name="order" value="2"/>   
       <property name="interceptors">
       <list>
            <ref bean="renderInterceptor"/>
       <ref bean="timingInterceptor"/>
       </list>
       </property>
          <property name="portletModeMap">
            <map>
              <entry key="view" value-ref="myController"/>
            </map>
          </property>
        </bean>
      ...
      

       

      /Cato