Line 2 in XML document from class path resource [applicationConfigMoNi.xml] is invalid; nested exce
Exception in thread “main” org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 2 in XML document from class path resource [applicationConfigMoNi.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 8; cvc-elt.1: 找不到元素 ‘beans’ 的声明。
这个错误是applicationConfig.xml 配置文件错误
<?xml version="1.0" encoding="UTF-8"?>
<beans ><bean id="t2" class="com.zhiyou100.IOCAnno.entity.Teacher"><property name="tid" value="11"/><property name="tname" value="李老师"/><property name="tsalary" value="1234"/></bean><bean id="s2" class="com.zhiyou100.IOCAnno.entity.Student"><property name="sid" value="1002"/><property name="sname" value="韩庚"/><property name="sdangYuan" value="false"/><property name="teacher" ref="t2"/></bean>
</beans>
将xml文件中的beans标签中写入标签
如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:p="http://www.springframework.org/schema/p"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-2.0.xsd" ><bean id="t2" class="com.zhiyou100.IOCAnno.entity.Teacher"><property name="tid" value="11"/><property name="tname" value="李老师"/><property name="tsalary" value="1234"/></bean><bean id="s2" class="com.zhiyou100.IOCAnno.entity.Student"><property name="sid" value="1002"/><property name="sname" value="韩庚"/><property name="sdangYuan" value="false"/><property name="teacher" ref="t2"/></bean>
</beans>
这就完成了!
如果你有什么其他的好方法,欢迎留言评论,如果解决了,就点个赞哦!!!
Line 2 in XML document from class path resource [applicationConfigMoNi.xml] is invalid; nested exce相关推荐
- SSM中maven导入jar的报错问题(Line 1 in XML document from class path resource [applicationContext.xml] is ...)
问题描述 org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 1 in XML document f ...
- IOException parsing XML document from class path resource [applicationContent.xml]; nested exception
Spring报错问题: IOException parsing XML document from class path resource [applicationContent.xml]; nest ...
- 报错:IOException parsing XML document from class path resource [applicationContext.xml]; nested except
1.出现IOException parsing XML document from class path resource [applicationContext.xml]; nested excep ...
- IOException parsing XML document from class path resource [xxx.xml]
最近在idea导入项目的时候,加载xml文件失败,后台报了如下异常,xml文件没找到. org.springframework.beans.factory.BeanDefinitionStoreExc ...
- 【已解决】IOException parsing XML document from class path resource [xxx.xml]
报错异常 IOException parsing XML document from class path resource [xxx.xml]; nested exception is java.i ...
- 报错解决:IOException parsing XML document from class path resource [spring-mvc.xml]
今天在创建一个springmvc的项目的时候,我碰到了页面上的报错: IOException parsing XML document from class path resource [spring ...
- parsing XML document from class path resource [applicationContext.xml]…
方法 1.可能是缺失了resource文件: 项目右键--Build Path--Configure Build Path----Java Build Path--source--Add Folder ...
- IOException parsing XML document from class path resource [applicationContext.xml]
今天在学习Spring框架时遇到了错误: 经过报错分析发现是applicationContext.xml文件位置放错了. 在本地测试时,applicationContext.xml文件应该放在src目 ...
- 【Spring5】Spring项目运行时报错:IOException parsing XML document from class path resource [bean.xml]
需要把bean.xml文件放在当前module的src文件夹下,而不能是其他的package下.
最新文章
- [译] 第五天: GruntJS - 为你解决繁琐重复的任务
- 不同视图间的跳转方式
- Razor Page Library:开发独立通用RPL(内嵌wwwroot资源文件夹)
- 创业公司用 Serverless,到底香不香?
- 为什么大学要学一堆纸上谈兵的课程?(转)
- 小笔记,在windows和linux下分开编译、在C\C++下都使用C风格编译
- 系统识别matlab,系统辨识MATLAB
- lisp语言画地物符号_地形图中的地物符号说明
- html2canvas ios 15.0截屏 变黑 页面刷新
- H5API ---(Web存储-拖拽事件-通信-websocket-geolocation)
- PowerVR性能建议-黄金法则
- link和import的区别,src和href的区别,css hark 以及HTML5及css3的新增特性
- 一张关系图助你清晰认识各种O。PO、BO、DTO、VO关系图,够直观
- 电路板PCB夹具设计与测试看法
- Unity 3D 游戏与编程
- java培训包装简历模板
- 利用手机软件fing查询树莓派的ip地址
- Python:NumPy-随机抽样
- Verilog语法和典型电路
- 艾司博讯:拼多多拼单不想要了怎么退