请求报Error querying database. Cause: java.lang.NullPointerException

请求报错Error querying database. Cause: java.lang.NullPointerException

### Cause: java.lang.NullPointerException
2020-05-14 11:38:16,247 34430  [nio-80-exec-152] DEBUG ort.DefaultListableBeanFactory  - Returning cached instance of singleton bean 'com.lindong.exception.GlobalExceptionResolver#0'
2020-05-14 11:38:16,247 34430  [nio-80-exec-152] DEBUG eptionHandlerExceptionResolver  - Invoking @ExceptionHandler method: public com.lindong.exception.ApiResult com.lindong.exception.GlobalExceptionResolver.handleException(java.lang.Exception)
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: java.lang.NullPointerException
### The error may exist in file [C:\Users\admin\Desktop\leek_bbs\target\leek_bbs\WEB-INF\classes\mappers\ILeadUserDao.xml]
### The error may involve com.lindong.dao.ILeadUserDao.getUserInfoById
### The error occurred while handling results
### SQL: select t1.id as userId,t1.another_name,t1.picture,t1.personalized_sign,t2.total_experience from user t1,experience t2 where t1.id=t2.user_id and t1.id= ?;
### Cause: java.lang.NullPointerException
	at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:79)
	at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:447)
	at com.sun.proxy.$Proxy504.selectOne(Unknown Source)
	at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:167)
	at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:82)
	at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59)
	at com.sun.proxy.$Proxy510.getUserInfoById(Unknown Source)
	at com.lindong.service.impl.LeadUserService.getUserInfoById(LeadUserService.java:17)
	at com.lindong.controller.PostController.leadUserInfo(PostController.java:43)
	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:205)
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)

一个小问题纠结了个把小时,就因为自己写代码的时候不够细心,记录一下
下面是我的mapper.xml的配置代码请求报Error querying database. Cause: java.lang.NullPointerException_第1张图片
随后我改过来后,就没有问题了.当然了,其余的一些配置我们也要注意啊,细节决定成败,就这么一个小小的细节问题,让我搞了个把小时,无奈…加油,奥里给!!!

你可能感兴趣的:(错误锦集,mysql,java,mybatis)