*关于错误:org.apache.ibatis.datasource.DataSourceException: Unknown DataSource property: name

今天在测试mybatis时,出现了点问题。我把它总结了下来

错误提示:
log4j:WARN No appenders could be found for logger (org.apache.ibatis.logging.LogFactory).
log4j:WARN Please initialize the log4j system properly.
Exception in thread “main” org.apache.ibatis.exceptions.PersistenceException:

Error building SqlSession.

The error may exist in SQL Mapper Configuration

Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause:

org.apache.ibatis.datasource.DataSourceException: Unknown DataSource property: name
Type interface com.atguigu.mybatis.test.EmployeeMapper is not known to the MapperRegistry.

分析原因:
因为一开始使用了properties文件来连接数据库,用户名的键设成name,我在mybatis.xml里是这样写的

mybatis在这一块的非常严谨,要严格按照格式进行写即可避免这个错误
*关于错误:org.apache.ibatis.datasource.DataSourceException: Unknown DataSource property: name_第1张图片

---------------------*

你可能感兴趣的:(mybatis框架)