距离上一篇文章已经很长时间了,最近太忙碌了,今天发布spring boot遇到一个问题,找了好久才找到解决办法,今天贴出来和大家一起分享下,首先看错误信息
1 HTTP Status 500 - Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateInputException: Error resolving template "/error/error", template might not exist or might not be accessible by any of the configured Template Resolvers 2 3 4 type Exception report 5 6 message Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateInputException: Error resolving template "/error/error", template might not exist or might not be accessible by any of the configured Template Resolvers 7 8 description The server encountered an internal error that prevented it from fulfilling this request. 9 10 exception 11 org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateInputException: Error resolving template "/error/error", template might not exist or might not be accessible by any of the configured Template Resolvers 12 org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:982) 13 org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) 14 javax.servlet.http.HttpServlet.service(HttpServlet.java:622) 15 org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) 16 javax.servlet.http.HttpServlet.service(HttpServlet.java:729) 17 org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) 18 org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) 19 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) 20 org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:105) 21 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) 22 org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81) 23 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) 24 org.springframework.session.web.http.SessionRepositoryFilter.doFilterInternal(SessionRepositoryFilter.java:167) 25 org.springframework.session.web.http.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:80) 26 org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) 27 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) 28 29 30 root cause 31 org.thymeleaf.exceptions.TemplateInputException: Error resolving template "/error/error", template might not exist or might not be accessible by any of the configured Template Resolvers 32 org.thymeleaf.TemplateRepository.getTemplate(TemplateRepository.java:246) 33 org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1104) 34 org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1060) 35 org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1011) 36 org.thymeleaf.spring4.view.ThymeleafView.renderFragment(ThymeleafView.java:335) 37 org.thymeleaf.spring4.view.ThymeleafView.render(ThymeleafView.java:190) 38 org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1282) 39 org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1037) 40 org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:980) 41 org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) 42 org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) 43 org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) 44 javax.servlet.http.HttpServlet.service(HttpServlet.java:622) 45 org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) 46 javax.servlet.http.HttpServlet.service(HttpServlet.java:729) 47 org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) 48 org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) 49 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) 50 org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:105) 51 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) 52 org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81) 53 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) 54 org.springframework.session.web.http.SessionRepositoryFilter.doFilterInternal(SessionRepositoryFilter.java:167) 55 org.springframework.session.web.http.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:80) 56 org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) 57 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) 58 59 60 note The full stack trace of the root cause is available in the Apache Tomcat/8.5.11 logs. 61 62 63 Apache Tomcat/8.5.11
spring boot + thymeleaf 是第一次使用并发布,本地代码没有问题,发布到服务器就出现了上面的错误,看到网上很多人说是配置的问题,尝试了很多种都不行,最后终于发现是有一个很简单的问题造成的,直接看解决办法:
没解决前的controller:
解决口的controller:
然后发布就解决上面的问题了。
开开心心编码,快快乐乐生活。