Cannot subclass final class class com.sun.proxy.$Proxy31

spring MVC+MyBatis框架中,用aop拦截dao报这样的错误“Cannot subclass final class class com.sun.proxy.$Proxy31”

把配置文件proxy-target-class后不报错,原来是“true”,不知道什么原因,求大神解答

<aop:aspectj-autoproxy proxy-target-class="false"/>  

好像是proxy-target-class="true"是强制使用cglib动态代理(不能处理被final关键字修饰的方法),而false是JDK代理

博主设置当前文章不允许评论。

Cannot inherit from final class

03-26

有个方法,main方法调用没有问题,嵌入到struts项目中就报错了。n2015/03/26 10:48:02,137 [org.apache.struts2.dispatcher.Dispatcher]-[ERROR] Exception occurred during processing request: nullnjava.lang.reflect.InvocationTargetExceptionn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)n at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)n at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)n at java.lang.reflect.Method.invoke(Method.java:597)n at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:450)n at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:289)n at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:252)n at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256)n at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)n at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:167)n at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)n at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)n at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265)n at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)n at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)n at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)n at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138)n at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)n at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239)n at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)n at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)n at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239)n at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)n at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)n at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191)n at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)n at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:73)n at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)n at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:91)n at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)n at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:252)n at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)n at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)n at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)n at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)n at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)n at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145)n at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)n at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171)n at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)n at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)n at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:161)n at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)n at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)n at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)n at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:193)n at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)n at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:189)n at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)n at com.jp2p.action.loginJudge.intercept(loginJudge.java:65)n at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)n at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)n at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:563)n at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)n at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)n at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)n at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)n at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)n at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)n at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)n at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)n at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)n at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)n at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:879)n at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:617)n at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1774)n at java.lang.Thread.run(Thread.java:619)nCaused by: java.lang.VerifyError: Cannot inherit from final classn at java.lang.ClassLoader.defineClass1(Native Method)n at java.lang.ClassLoader.defineClass(ClassLoader.java:621)n at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)n at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2854)n at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1159)n at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1647)n at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)n at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)n at org.apache.http.impl.client.DefaultHttpClient.createHttpParams(DefaultHttpClient.java:161)n at org.apache.http.impl.client.AbstractHttpClient.getParams(AbstractHttpClient.java:426)n at com.jp2p.yibao.util.httpclient.HttpClient4Util.(HttpClient4Util.java:88)n at com.jp2p.yibao.util.common.YJPayUtil.payAPIRequest(YJPayUtil.java:60)n at com.jp2p.util.payUtil.PayAPIServiceImpl.bindList(PayAPIServiceImpl.java:55)n at com.jp2p.wechatAction.yibaoPayAction.bankPay(yibaoPayAction.java:82)n ... 67 morennnnn错误地方为:httpclient.getParams().setParameter(n CoreConnectionPNames.SO_TIMEOUT, timeout);

没有更多推荐了,返回首页