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相关推荐

  1. 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 ...

  2. IOException parsing XML document from class path resource [applicationContent.xml]; nested exception

    Spring报错问题: IOException parsing XML document from class path resource [applicationContent.xml]; nest ...

  3. 报错: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 ...

  4. IOException parsing XML document from class path resource [xxx.xml]

    最近在idea导入项目的时候,加载xml文件失败,后台报了如下异常,xml文件没找到. org.springframework.beans.factory.BeanDefinitionStoreExc ...

  5. 【已解决】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 ...

  6. 报错解决:IOException parsing XML document from class path resource [spring-mvc.xml]

    今天在创建一个springmvc的项目的时候,我碰到了页面上的报错: IOException parsing XML document from class path resource [spring ...

  7. parsing XML document from class path resource [applicationContext.xml]…

    方法 1.可能是缺失了resource文件: 项目右键--Build Path--Configure Build Path----Java Build Path--source--Add Folder ...

  8. IOException parsing XML document from class path resource [applicationContext.xml]

    今天在学习Spring框架时遇到了错误: 经过报错分析发现是applicationContext.xml文件位置放错了. 在本地测试时,applicationContext.xml文件应该放在src目 ...

  9. 【Spring5】Spring项目运行时报错:IOException parsing XML document from class path resource [bean.xml]

    需要把bean.xml文件放在当前module的src文件夹下,而不能是其他的package下.

最新文章

  1. [译] 第五天: GruntJS - 为你解决繁琐重复的任务
  2. 不同视图间的跳转方式
  3. Razor Page Library:开发独立通用RPL(内嵌wwwroot资源文件夹)
  4. 创业公司用 Serverless,到底香不香?
  5. 为什么大学要学一堆纸上谈兵的课程?(转)
  6. 小笔记,在windows和linux下分开编译、在C\C++下都使用C风格编译
  7. 系统识别matlab,系统辨识MATLAB
  8. lisp语言画地物符号_地形图中的地物符号说明
  9. html2canvas ios 15.0截屏 变黑 页面刷新
  10. H5API ---(Web存储-拖拽事件-通信-websocket-geolocation)
  11. PowerVR性能建议-黄金法则
  12. link和import的区别,src和href的区别,css hark 以及HTML5及css3的新增特性
  13. 一张关系图助你清晰认识各种O。PO、BO、DTO、VO关系图,够直观
  14. 电路板PCB夹具设计与测试看法
  15. Unity 3D 游戏与编程
  16. java培训包装简历模板
  17. 利用手机软件fing查询树莓派的ip地址
  18. Python:NumPy-随机抽样
  19. Verilog语法和典型电路
  20. 艾司博讯:拼多多拼单不想要了怎么退

热门文章

  1. 2019计算机一级考试题库及答案,2019年全国计算机一级考试题库及答案
  2. Xshell评估期已过
  3. oracle安装盘符文件,oracle安装与卸载修改盘符是什么?
  4. R数据分析:交叉滞后模型基础与实例解析
  5. 多重采样和超级采样哪个流畅_蒙特卡洛方法-多重采样
  6. javaEE初阶---HTTP
  7. python xgboost输出变量重要性_xgboost输出特征重要性排名和权重值
  8. 淘淘商城总结-后台管理
  9. Linux 守门员:防火墙iptables
  10. 关于家里两个路由器进行级联时配置