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

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

    ceik

      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

        • 1. Re: Error or changed implementation from 3.1 -> 3.2 causing Spring exception
          mstruk

          Since the exception happens inside the Spring code it's very difficult to connect the issue with something in GateIn just based on your snippets.

           

          Try to do some debugging with your IDE - setting breakpoints in

          org.springframework.web.portlet.mvc.annotation.Ann otationMethodHandlerAdapter$PortletHandlerMethodRe solver.resolveHandlerMethod(AnnotationMethodHandle rAdapter.java:507)

           

          and follow up the stack until you get to some GateIn code that seems to be causing the problem ...

           

          You can also file a JIRA Bug report, but attach a working example or testcase that demonstrates the issue.

          1 of 1 people found this helpful
          • 2. Re: Error or changed implementation from 3.1 -> 3.2 causing Spring exception
            ceik

            I've filed a JIRA Bug (https://issues.jboss.org/browse/GTNPORTAL-1994) and attached a demo porlet (source and war) to demonstrate the issue.

            Could not pin-point the cause of this, but in org.springframework.web.portlet.mvc.annotation.AnnotationMethodHandlerAdapter$RequestMappingInfo (line 796) , the method: "match" returned false because the resource id on the request was null.