我试图将Aspects集成到通过XML模式配置的旧的单片Spring MVC应用程序中。
Spring AOP通过<context:component-scan .../> & <aop:aspectj-autoproxy proxy-target-class="true"/>
配置
委托bean模式定义&amp; AOP配置。已被放置在相同的模式上下文定义文件中。
分配NPE的实例变量在委托的父抽象类中声明,其修饰符为Protected accessor default
应用的Aspect建议是@Before,@Before("execution(* c.x.at.movement.webservice.WsVerifyTxn.process(..) )")
,以及建议中的简单日志语句。
如果没有SpringAOP AspectJ,禁用,我可以在没有任何错误的情况下执行流程。
没有地方super.variable被指定为null。
如果有人可以指示或建议让我摆脱这种困境,那将非常感激!
以下是三个用于审核的堆栈跟踪
c.x.a.c.transaction.PersistableTxn.retrieveData(@664): Error executing Business Delegate Controller for uri '/snippet/verify':
java.lang.NullPointerException
at c.x.a.c.transaction.PersistableTxn.retrieveData(PersistableTxn.java:664)
at c.x.a.c.transaction.PersistableTxn.getTxnHistory(PersistableTxn.java:891)
at c.x.a.c.transaction.PersistableTxn.finalize(PersistableTxn.java:562)
at c.x.at.movement.BaseDelegate.finalize(BaseDelegate.java:257)
at c.x.at.movement.BaseDelegate$$FastClassByCGLIB$$cbb13d00_2.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:688)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:621)
at c.x.at.movement.webservice.WsVerifyTxn$$EnhancerByCGLIB$$5ee08d0e.finalize(<generated>)
at c.x.a.c.businessdelegate.PersistableBusinessDelegate.postProcess(PersistableBusinessDelegate.java:118)
at c.x.a.c.businessdelegate.BusinessDelegateAdapter.execute(BusinessDelegateAdapter.java:297)
at c.x.a.c.businessdelegate.spring.BusinessDelegateController.handleRequestInternal(BusinessDelegateController.java:175)
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at c.x.commons.session.servlet.SSMCFilter.doFilter(SSMCFilter.java:79)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at c.x.commons.security.auth.xAuthFilter$_filter_action.run(xAuthFilter.java:78)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAsPrivileged(Subject.java:536)
at c.x.commons.util.j2ee.J2EESubjectPropagaterNoOp.doAsPrivileged(J2EESubject.java:80)
at c.x.commons.security.auth.xAuthFilter.doFilter(xAuthFilter.java:154)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at c.x.commons.cs203.servlet.CS203CoreServletFilter.doFilter(CS203CoreServletFilter.java:86)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at c.x.a.c.model.accountinfo.filter.CacheFilter.doFilter(CacheFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:722)
Daemon Thread [http-bio-9080-exec-2] (Suspended (breakpoint at line 196 in BusinessDelegate))
owns: SocketWrapper<E> (id=363)
WsVerifyTxn$$EnhancerByCGLIB$$eeedc57b(BusinessDelegate).preProcess(xContext, Object) line: 196
WsVerifyTxn$$EnhancerByCGLIB$$eeedc57b(PersistableBusinessDelegate).preProcess(xContext, Object) line: 34
BusinessDelegateAdapter.execute(RequestContext) line: 267
BusinessDelegateController.handleRequestInternal(HttpServletRequest, HttpServletResponse) line: 175
BusinessDelegateController(AbstractController).handleRequest(HttpServletRequest, HttpServletResponse) line: 153
SimpleControllerHandlerAdapter.handle(HttpServletRequest, HttpServletResponse, Object) line: 48
DispatcherServlet.doDispatch(HttpServletRequest, HttpServletResponse) line: 790
DispatcherServlet.doService(HttpServletRequest, HttpServletResponse) line: 719
DispatcherServlet(FrameworkServlet).processRequest(HttpServletRequest, HttpServletResponse) line: 644
DispatcherServlet(FrameworkServlet).doPost(HttpServletRequest, HttpServletResponse) line: 560
DispatcherServlet(HttpServlet).service(HttpServletRequest, HttpServletResponse) line: 646
DispatcherServlet(HttpServlet).service(ServletRequest, ServletResponse) line: 727
ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 303
ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 208
WsFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 52
ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 241
ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 208
SSMCFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 79
ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 241
ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 208
xAuthFilter$_filter_action.run() line: 78
AccessController.doPrivileged(PrivilegedExceptionAction<T>, AccessControlContext) line: not available [native method]
Subject.doAsPrivileged(Subject, PrivilegedExceptionAction<T>, AccessControlContext) line: 536
J2EESubjectPropagaterNoOp.doAsPrivileged(Subject, PrivilegedExceptionAction, AccessControlContext) line: 80
xAuthFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 154
ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 241
ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 208
CS203CoreServletFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 86
DelegatingFilterProxy.invokeDelegate(Filter, ServletRequest, ServletResponse, FilterChain) line: 237
DelegatingFilterProxy.doFilter(ServletRequest, ServletResponse, FilterChain) line: 167
ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 241
ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 208
CacheFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 53
ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 241
ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 208
StandardWrapperValve.invoke(Request, Response) line: 220
StandardContextValve.invoke(Request, Response) line: 122
NonLoginAuthenticator(AuthenticatorBase).invoke(Request, Response) line: 503
StandardHostValve.invoke(Request, Response) line: 170
ErrorReportValve.invoke(Request, Response) line: 103
AccessLogValve.invoke(Request, Response) line: 950
StandardEngineValve.invoke(Request, Response) line: 116
CoyoteAdapter.service(Request, Response) line: 421
Http11Processor(AbstractHttp11Processor<S>).process(SocketWrapper<S>) line: 1070
Http11Protocol$Http11ConnectionHandler(AbstractProtocol$AbstractConnectionHandler<S,P>).process(SocketWrapper<S>, SocketStatus) line: 611
JIoEndpoint$SocketProcessor.run() line: 314
ThreadPoolExecutor(ThreadPoolExecutor).runWorker(ThreadPoolExecutor$Worker) line: 1110
ThreadPoolExecutor$Worker.run() line: 603
TaskThread$WrappingRunnable.run() line: 61
TaskThread(Thread).run() line: 722
Daemon Thread [http-bio-9080-exec-2] (Suspended (breakpoint at line 664 in PersistableTxn))
owns: SocketWrapper<E> (id=363)
WsVerifyTxn(PersistableTxn).retrieveData(String) line: 664
WsVerifyTxn(PersistableTxn).getTxnHistory() line: 891
WsVerifyTxn(PersistableTxn).finalize(Persistable, xContext, xModelOutput) line: 562
WsVerifyTxn(BaseDelegate).finalize(Persistable, xContext, xModelOutput) line: 257
BaseDelegate$$FastClassByCGLIB$$cbb13d00_2.invoke(int, Object, Object[]) line: not available
MethodProxy.invoke(Object, Object[]) line: 191
Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint() line: 688
Cglib2AopProxy$CglibMethodInvocation(ReflectiveMethodInvocation).proceed() line: 150
ExposeInvocationInterceptor.invoke(MethodInvocation) line: 89
Cglib2AopProxy$CglibMethodInvocation(ReflectiveMethodInvocation).proceed() line: 172
Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Object, Method, Object[], MethodProxy) line: 621
WsVerifyTxn$$EnhancerByCGLIB$$eeedc57b.finalize(Persistable, xContext, xModelOutput) line: not available
WsVerifyTxn$$EnhancerByCGLIB$$eeedc57b(PersistableBusinessDelegate).postProcess(xContext, xModelOutput) line: 118
BusinessDelegateAdapter.execute(RequestContext) line: 297
BusinessDelegateController.handleRequestInternal(HttpServletRequest, HttpServletResponse) line: 175
BusinessDelegateController(AbstractController).handleRequest(HttpServletRequest, HttpServletResponse) line: 153
SimpleControllerHandlerAdapter.handle(HttpServletRequest, HttpServletResponse, Object) line: 48
DispatcherServlet.doDispatch(HttpServletRequest, HttpServletResponse) line: 790
DispatcherServlet.doService(HttpServletRequest, HttpServletResponse) line: 719
DispatcherServlet(FrameworkServlet).processRequest(HttpServletRequest, HttpServletResponse) line: 644
DispatcherServlet(FrameworkServlet).doPost(HttpServletRequest, HttpServletResponse) line: 560
DispatcherServlet(HttpServlet).service(HttpServletRequest, HttpServletResponse) line: 646
DispatcherServlet(HttpServlet).service(ServletRequest, ServletResponse) line: 727
ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 303
ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 208
WsFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 52
ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 241
ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 208
SSMCFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 79
ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 241
ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 208
xAuthFilter$_filter_action.run() line: 78
AccessController.doPrivileged(PrivilegedExceptionAction<T>, AccessControlContext) line: not available [native method]
Subject.doAsPrivileged(Subject, PrivilegedExceptionAction<T>, AccessControlContext) line: 536
J2EESubjectPropagaterNoOp.doAsPrivileged(Subject, PrivilegedExceptionAction, AccessControlContext) line: 80
xAuthFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 154
ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 241
ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 208
CS203CoreServletFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 86
DelegatingFilterProxy.invokeDelegate(Filter, ServletRequest, ServletResponse, FilterChain) line: 237
DelegatingFilterProxy.doFilter(ServletRequest, ServletResponse, FilterChain) line: 167
ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 241
ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 208
CacheFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 53
ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 241
ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 208
StandardWrapperValve.invoke(Request, Response) line: 220
StandardContextValve.invoke(Request, Response) line: 122
NonLoginAuthenticator(AuthenticatorBase).invoke(Request, Response) line: 503
StandardHostValve.invoke(Request, Response) line: 170
ErrorReportValve.invoke(Request, Response) line: 103
AccessLogValve.invoke(Request, Response) line: 950
StandardEngineValve.invoke(Request, Response) line: 116
CoyoteAdapter.service(Request, Response) line: 421
Http11Processor(AbstractHttp11Processor<S>).process(SocketWrapper<S>) line: 1070
Http11Protocol$Http11ConnectionHandler(AbstractProtocol$AbstractConnectionHandler<S,P>).process(SocketWrapper<S>, SocketStatus) line: 611
JIoEndpoint$SocketProcessor.run() line: 314
ThreadPoolExecutor(ThreadPoolExecutor).runWorker(ThreadPoolExecutor$Worker) line: 1110
ThreadPoolExecutor$Worker.run() line: 603
TaskThread$WrappingRunnable.run() line: 61
TaskThread(Thread).run() line: 722