spring boot中使用security样例抛异常,Circular view path跳转失败
2018-03-27 11:42
1451 查看
参考官方spring-security样例,项目启动后访问任意url,访问报错
页面显示错误:
Tue Mar 27 11:22:42 CST 2018There was an unexpected error (type=Internal Server Error, status=500).Circular view path [login]: would dispatch back to the current handler URL [/login] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)
后台报错:
2018-03-27 11:22:42.338 ERROR 6232 --- [pr-8080-exec-10] o.s.b.w.servlet.support.ErrorPageFilter : Forwarding to error page from request [/login] due to exception [Circular view path [login]: would dispatch back to the current handler URL [/login] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)]
javax.servlet.ServletException: Circular view path [login]: would dispatch back to the current handler URL [/login] 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:209) ~[spring-webmvc-5.0.4.RELEASE.jar:5.0.4.RELEASE]
org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) ~[spring-security-web-5.0.3.RELEASE.jar:5.0.3.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.0.3.RELEASE.jar:5.0.3.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.0.3.RELEASE.jar:5.0.3.RELEASE]
at org.springframework.boot.web.servlet.support.ErrorPageFilter$1.doFilterInternal(ErrorPageFilter.java:90) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.0.4.RELEASE.jar:5.0.4.RELEASE]
......
......
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) [catalina.jar:8.0.33]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_65]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_65]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:8.0.33]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_65]
原因: 查看后发现,样例模板为thymeleaf
而本项目中未引进thymeleaf视图解析器,使用的是默认的视图解析器.
解决方法 : 引入thymeleaf与spring boot 集成jar包即可
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
页面显示错误:
Tue Mar 27 11:22:42 CST 2018There was an unexpected error (type=Internal Server Error, status=500).Circular view path [login]: would dispatch back to the current handler URL [/login] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)
后台报错:
2018-03-27 11:22:42.338 ERROR 6232 --- [pr-8080-exec-10] o.s.b.w.servlet.support.ErrorPageFilter : Forwarding to error page from request [/login] due to exception [Circular view path [login]: would dispatch back to the current handler URL [/login] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)]
javax.servlet.ServletException: Circular view path [login]: would dispatch back to the current handler URL [/login] 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:209) ~[spring-webmvc-5.0.4.RELEASE.jar:5.0.4.RELEASE]
org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) ~[spring-security-web-5.0.3.RELEASE.jar:5.0.3.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.0.3.RELEASE.jar:5.0.3.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.0.3.RELEASE.jar:5.0.3.RELEASE]
at org.springframework.boot.web.servlet.support.ErrorPageFilter$1.doFilterInternal(ErrorPageFilter.java:90) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.0.4.RELEASE.jar:5.0.4.RELEASE]
......
......
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) [catalina.jar:8.0.33]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_65]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_65]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:8.0.33]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_65]
原因: 查看后发现,样例模板为thymeleaf
而本项目中未引进thymeleaf视图解析器,使用的是默认的视图解析器.
解决方法 : 引入thymeleaf与spring boot 集成jar包即可
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
相关文章推荐
- Spring Boot集成Security使用数据库用户角色权限用户名问题
- Spring Boot集成Security使用数据库用户角色权限ROLE_问题
- springboot-30-security(三)使用注解实现权限控制
- SpringBoot + Spring Security 基本使用及个性化登录配置详解
- 3.Spring Boot + Security初步使用(覆盖配置的两种方式 配置类和XML注入以自定义页面为例)
- Spring boot Spring security,Thymeleaf使用自己的用户类登陆
- springboot+security 的BCryptPasswordEncoder 使用
- [安全] 使用 SpringBoot + SpringSecurity 做登录认证
- 直接使用security.basic.path无效|——springboot2.0以上的security的配置
- spring boot +security获取当前登录用户信息
- spring-boot--使用thymeleaf模板
- Spring Boot教程(十四)Spring Boot中使用Actuator的/info端点输出Git版本信息
- 如何在Spring Boot项目使用参数校验
- Spring Boot中使用MyBatis注解配置详解
- Https背景与证书在spring boot项目中的使用
- 6-Spring Boot ( 整合使用JdbcTemplate )
- 使用springboot+dubbo+zookeeper构建搭建生产者平台
- @SpringBootApplication的使用
- SpringBoot使用JdbcTemplate的双数据源配置