解决Mybatis系统异常org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflec

解决Mybatis系统异常org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'certno' in 'class java.lang.String'

这是我第二次遇到这个错误了,我必须要写个博客安慰一下自己…

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'certno' in 'class java.lang.String'
	at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:77)
	at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446)
	at com.sun.proxy.$Proxy75.selectOne(Unknown Source)
	at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:166)
	at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:84)
	at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:58)
	at com.sun.proxy.$Proxy80.selectCountByCertno(Unknown Source)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
	at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:139)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
	at com.sun.proxy.$Proxy81.selectCountByCertno(Unknown Source)
	at com.wangzc.firstspringbootproject.service.IcAccinfoServiceimpl.IcAccinfoServiceimpl.selectCountByCertno(IcAccinfoServiceimpl.java:38)
	at com.wangzc.firstspringbootproject.controller.IcAccinfoController.selectCountByCertno(IcAccinfoController.java:65)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:215)
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:142)
	at org.springframework.web.servlet.mvc.method
  • 10
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 8
    评论
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.Reflecti是一个MyBatis框架中的异常。它通常表示在使用MyBatis进行数据库操作时发生了反射异常MyBatis是一个Java持久层框架,它简化了与数据库的交互。在使用MyBatis时,我们可以通过配置文件或注解来定义SQL语句,并使用Java对象来映射数据库表。当执行SQL语句时,MyBatis会使用反射机制来将结果映射到Java对象中。 然而,当出现反射异常时,就会抛出org.apache.ibatis.reflection.ReflectionException。这可能是由于以下原因导致的: 1. 未正确配置MyBatis的映射文件或注解。请确保你的映射文件或注解正确地定义了SQL语句和映射关系。 2. SQL语句中的参数或返回类型与映射文件或注解中定义的类型不匹配。请检查参数和返回类型是否正确。 3. 数据库连接或配置错误。请确保你的数据库连接配置正确,并且数据库可正常访问。 解决这个问题的方法包括: 1. 检查你的映射文件或注解是否正确配置,并确保SQL语句和映射关系正确。 2. 检查你的参数和返回类型是否与映射文件或注解中定义的类型匹配。 3. 检查你的数据库连接配置是否正确,并确保数据库可正常访问。 4. 查看MyBatis的日志输出,以获取更详细的错误信息。 以下是一个示例代码,演示了如何处理org.mybatis.spring.MyBatisSystemException异常: ```java try { // 执行MyBatis操作 } catch (org.mybatis.spring.MyBatisSystemException e) { // 处理异常 Throwable cause = e.getCause(); if (cause instanceof org.apache.ibatis.reflection.ReflectionException) { // 处理反射异常 // ... } else { // 处理其他异常 // ... } } ```

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值