[org.mybatis.spring.SqlSessionFactoryBean]-Property 'mapperLocations' was specified but matching resources are not found. 21:42:18.572 [RMI TCP Connection(4)-127.0.0.1] ERROR org.mybatis.spring.mapper.MapperFactoryBean - Error while adding the mapper 'interface com.mycom.dao.StudentMapper' to configuration. org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'com/mycom/dao/StudentMapper.xml'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'com.mycom.domain.Student'. Cause: java.lang.ClassNotFoundException: Cannot find class: com.mycom.domain.Student
时间: 2023-10-08 08:07:47 浏览: 337
这个错误信息是MyBatis在解析Mapper XML文件时出现的问题。
首先,这个错误提示了两个问题。第一个问题是在指定的mapperLocations下找不到匹配的Mapper XML文件,这个问题可能和我之前提到的原因类似,需要检查路径、文件名和文件是否存在。第二个问题是在解析Mapper XML文件时,发现无法解析一个类的别名(Type Alias),原因是找不到这个类,这个问题可能和类的导入有关。
根据错误信息中提供的信息来看,可能存在以下几个原因:
1. StudentMapper.xml文件不存在或者路径不正确。需要检查mapperLocations中的路径是否正确,是否遗漏了文件夹或文件名。
2. StudentMapper.xml文件中定义的类别名(com.mycom.domain.Student)不存在或者路径不正确。需要检查这个类的路径是否正确,以及是否导入了这个类。
3. 如果以上两个问题都排查了还是不行,可以尝试重启应用程序或者重新生成Mapper XML文件。
阅读全文
相关推荐


















