AOP configuration seems to be invalid: tried calling method [public abstract com.spring.entity.User com.spring.biz.UserBiz.getUserByName(java.lang.String)] on target [userBizImpl]; nested exception is java.lang.IllegalArgumentException: object is not an instance of declaring class
Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:281)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:187)14:40:17,109 DEBUG JDBCTransaction:152 - rollback
14:40:17,109 DEBUG JDBCTransaction:163 - rolled back JDBC Connection
14:40:17,109 DEBUG JDBCContext:215 - after transaction completion
14:40:17,109 DEBUG ConnectionManager:398 - aggressively releasing JDBC connection
14:40:17,109 DEBUG ConnectionManager:435 - releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154)
at com.spring.advice.AroundAdvice.invoke(AroundAdvice.java:17)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
at $Proxy0.getUserByName(Unknown Source)
at com.spring.entity.Test.main(Test.java:13)
14:40:17,109 DEBUG SessionImpl:422 - after transaction completion
14:40:17,109 DEBUG SessionImpl:353 - automatically closing session
14:40:17,109 DEBUG SessionImpl:273 - closing session
14:40:17,109 DEBUG ConnectionManager:369 - connection already null in cleanup : no action
Exception in thread "main" java.lang.NullPointerException
at com.spring.entity.Test.main(Test.java:14)
解决方案
错误如下:object is not an instance of declaring class
代码:method.invoke(object,new Object[]{subObject});原来不小心将object直接写为object.getClass(),并非得到我这个类的实例,修改为这个类的实例即可。
分享到:
相关推荐
NULL 博文链接:https://zw7534313.iteye.com/blog/2221200
Spring Aop 引用 源码
SpringAOP 报错error at ::0 can't find referenced pointcut deleteCell,或类似这样的错误,可能是因为springAOP相关依赖包版本低的缘故,本下载包,可以解决这个问题。
spring aop所需jar包,jdk1.7 spring aop报错 请下载aspectj-1.8.5.jar 更换低版本程序,再不行下载最新的aspectjweaver.jar
jdk1.7 spring aop报错 请下载aspectj-1.8.5.jar 更换低版本程序,再不行下载最新的aspectjweaver.jar
aspectj.jar jdk1.7 spring aop报错 请下载aspectj-1.9.1.jar 更换版本程序,再不行下载最新的aspectjweaver.jar
spring aop配置常用jar包,但是spring官网不提供下载。
把这两个包加到build path中。
如果java升级到1 7后spring aop报错 请下载aspectjweaver jar ver 1 7 2 更换低版本程序包即可
在Spring AOP代理过的对象上支持dubbo annotation配置事物失效问题-附件资源
Spring spectJ AOP 前置通知 后置通知 返回通知 异常通知 环绕通知
spring4.0框架识别不了标签报错, 需要引用aop标签,spring-aop-4.0.xsd 可以解决标 希望对大家有用 eclipse 》window》perferences》xml》xml catalog(本地要有spring-aop-4.0.xsd文件)
aspectjweaver.jar这是Spring AOP所要用到的包。这是第二个包,如果报错的话 建议更换jar包
spring源码编译缺少jar包,spring-cglib-repack-3.2.5.jar和spring-objenesis-repack-2.6.jar。
js+jquery+ajax的前端页面,Spring IOC的对象管理,Spring MVC的业务控制,MyBaties的持久层处理,Druid的连接池,Shiro的认证及权限管理,Spring AOP方式的日志管理,Jackson返回数据
Ignoring namespace handler [org.springframework.scripting.config....Spring Hibernate在AOP方面的配置冲突 Spring2.0 Hibernate3.1.x/Hibernate3.2 在使用Spring的AOP编程时,会用到这几个lib:
在使用spring的aop功能时,这两个jar是必须的,否则会报错,如下: Caused by: java.lang.ClassNotFoundException: org.aspectj.weaver.reflect.ReflectionWorld$ReflectionWorldException at java.net....
提示:开发前,先将nhibernate-configuration.xsd,nhibernate-mapping.xsd,spring-aop-1.1.xsd,spring-database-1.3.xsd和你能知道所有的xsd格式的spring相关文件放入到C:\Program Files\Microsoft Visual ...
aop,beans,cache,context,core,dao,ejb,instument,jca,jdbc,jms,jmx,jndi,mail,metadate,mock,orm,remoting,scheduling,scripting,stereotype,test,transcation,ui,util,validation,web 以上数十子模块源码全部为...
http://www.springframework.org/schema/aop/spring-aop-4.0.xsd"> ============================================= 解决整合问题: 1、Spring 3.x 对 Hibernate 4.x 不提供 HibernateDaoSupport,所以在dao的实现...