mybatis入门常见错误

1.Exception in thread "main" java.io.IOException: Could not find resource config2.xml

需要去Reader reader=Resources.getResourceAsReader("config2.xml");代码处看下,是否和src下面的配置文件名称一样,如果不一样,泽会报没有发现资源文件的错误;

2.White spaces are required after keyword PUBLIC in DOCTYPE decl,原因是    "http://mybatis.org/dtd/mybatis-3-config.dtd">,public后面应该加空格;

3.Element type "enviroments" must be declared.或Element type "enviroment" must be declared.,Attribute "resourse" must be declared for element type "mapper".等type需要定义的错误,则是标签出问题了,需要检查xml配置文件;

4.The content of element type "transactionManager" must match "(property)*".,错误是,标签用完就结束,不要包含property.

5.Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'Dept'.  Cause: java.lang.ClassNotFoundException: Cannot find class: Dept,,原因是