mybatis报错invalid types () or values ()解决方法

转载 2018年04月17日 16:10:25

原因: Pojo类User没提供无参数构造方法, 加上该构造方法后,问题解决

引入lombok后直接加

@NoArgsConstructor
复制代码
### Cause: org.apache.ibatis.reflection.ReflectionException: 
Error instantiating class com.chry.browserServer.db.model.User with invalid types () or values (). 
cause: java.lang.NoSuchMethodException: com.chry.browserServer.db.model.User.<init>()] with root cause

java.lang.NoSuchMethodException: com.chry.browserServer.db.model.User.<init>()
    at java.lang.Class.getConstructor0(Class.java:2849) ~[na:1.7.0_67]
    at java.lang.Class.getDeclaredConstructor(Class.java:2053) ~[na:1.7.0_67]
    at org.apache.ibatis.reflection.factory.DefaultObjectFactory.instantiateClass(DefaultObjectFactory.java:57) ~[mybatis-3.2.1.jar:3.2.1]
    at org.apache.ibatis.reflection.factory.DefaultObjectFactory.create(DefaultObjectFactory.java:45) ~[mybatis-3.2.1.jar:3.2.1]
    at org.apache.ibatis.reflection.factory.DefaultObjectFactory.create(DefaultObjectFactory.java:38) ~[mybatis-3.2.1.jar:3.2.1]
    at org.apache.ibatis.executor.resultset.FastResultSetHandler.createResultObject(FastResultSetHandler.java:387) ~[mybatis-3.2.1.jar:3.2.1]
    at org.apache.ibatis.executor.resultset.FastResultSetHandler.createResultObject(FastResultSetHandler.java:366) ~[mybatis-3.2.1.jar:3.2.1]
    at org.apache.ibatis.executor.resultset.FastResultSetHandler.getRowValue(FastResultSetHandler.java:266) ~[mybatis-3.2.1.jar:3.2.1]
    at org.apache.ibatis.executor.resultset.FastResultSetHandler.handleRowValues(FastResultSetHandler.java:221) ~[mybatis-3.2.1.jar:3.2.1]
    at org.apache.ibatis.executor.resultset.FastResultSetHandler.handleResultSet(FastResultSetHandler.java:193) ~[mybatis-3.2.1.jar:3.2.1]
    at org.apache.ibatis.executor.resultset.FastResultSetHandler.handleResultSets(FastResultSetHandler.java:159) ~[mybatis-3.2.1.jar:3.2.1]
    at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:57) ~[mybatis-3.2.1.jar:3.2.1]
    at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:70) ~[mybatis-3.2.1.jar:3.2.1]
    at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:57) ~[mybatis-3.2.1.jar:3.2.1]
    at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:259) ~[mybatis-3.2.1.jar:3.2.1]
    at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:132) ~[mybatis-3.2.1.jar:3.2.1]
    at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:105) ~[mybatis-3.2.1.jar:3.2.1]
    at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:81) ~[mybatis-3.2.1.jar:3.2.1]
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:104) ~[mybatis-3.2.1.jar:3.2.1]
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:98) ~[mybatis-3.2.1.jar:3.2.1]
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:62) ~[mybatis-3.2.1.jar:3.2.1]
。。。 。。。。

mybatis映射问题,报错Error instantiating null with invalid types () or values (). Cause:java.lang.NullPoint

在用mybatis做关联查询,用association关联查询,报错Error instantiating null with invalid types () or values (). Cause...
  • likawei1314
  • likawei1314
  • 2017-03-25 03:31:39
  • 2030

Mybatis 报错Error instantiating class ---- with invalid types () or values ().

org.apache.ibatis.exceptions.PersistenceException:  ### Error querying database.  Cause: java.lang....
  • teliduxing_c
  • teliduxing_c
  • 2017-06-17 18:21:53
  • 278

Myhabits报错invalid types () or values ()解决方法with invalid types () or values (). Cause: java.lang.NoSu

是报错信息: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection....
  • qq_25821067
  • qq_25821067
  • 2017-02-01 21:21:09
  • 401

Error instantiating class with invalid types () or values ()

在使用mysql时,遇到了该错误,详细错误日志如下 org.apache.ibatis.exceptions.PersistenceException: ### Error querying da...
  • pansanday
  • pansanday
  • 2015-12-23 21:41:21
  • 6447

Myhabits报错invalid types () or values ()解决方法

在使用ssm的时候,报了这个错 org.mybatis.spring.MyBatisSystemException:  nested exception is org.apache.ibatis....
  • zou2ouzou
  • zou2ouzou
  • 2017-04-25 18:58:15
  • 366

Mybatis出错:Error instantiating class xxx with invalid types () or values ()

写下这篇博客来警示自己: 今天配置mybatis出现这个错误 org.apache.ibatis.exceptions.PersistenceException: ### Error query...
  • zjkC050818
  • zjkC050818
  • 2017-07-05 15:13:50
  • 798

Mybatis出错:Error instantiating class com.User with invalid types () or values ()

### Error querying database. Cause: org.apache.ibatis.reflection.ReflectionException: Error instant...
  • li330394383
  • li330394383
  • 2016-08-15 22:33:55
  • 4347

Error instantiating class book.pojo.User with invalid types () or values (). 报错解决方法

错误提示代码: Error instantiating class book.pojo.User with invalid types () or values (). Cause: java.l...
  • baidu_32262373
  • baidu_32262373
  • 2016-03-01 20:12:10
  • 1655

Error instantiating class xxx with invalid types () or values ()

服务启动的时候出现该错误,查了很久,发现在javabean中需要有一个无参的构造器。public XXX(){ }加上之后解决问题,特此记录。...
  • m0_37172806
  • m0_37172806
  • 2017-10-23 13:47:05
  • 90

Error instantiating class com.ding.test.User with invalid types () or values (). Cause: java.lang.No

mybatis遇见错误: Exception in thread "main" org.apache.ibatis.exceptions.PersistenceException: ###...
  • dingsai88
  • dingsai88
  • 2015-02-09 14:11:18
  • 4706
收藏助手
不良信息举报
您举报文章:mybatis报错invalid types () or values ()解决方法
举报原因:
原因补充:

(最多只允许输入30个字)