67,513
社区成员
发帖
与我相关
我的任务
分享
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: Error instantiating interface com.edu.ccut.dao.MessageimgMapper with invalid types () or values (). Cause: java.lang.NoSuchMethodException: com.edu.ccut.dao.MessageimgMapper.<init>()
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:75)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:371)
at com.sun.proxy.$Proxy19.selectList(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:198)
at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:119)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:63)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:52)
at com.sun.proxy.$Proxy20.getAllMessageByIndex(Unknown Source)
at com.edu.ccut.service.impl.IMemberServiceImpl.getAllMessageByIndex(IMemberServiceImpl.java:112)
at com.edu.ccut.test.TestMain.testExample(TestMain.java:70)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:73)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:73)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:217)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:83)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:68)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:163)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: org.apache.ibatis.reflection.ReflectionException: Error instantiating interface com.edu.ccut.dao.MessageimgMapper with invalid types () or values (). Cause: java.lang.NoSuchMethodException: com.edu.ccut.dao.MessageimgMapper.<init>()
at org.apache.ibatis.reflection.factory.DefaultObjectFactory.instantiateClass(DefaultObjectFactory.java:86)
at org.apache.ibatis.reflection.factory.DefaultObjectFactory.create(DefaultObjectFactory.java:48)
at org.apache.ibatis.reflection.factory.DefaultObjectFactory.create(DefaultObjectFactory.java:41)
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.createResultObject(DefaultResultSetHandler.java:528)
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.createResultObject(DefaultResultSetHandler.java:507)
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.getRowValue(DefaultResultSetHandler.java:738)
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.applyNestedResultMappings(DefaultResultSetHandler.java:791)
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.getRowValue(DefaultResultSetHandler.java:747)
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleRowValuesForNestedResultMap(DefaultResultSetHandler.java:713)
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleRowValues(DefaultResultSetHandler.java:264)
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSet(DefaultResultSetHandler.java:236)
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSets(DefaultResultSetHandler.java:150)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:60)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:73)
at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:60)
at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:267)
at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:137)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:96)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:77)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.ibatis.plugin.Invocation.proceed(Invocation.java:49)
at com.github.pagehelper.util.SqlUtil.doIntercept(SqlUtil.java:175)
at com.github.pagehelper.util.SqlUtil.intercept(SqlUtil.java:84)
at com.github.pagehelper.PageHelper.intercept(PageHelper.java:50)
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:60)
at com.sun.proxy.$Proxy26.query(Unknown Source)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:108)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:102)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:358)
... 37 more
Caused by: java.lang.NoSuchMethodException: com.edu.ccut.dao.MessageimgMapper.<init>()
at java.lang.Class.getConstructor0(Class.java:2892)
at java.lang.Class.getDeclaredConstructor(Class.java:2058)
at org.apache.ibatis.reflection.factory.DefaultObjectFactory.instantiateClass(DefaultObjectFactory.java:60)
... 72 more
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.edu.ccut.dao.MessageimgMapper">
<resultMap id="MessageResultMap" type="com.edu.ccut.pojo.Messageimg">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Sat Jan 07 10:03:24 CST 2017.
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="memberid" jdbcType="INTEGER" property="memberid" />
<result column="compressimgurl" jdbcType="VARCHAR" property="compressimgurl" />
<result column="sourceimgname" jdbcType="VARCHAR" property="sourceimgname" />
<result column="sourcimgurl" jdbcType="VARCHAR" property="sourcimgurl" />
<result column="saveurl" jdbcType="VARCHAR" property="saveurl" />
<result column="sourcimgwidth" jdbcType="INTEGER" property="sourcimgwidth" />
<result column="sourceimgheight" jdbcType="INTEGER" property="sourceimgheight" />
<result column="circle" jdbcType="VARCHAR" property="circle" />
<result column="imgaddress" jdbcType="VARCHAR" property="imgaddress" />
<result column="addresscode" jdbcType="INTEGER" property="addresscode" />
<result column="content" jdbcType="VARCHAR" property="content" />
<result column="createdate" jdbcType="TIMESTAMP" property="createdate" />
<result column="state" jdbcType="INTEGER" property="state" />
<result column="commentnum" jdbcType="INTEGER" property="commentnum" />
<result column="laudnum" jdbcType="INTEGER" property="laudnum" />
<result column="r1" jdbcType="VARCHAR" property="r1" />
<result column="r2" jdbcType="VARCHAR" property="r2" />
<result column="r3" jdbcType="VARCHAR" property="r3" />
<result column="r4" jdbcType="VARCHAR" property="r4" />
<result column="r5" jdbcType="VARCHAR" property="r5" />
<association property="member" javaType="com.edu.ccut.pojo.Member">
<id column="email" jdbcType="VARCHAR" property="email" />
<id column="id" jdbcType="INTEGER" property="id" />
<result column="screen_name" jdbcType="VARCHAR" property="screenName" />
<result column="truename" jdbcType="VARCHAR" property="truename" />
<result column="cipher" jdbcType="VARCHAR" property="cipher" />
<result column="level" jdbcType="INTEGER" property="level" />
<result column="phone" jdbcType="VARCHAR" property="phone" />
<result column="headimg_large" jdbcType="VARCHAR" property="headimgLarge" />
<result column="headimg_middle" jdbcType="VARCHAR" property="headimgMiddle" />
<result column="state" jdbcType="INTEGER" property="state" />
<result column="motto" jdbcType="VARCHAR" property="motto" />
<result column="sex" jdbcType="INTEGER" property="sex" />
<result column="age" jdbcType="INTEGER" property="age" />
<result column="focusmenum" jdbcType="INTEGER" property="focusmenum" />
<result column="focusothernum" jdbcType="INTEGER" property="focusothernum" />
<result column="website" jdbcType="VARCHAR" property="website" />
<result column="lastip" jdbcType="VARCHAR" property="lastip" />
<result column="createdate" jdbcType="TIMESTAMP" property="createdate" />
<result column="communityid" jdbcType="INTEGER" property="communityid" />
<result column="handletime" jdbcType="TIMESTAMP" property="handletime" />
<result column="validatecode" jdbcType="VARCHAR" property="validatecode" />
<result column="r1" jdbcType="VARCHAR" property="r1" />
<result column="r2" jdbcType="VARCHAR" property="r2" />
<result column="r3" jdbcType="VARCHAR" property="r3" />
<result column="r4" jdbcType="VARCHAR" property="r4" />
<result column="r5" jdbcType="VARCHAR" property="r5" />
</association>
</resultMap>
<resultMap id="BaseResultMap" type="com.edu.ccut.pojo.Messageimg">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Sat Jan 07 10:03:24 CST 2017.
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="memberid" jdbcType="INTEGER" property="memberid" />
<result column="compressimgurl" jdbcType="VARCHAR" property="compressimgurl" />
<result column="sourceimgname" jdbcType="VARCHAR" property="sourceimgname" />
<result column="sourcimgurl" jdbcType="VARCHAR" property="sourcimgurl" />
<result column="saveurl" jdbcType="VARCHAR" property="saveurl" />
<result column="sourcimgwidth" jdbcType="INTEGER" property="sourcimgwidth" />
<result column="sourceimgheight" jdbcType="INTEGER" property="sourceimgheight" />
<result column="circle" jdbcType="VARCHAR" property="circle" />
<result column="imgaddress" jdbcType="VARCHAR" property="imgaddress" />
<result column="addresscode" jdbcType="INTEGER" property="addresscode" />
<result column="content" jdbcType="VARCHAR" property="content" />
<result column="createdate" jdbcType="TIMESTAMP" property="createdate" />
<result column="state" jdbcType="INTEGER" property="state" />
<result column="commentnum" jdbcType="INTEGER" property="commentnum" />
<result column="laudnum" jdbcType="INTEGER" property="laudnum" />
<result column="r1" jdbcType="VARCHAR" property="r1" />
<result column="r2" jdbcType="VARCHAR" property="r2" />
<result column="r3" jdbcType="VARCHAR" property="r3" />
<result column="r4" jdbcType="VARCHAR" property="r4" />
<result column="r5" jdbcType="VARCHAR" property="r5" />
</resultMap>
<!-- 主页信息 -->
<select id="getIndexMessageByPage" resultMap="MessageResultMap">
SELECT * FROM messageimg AS mi,member m where mi.memberid = m.id
</select>
</mapper>
这是MessageimgMapper.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.edu.ccut.dao.MemberMapper">
<resultMap id="BaseResultMap" type="com.edu.ccut.pojo.Member">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Sat Jan 07 10:03:24 CST 2017.
-->
<id column="email" jdbcType="VARCHAR" property="email" />
<id column="id" jdbcType="INTEGER" property="id" />
<result column="screen_name" jdbcType="VARCHAR" property="screenName" />
<result column="truename" jdbcType="VARCHAR" property="truename" />
<result column="cipher" jdbcType="VARCHAR" property="cipher" />
<result column="level" jdbcType="INTEGER" property="level" />
<result column="phone" jdbcType="VARCHAR" property="phone" />
<result column="headimg_large" jdbcType="VARCHAR" property="headimgLarge" />
<result column="headimg_middle" jdbcType="VARCHAR" property="headimgMiddle" />
<result column="state" jdbcType="INTEGER" property="state" />
<result column="motto" jdbcType="VARCHAR" property="motto" />
<result column="sex" jdbcType="INTEGER" property="sex" />
<result column="age" jdbcType="INTEGER" property="age" />
<result column="focusmenum" jdbcType="INTEGER" property="focusmenum" />
<result column="focusothernum" jdbcType="INTEGER" property="focusothernum" />
<result column="website" jdbcType="VARCHAR" property="website" />
<result column="lastip" jdbcType="VARCHAR" property="lastip" />
<result column="createdate" jdbcType="TIMESTAMP" property="createdate" />
<result column="communityid" jdbcType="INTEGER" property="communityid" />
<result column="handletime" jdbcType="TIMESTAMP" property="handletime" />
<result column="validatecode" jdbcType="VARCHAR" property="validatecode" />
<result column="r1" jdbcType="VARCHAR" property="r1" />
<result column="r2" jdbcType="VARCHAR" property="r2" />
<result column="r3" jdbcType="VARCHAR" property="r3" />
<result column="r4" jdbcType="VARCHAR" property="r4" />
<result column="r5" jdbcType="VARCHAR" property="r5" />
<collection property="message" ofType="com.edu.ccut.dao.MessageimgMapper">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="memberid" jdbcType="INTEGER" property="memberid" />
<result column="compressimgurl" jdbcType="VARCHAR" property="compressimgurl" />
<result column="sourceimgname" jdbcType="VARCHAR" property="sourceimgname" />
<result column="sourcimgurl" jdbcType="VARCHAR" property="sourcimgurl" />
<result column="saveurl" jdbcType="VARCHAR" property="saveurl" />
<result column="sourcimgwidth" jdbcType="INTEGER" property="sourcimgwidth" />
<result column="sourceimgheight" jdbcType="INTEGER" property="sourceimgheight" />
<result column="circle" jdbcType="VARCHAR" property="circle" />
<result column="imgaddress" jdbcType="VARCHAR" property="imgaddress" />
<result column="addresscode" jdbcType="INTEGER" property="addresscode" />
<result column="content" jdbcType="VARCHAR" property="content" />
<result column="createdate" jdbcType="TIMESTAMP" property="createdate" />
<result column="state" jdbcType="INTEGER" property="state" />
<result column="commentnum" jdbcType="INTEGER" property="commentnum" />
<result column="laudnum" jdbcType="INTEGER" property="laudnum" />
<result column="r1" jdbcType="VARCHAR" property="r1" />
<result column="r2" jdbcType="VARCHAR" property="r2" />
<result column="r3" jdbcType="VARCHAR" property="r3" />
<result column="r4" jdbcType="VARCHAR" property="r4" />
<result column="r5" jdbcType="VARCHAR" property="r5" />
</collection>
</resultMap>
<sql id="Example_Where_Clause">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Sat Jan 07 10:03:24 CST 2017.
-->
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Sat Jan 07 10:03:24 CST 2017.
-->
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Sat Jan 07 10:03:24 CST 2017.
-->
email, id, screen_name, truename, cipher, level, phone, headimg_large, headimg_middle,
state, motto, sex, age, focusmenum, focusothernum, website, lastip, createdate, communityid,
handletime, validatecode, r1, r2, r3, r4, r5
</sql>
<!-- email登陸 -->
<select id="loginByEmail" parameterType="com.edu.ccut.pojo.Member" resultMap="BaseResultMap">
select * from member as m where m.email = #{email} or m.screen_name=#{email} and m.cipher = #{cipher}
</select>
<select id="getAllMessageByIndex" resultMap="BaseResultMap">
select * from member as m left join messageimg as mi on m.id = mi.memberid
</select>
</mapper>
通过上面的getAllMessageByIndex方法获取member一对多,结果报错
package com.edu.ccut.dao;
import com.edu.ccut.pojo.Messageimg;
import com.edu.ccut.pojo.MessageimgExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface MessageimgMapper {
/**
* This method was generated by MyBatis Generator. This method corresponds to the database table messageimg
* @mbggenerated Sat Jan 07 10:03:24 CST 2017
*/
Integer countByExample(MessageimgExample example);
/**
* This method was generated by MyBatis Generator. This method corresponds to the database table messageimg
* @mbggenerated Sat Jan 07 10:03:24 CST 2017
*/
Integer deleteByExample(MessageimgExample example);
/**
* This method was generated by MyBatis Generator. This method corresponds to the database table messageimg
* @mbggenerated Sat Jan 07 10:03:24 CST 2017
*/
Integer deleteByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator. This method corresponds to the database table messageimg
* @mbggenerated Sat Jan 07 10:03:24 CST 2017
*/
Integer insert(Messageimg record);
/**
* This method was generated by MyBatis Generator. This method corresponds to the database table messageimg
* @mbggenerated Sat Jan 07 10:03:24 CST 2017
*/
Integer insertSelective(Messageimg record);
/**
* This method was generated by MyBatis Generator. This method corresponds to the database table messageimg
* @mbggenerated Sat Jan 07 10:03:24 CST 2017
*/
List<Messageimg> selectByExample(MessageimgExample example);
/**
* This method was generated by MyBatis Generator. This method corresponds to the database table messageimg
* @mbggenerated Sat Jan 07 10:03:24 CST 2017
*/
Messageimg selectByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator. This method corresponds to the database table messageimg
* @mbggenerated Sat Jan 07 10:03:24 CST 2017
*/
Integer updateByExampleSelective(@Param("record") Messageimg record, @Param("example") MessageimgExample example);
/**
* This method was generated by MyBatis Generator. This method corresponds to the database table messageimg
* @mbggenerated Sat Jan 07 10:03:24 CST 2017
*/
Integer updateByExample(@Param("record") Messageimg record, @Param("example") MessageimgExample example);
/**
* This method was generated by MyBatis Generator. This method corresponds to the database table messageimg
* @mbggenerated Sat Jan 07 10:03:24 CST 2017
*/
Integer updateByPrimaryKeySelective(Messageimg record);
/**
* This method was generated by MyBatis Generator. This method corresponds to the database table messageimg
* @mbggenerated Sat Jan 07 10:03:24 CST 2017
*/
Integer updateByPrimaryKey(Messageimg record);
List<Messageimg> getIndexMessageByPage();
}