【shiro】报错: If the controller requires proxying (e.g. due to @Transactional), please use class-based proxying.-阿里云开发者社区

开发者社区> angel挤一挤> 正文

【shiro】报错: If the controller requires proxying (e.g. due to @Transactional), please use class-based proxying.

简介: spring整合shiro,项目报如下错误: 1 ==============异常开始============= 2 java.lang.IllegalStateException: The mapped controller method class 'com.
+关注继续查看

spring整合shiro,项目报如下错误:

 1 ==============异常开始=============
 2 java.lang.IllegalStateException: The mapped controller method class 'com.agen.controller.CorlibController' is not an instance of the actual controller bean instance 'com.sun.proxy.$Proxy45'. If the controller requires proxying (e.g. due to @Transactional), please use class-based proxying.
 3 HandlerMethod details: 
 4 Controller [com.sun.proxy.$Proxy45]
 5 Method [public java.lang.String com.agen.controller.CorlibController.queryAll(java.lang.String,java.lang.String,org.springframework.web.servlet.mvc.support.RedirectAttributes)]
 6 Resolved arguments: 
 7 [0] [type=java.lang.String] [value=corlib]
 8 [1] [null] 
 9 [2] [type=org.springframework.web.servlet.mvc.support.RedirectAttributesModelMap] [value={}]
10 
11     at org.springframework.web.method.support.InvocableHandlerMethod.assertTargetBean(InvocableHandlerMethod.java:261)
12     at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:224)
13     at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
14     at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
15     at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:777)
16     at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:706)
17     at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
18     at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943)
19     at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877)
20     at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)
21     at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857)
22     at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
23     at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
24     at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
25     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
26     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
27     at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
28     at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
29     at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
30     at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
31     at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
32     at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
33     at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
34     at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
35     at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
36     at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
37     at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
38     at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
39     at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
40     at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
41     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
42     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
43     at org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:150)
44     at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
45     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
46     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
47     at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
48     at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
49     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
50     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
51     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
52     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
53     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
54     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
55     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
56     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
57     at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:879)
58     at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:617)
59     at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1778)
60     at java.lang.Thread.run(Thread.java:745)
61 ==============异常结束=============
View Code

 

解决方法:

重新配置shiro的配置文件:

<!-- 开启Shiro注解 -->
    <bean class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator" depends-on="lifecycleBeanPostProcessor">
        <property name="proxyTargetClass" value="true"/> 
    </bean>  

即可解决

版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

相关文章
HSF/Dubbo序列化时的LocalDateTime, Instant的性能问题
### 来源 在对Dubbo新版本做性能压测时,无意中发现对用例中某个TO(Transfer Object)类的一属性字段稍作修改,由Date变成LocalDateTime,结果是吞吐量由近5w变成了2w,RT由9ms升指90ms。
2395 0
独家揭秘:阿里小程序的一云多端!看这篇就够了!
阿里巴巴小程序一云多端的整体战略,以及阿里小程序后续为开发者提供的云服务(云应用、云开发等)、开发者工具链(IDE、插件、SDK等)、跨端框架能力说明。同时结合繁星计划后续提供给开发者的扶持和ISV的权益体系做一个整体的介绍。
27416 0
mac vagrant 创建 lnmp 开发环境
建议使用迅雷下载,浏览器下载可能太慢。123实操笔记mac homebrew 安装 vagrant$ brew cask install vagrantCloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask'.
614 0
CDN的HTTPS配置及故障排除
相较于HTTP协议来说,HTTPS协议在网络链路中传输更具有安全可靠性,因为它通过SSL证书在链路中间对我们七层的网络包做了加密,进而防止了一些恶意的内容劫持。针对于这种场景,阿里云CDN也提供了相关的功能,可以支持客户端到CDN L1节点的HTTPS的协议。
1590 0
GDB 调试 Mysql 实战(一)源码编译安装
下载源码 git clone https://github.com/mysql/mysql-server.git cd mysql-server git checkout 5.7 编译安装 安装依赖 yum install -y cmake make gcc gcc-c++ ncurses-dev...
1003 0
PostgreSQL 锁
锁的类型 /* NoLock is not a lock mode, but a flag value meaning "don't get a lock" */ #define NoLock 0 #define AccessS...
1161 0
+关注
angel挤一挤
【任何0基础都能看懂的步骤和解决方法!】
340
文章
0
问答
文章排行榜
最热
最新
相关电子书
更多
《2021云上架构与运维峰会演讲合集》
立即下载
《零基础CSS入门教程》
立即下载
《零基础HTML入门教程》
立即下载