老师这个报错是咋回事啊

老师这个报错是咋回事啊

java.lang.ExceptionInInitializerError

at mybatis.mapperTest.mapperTest6(mapperTest.java:65)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)

at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)

at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)

at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)

at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)

at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)

at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)

at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)

at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)

at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)

at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)

at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)

at org.junit.runners.ParentRunner.run(ParentRunner.java:363)

at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89)

at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:541)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209)

Caused by: org.apache.ibatis.exceptions.PersistenceException: 

### Error building SqlSession.

### The error may exist in Mapper/usermapp.xml

### The error occurred while processing mapper_resultMap[Many]

### Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'Mapper/usermapp.xml'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'userdao'.  Cause: java.lang.ClassNotFoundException: Cannot find class: userdao

at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)

at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:52)

at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:36)

at com.siki.util.mybatisUtil.<clinit>(mybatisUtil.java:19)

... 24 more

Caused by: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'Mapper/usermapp.xml'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'userdao'.  Cause: java.lang.ClassNotFoundException: Cannot find class: userdao

at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:121)

at org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:98)

at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:50)

... 26 more

Caused by: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'Mapper/usermapp.xml'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'userdao'.  Cause: java.lang.ClassNotFoundException: Cannot find class: userdao

at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:122)

at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:94)

at org.apache.ibatis.builder.xml.XMLConfigBuilder.mapperElement(XMLConfigBuilder.java:373)

at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:119)

... 28 more

Caused by: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'userdao'.  Cause: java.lang.ClassNotFoundException: Cannot find class: userdao

at org.apache.ibatis.builder.BaseBuilder.resolveClass(BaseBuilder.java:118)

at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseStatementNode(XMLStatementBuilder.java:102)

at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildStatementFromContext(XMLMapperBuilder.java:137)

at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildStatementFromContext(XMLMapperBuilder.java:130)

at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:120)

... 31 more

Caused by: org.apache.ibatis.type.TypeException: Could not resolve type alias 'userdao'.  Cause: java.lang.ClassNotFoundException: Cannot find class: userdao

at org.apache.ibatis.type.TypeAliasRegistry.resolveAlias(TypeAliasRegistry.java:120)

at org.apache.ibatis.builder.BaseBuilder.resolveAlias(BaseBuilder.java:149)

at org.apache.ibatis.builder.BaseBuilder.resolveClass(BaseBuilder.java:116)

... 35 more

Caused by: java.lang.ClassNotFoundException: Cannot find class: userdao

at org.apache.ibatis.io.ClassLoaderWrapper.classForName(ClassLoaderWrapper.java:200)

at org.apache.ibatis.io.ClassLoaderWrapper.classForName(ClassLoaderWrapper.java:89)

at org.apache.ibatis.io.Resources.classForName(Resources.java:261)

at org.apache.ibatis.type.TypeAliasRegistry.resolveAlias(TypeAliasRegistry.java:116)

... 37 more


  </select>

    <!-- 多表关联查询 -->

    <resultMap type="com.siki.dao.UserDao" id="Many">

          <id property="uId" column=""/>

    </resultMap>

    <select id="selectManySql" resultMap="Many">

          select u.*,c.*from user u,country c

          where u.u_cid=c.c_id;

    </select>  

    <!-- 插入数据的操作 -->

    <insert id="insertByDao" parameterType="com.siki.dao.UserDao">

          insert into user values(null,#{uUserName},#{uPassWord},#{sex},#{dataTime},#{uCid})

          <selectKey resultType="Integer" keyProperty="uId" keyColumn="AFTER">

                 select last_insert_id()

          </selectKey>

    </insert>

    <!-- 修改数据的操作 -->

    <update id="updatebyuser" parameterType="com.siki.dao.UserDao">

         update user 

         set

           u_username = #{uUserName},

           u_password = #{uPassWord},

           u_sex = #{sex},

           u_createTime = #{dataTime},

           u_cid=#{uCid}

         where

           u_id=#{uId}

    </update>

    <!-- 删除数据的操作 -->

    <delete id="deletebysql" parameterType="com.siki.dao.UserDao">

         delete from user where u_id=#{uId}

    </delete>

    <!-- 输入映射的查询数据库中的单条信息 -->

    <select id="OneSelectByDto" parameterType="userdto" resultType="userdao">

         select *from user where u_id=#{userdao.uId}

    </select>

</mapper>

正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

2回答
好帮手慕柯南 2020-02-05 14:14:52

同学你好!

这里是返回多条记录,应该是resultMap

http://img1.sycdn.imooc.com//climg/5e3a5d14094f5e9d08880150.jpg

如果我的回答解决了你的疑惑,请采纳,祝学习愉快~

好帮手慕柯南 2020-02-05 10:27:01

同学你好!

这些地方都应该写实体类,你写成dao了,建议你修改测试一下

http://img1.sycdn.imooc.com//climg/5e3a27dc09a2c38c09360504.jpg

如果我的回答解决了你的疑惑,请采纳,祝学习愉快~

  • 提问者 qq_慕莱坞4316410 #1
    老师,UserDao放的数据就是user用户的实体类属性啊,还是会有这个错误啊5555~
    2020-02-05 14:08:51
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师