java.lang.NoSuchMethodError: org.springframework.dao.IncorrectResultSizeDataAccessException

spring data jpa  运用,在dao类中写自己新增的方法,使用@query写hql语句,出现以下异常:
Caused by: java.lang.NoSuchMethodError: org.springframework.dao.IncorrectResultSizeDataAccessException.<init>(Ljava/lang/String;ILjava/lang/Throwable;)V
at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:307)
at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:107)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:403)
at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:58)
at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:213)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:163)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.data.jpa.repository.support.LockModeRepositoryPostProcessor$LockModePopulatingMethodIntercceptor.invoke(LockModeRepositoryPostProcessor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy197.findByArStatus(Unknown Source)
at com.hopebridge.bloodlibrary.dal.daoservice.dic.DictAuditRoleDaoService.findByArStatus(DictAuditRoleDaoService.java:95)
at com.hopebridge.bloodlibrary.dal.daoservice.dic.DictAuditRoleDaoService$$FastClassByCGLIB$$b1ba3913.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:698)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:631)
at com.hopebridge.bloodlibrary.dal.daoservice.dic.DictAuditRoleDaoService$$EnhancerByCGLIB$$3d713821.findByArStatus(<generated>)
at com.hopebridge.bloodlibrary.dal.service.dic.DictAuditRoleService.findByArStatus(DictAuditRoleService.java:185)
at com.hopebridge.bloodlibrary.bll.business.BdApplyCombineEntityLogic.ValidateAuthority(BdApplyCombineEntityLogic.java:199)
at com.hopebridge.bloodlibrary.bll.business.BdApplyCombineEntityLogic.AuditBdApplyEntity(BdApplyCombineEntityLogic.java:112)
at com.hopebridge.service.blood.business.BdApplyCombineEntityService.AuditBdApplyEntity(BdApplyCombineEntityService.java:31)
... 52 more
 
解决思路:像java.lang.NoSuchMethodError: org.springframework.dao.IncorrectResultSizeDataAccessException.<init>(Ljava/lang/String;ILjava/lang/Throwable;)V这类型的错误一般是未找到方法,或者是引入多个包造成版本冲突
找到org.springframework.dao.IncorrectResultSizeDataAccessException.<init>(Ljava/lang/String;ILjava/lang/Throwable;)V所在的包,发现有两个包有这个类,一个是spring-tx,一个是另外一个包有这个类但是没这个方法,删掉这个包便正常。
 
顺便说一下  JNI字段描述符(Ljava/lang/String;ILjava/lang/Throwable;)V
最后面的V表示void即无返回值
L表示对象类型,后面紧跟对象类型java/lang/String;分割
I表示基本类型int,不用;分割,后面是另外一个对象类型java/lang/Throwable
整个表示方法 void IncorrectResultSizeDataAccessException(String,int,Throwable)

 

转载于:https://www.cnblogs.com/zhangcybb/p/3708075.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值