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

 

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

### 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]
。。。 。。。。

 

posted on 2016-09-16 22:57  大象O无形  阅读(5843)  评论(0编辑  收藏  举报

导航