配置Mybatis配置文件时,出现错误:在UserMapper.xml头文件出现 "Referenced file contains errors(file:/D:/config/mybatis-3-mapper.dtd). For more information, right click on the message in the Problems View and select "Show Details..." 的问题????
对于这个问题,出现问题的mapper.xml文件的头文件是
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://www.mybatis.org/dtd/mybatis-3-mapper.dtd">
图片一
解决方法是:可能是由于我自己使用的Mybatis的config配置文件—— mybatis-3-mapper.dtd文件版本较低,当我更换一个高版本的mybatis-3-mapper.dtd文件后,在Eclipse中重新加载mybatis-3-mapper.dtd文件,在通过"Project ---> clear"项目后,错误消失,问题得以解决。
第一种:
在本地磁盘中将高版本的mybatis-3-mapper.dtd放到固定的位置后,在Eclipse中重新加载mybatis-3-mapper.dtd文件。
第二种:
清除项目trbac03项目的缓存。
//========mybatis-3-config.dtd头文件出错========
mybatis的配置文件报错
The errors below were detected when validating the file "mybatis-3-config.dtd" via the file "mybatis-config.xml". In most cases these errors can be detected by validating "mybatis-3-config.dtd" directly. However it is possible that errors will only occur when mybatis-3-config.dtd is validated in the context of mybatis-config.xml.
配置
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
将
"http://mybatis.org/dtd/mybatis-3-config.dtd">
修改为
"http://www.mybatis.org/dtd/mybatis-3-config.dtd">