The idea development tool is used normally, and the package is posted to the server and it prompts that thymeleaf cannot find the template.

template might not exist or might not be accessible by any of the configured Template Resolvers

Problem Description:

When the website is published to the server, a certain webpage indicates that the thymeleaf template cannot be found. When debugging locally, everything is normal with the idea development tool! The server application error message is as follows:

14:57:39.297 [http-nio-80-exec-12] ERROR o.a.c.c.C.[.[.[.[dispatcherServlet] - [log,175] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateInputException: Error resolving template [/portal/index], template might not exist or might not be accessible by any of the configured Template Resolvers] with root cause
org.thymeleaf.exceptions.TemplateInputException: Error resolving template [/portal/index], template might not exist or might not be accessible by any of the configured Template Resolvers
        at org.thymeleaf.engine.TemplateManager.resolveTemplate(TemplateManager.java:869)
        at org.thymeleaf.engine.TemplateManager.parseAndProcess(TemplateManager.java:607)
        at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1098)
        at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1072)
        at org.thymeleaf.spring5.view.ThymeleafView.renderFragment(ThymeleafView.java:362)
        at org.thymeleaf.spring5.view.ThymeleafView.render(ThymeleafView.java:189)
        at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1372)
        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:626)
        at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
        at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
        at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)

wrong reason

The returned viewName starts with /


@Controller
@RequestMapping("/portal")
public class PortalController {
    
    

    @RequestMapping("/index")
    public String index(){
    
    
    	// viewName不能以/开头,例如"/portal/index"
        return "portal/index";
    }
}    

Description:

spring-boot version 2.1.17.RELEASE

Guess you like

Origin blog.csdn.net/ory001/article/details/110131637