Cannot find class: usertest

标签: mybatis
14人阅读 评论(0) 收藏 举报
org.apache.ibatis.exceptions.PersistenceException: 
### Error building SqlSession.
### The error may exist in com/mybatis_stu/mapper/UserMapper.xml
### Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'usertest'.  Cause: java.lang.ClassNotFoundException: Cannot find class: usertest
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:26)
at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:82)
at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:66)
at com.mybatis_stu.mapper.UserMapperTest.testFindUserById(UserMapperTest.java:26)
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:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'usertest'.  Cause: java.lang.ClassNotFoundException: Cannot find class: usertest
at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:109)
at org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:92)
at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:80)
... 25 more
Caused by: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'usertest'.  Cause: java.lang.ClassNotFoundException: Cannot find class: usertest
at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:120)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:92)
at org.apache.ibatis.builder.xml.XMLConfigBuilder.mapperElement(XMLConfigBuilder.java:322)
at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:107)
... 27 more
Caused by: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'usertest'.  Cause: java.lang.ClassNotFoundException: Cannot find class: usertest
at org.apache.ibatis.builder.BaseBuilder.resolveClass(BaseBuilder.java:103)
at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseStatementNode(XMLStatementBuilder.java:72)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildStatementFromContext(XMLMapperBuilder.java:135)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildStatementFromContext(XMLMapperBuilder.java:128)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:118)
... 30 more
Caused by: org.apache.ibatis.type.TypeException: Could not resolve type alias 'usertest'.  Cause: java.lang.ClassNotFoundException: Cannot find class: usertest
at org.apache.ibatis.type.TypeAliasRegistry.resolveAlias(TypeAliasRegistry.java:117)
at org.apache.ibatis.builder.BaseBuilder.resolveAlias(BaseBuilder.java:130)
at org.apache.ibatis.builder.BaseBuilder.resolveClass(BaseBuilder.java:101)
... 34 more
Caused by: java.lang.ClassNotFoundException: Cannot find class: usertest
at org.apache.ibatis.io.ClassLoaderWrapper.classForName(ClassLoaderWrapper.java:190)
at org.apache.ibatis.io.ClassLoaderWrapper.classForName(ClassLoaderWrapper.java:89)
at org.apache.ibatis.io.Resources.classForName(Resources.java:256)
at org.apache.ibatis.type.TypeAliasRegistry.resolveAlias(TypeAliasRegistry.java:113)

... 36 more



别名写错


查看评论

Mybatis 中 Cannot find class: BaseResultMap问题所在

相应的model对应的mapping中将resultType改成resultMap即可。
  • u010071621
  • u010071621
  • 2017-04-06 20:32:26
  • 4586

cannot find class for bean with name ''

项目重新Checked  start 结果报这个错,  一开始认为是 Service的 Impl 没有用注解  ,后来发现不是这个原因, 原因:Maven Update Projec...
  • singit
  • singit
  • 2015-12-15 11:59:59
  • 2300

Cannot find class for bean with name解决

org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [UserService] for ...
  • jacke121
  • jacke121
  • 2017-07-04 11:33:53
  • 1826

Cannot find the class file for javax.servlet.ServletContext.

当eclipse中新导入的Java Project的时候,往往会碰到各种各样的问题,下面是个典型的问题: Cannot find the class file for javax.servlet...
  • lg831229
  • lg831229
  • 2014-06-22 14:13:35
  • 1529

Cannot find the class file for java.lang.Object”

"The type java.lang.Object cannot be resolved. Cannot find the class file for java.lang.Object”错误,无论...
  • sptoor
  • sptoor
  • 2010-06-05 12:03:00
  • 8307

[testng]Cannot find class in classpath:

org.testng.TestNGException: Cannot find class in classpath: TestNGExample  at org.testng.xml.XmlCla...
  • bk_test
  • bk_test
  • 2015-02-03 15:30:24
  • 6566

java.lang.ClassNotFoundException: Cannot find class: BaseResultMap

出现这种状况,别捉急,直接去相应的model对应的mapping中将resultType改成resultMap即可...
  • ljj821061514
  • ljj821061514
  • 2016-07-15 11:06:53
  • 6410

cannot find class [xxx] for bean with name

产生此错误的原因是缺少项目或Jar的引用;解决办法:找到类对应的项目或是Jar包引用到项目中就可以了。详细错误信息如下:严重: Exception sending context initialize...
  • testcs_dn
  • testcs_dn
  • 2014-12-03 16:58:48
  • 24446

Mybatis提示Cannot find class [org.mybatis.spring.mapper.MapperScannerConfigurer]

Mybatis提示Cannot find class [org.mybatis.spring.mapper.MapperScannerConfigurer]10 如题:mybatis提示如下异常...
  • evilcry2012
  • evilcry2012
  • 2017-04-21 15:33:53
  • 1542

eclipse 解决 Cannot find the class file for java.lang.Object. Fix the build path then try building t

每次打开eclipse 总是会出现   有时候重启一下就好了,让人很不爽的  解决方法: 1  、window  —— show view —— problems 查看问题...
  • x995630736
  • x995630736
  • 2017-07-21 09:41:17
  • 1162
    个人资料
    持之以恒
    等级:
    访问量: 479
    积分: 457
    排名: 11万+
    文章存档
    最新评论