org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from relative location [spring-dao.xml]
Offending resource: class path resource [applicationContext.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [spring-dao.xml]; nested exception is com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: 1 字节的 UTF-8 序列的字节 1 无效。
错误原因
在xml中添加了中文注释
<!--1.扫描service下的包--> <contex:component-scan base-package="com.jie.service"/>
解决办法;
把xml中的UTF-8改为UTF8
<?xml version="1.0" encoding="UTF8"?>
参考连接:https://blog.youkuaiyun.com/qq_45800640/article/details/116853891
该博客详细记录了一种常见的Spring配置错误,即在XML配置文件中使用中文注释导致的BeanDefinitionParsingException。错误信息提示无法从相对路径导入bean定义,具体为在解析spring-dao.xml时遇到了MalformedByteSequenceException。解决方案是将XML文件的编码从UTF-8更改为UTF8,以确保XML文档正确解析。
609

被折叠的 条评论
为什么被折叠?



