threw exception [Circular view path [index]: would dispatch back to the current handler URL [/index]

Posted 秋9

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了threw exception [Circular view path [index]: would dispatch back to the current handler URL [/index]相关的知识,希望对你有一定的参考价值。

【现象】

2022-07-23 14:54:31.191 [http-nio-8080-exec-9] ERROR o.a.c.c.C.[.[.[.[dispatcherServlet] - [log,175] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Circular view path [index]: would dispatch back to the current handler URL [/index] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)] with root cause
javax.servlet.ServletException: Circular view path [index]: would dispatch back to the current handler URL [/index] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)
    at org.springframework.web.servlet.view.InternalResourceView.prepareForRendering(InternalResourceView.java:210)
    at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:148)
    at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:317)
    at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1373)
    at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1118)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1057)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:634)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)

【解决方法】

   @RequestMapping("/index")
   public ModelAndView index(String key) throws Exception 
      this.logger.debug("进入搜索页");
      ModelAndView mav = this.getModelAndView("index");
      mav.addObject("keyword", key);
      this.logger.debug("" + mav);
      return mav;
   

修改为:

   @RequestMapping("/home")
   public ModelAndView index(String key) throws Exception 
      this.logger.debug("进入搜索页");
      ModelAndView mav = this.getModelAndView("index");
      mav.addObject("keyword", key);
      this.logger.debug("" + mav);
      return mav;
   

以上是关于threw exception [Circular view path [index]: would dispatch back to the current handler URL [/index]的主要内容,如果未能解决你的问题,请参考以下文章

Quartz:ERROR threw an unhandled Exception

Servlet.service() for servlet jsp threw exception

Servlet.service() for servlet jsp threw exception

Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: com/fasterxml/jacks

随手记录关于Factory method 'eurekaApplicationInfoManager' threw exception; nested exception is j(代

Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: com/fasterxml/jacks