请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

运行junit错误

老师,请问这个问题怎么解决。
18:49:26.612 [main] WARN org.springframework.context.support.GenericApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sqlSessionFactory’ defined in class path resource [spring/spring-dao.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: ‘file[E:\JAVA\JavaWorkspace2020\o2o\target\classes\mapper\AreaDao.xml]’; nested exception is org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 47; 文档根元素 “mapper” 必须匹配 DOCTYPE 根 “null”。

18:49:26.621 [main] ERROR org.springframework.test.context.TestContextManager - Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@5383967b] to prepare test instance [com.imooc.o2o.dao.AreaDaoTest@5c5a1b69]
java.lang.IllegalStateException: Failed to load ApplicationContext

正在回答

2回答

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
    PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
    "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.imooc.o2o.dao.AreaDao">
	<select id="queryArea" resultType="com.imooc.o2o.entity.Area">
		SELECT area_id, area_name,
		priority, create_time, last_edit_time
		FROM tb_area
		ORDER BY priority
		DESC
	</select>
</mapper>


0 回复 有任何疑惑可以回复我~
  • 提问者 庄离子 #1
    非常感谢!
    回复 有任何疑惑可以回复我~ 2020-04-03 11:00:27
慕慕65597133 2020-04-02 22:40:20

应该是你的mapper的标签被别的标签包裹了,或者没有闭合

1 回复 有任何疑惑可以回复我~
  • 翔仔 #1
    确实是这样的,可以按照大神说的来看看,说的是第二行第47列有语法错误,导致AreaDao.xml解析失败
    回复 有任何疑惑可以回复我~ 2020-04-03 01:35:40
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号