首页 > 编程语言 >java.io.FileNotFoundException: class path resource [bean.xml] cannot be opened because it does not e

java.io.FileNotFoundException: class path resource [bean.xml] cannot be opened because it does not e

时间:2023-05-08 11:24:52浏览次数:50  
标签:xml because java support loadBeanDefinitions springframework org resource

出现这个报错

Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [bean.xml]; nested exception is java.io.FileNotFoundException: class path resource [bean.xml] cannot be opened because it does not exist
	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188)
	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:224)
	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:195)
	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:257)
	at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:128)
	at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:94)
	at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)
	at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:638)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:523)
	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:144)
	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:85)
	at Mytset.main(Mytset.java:7)
Caused by: java.io.FileNotFoundException: class path resource [bean.xml] cannot be opened because it does not exist
	at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:180)
	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:333)
	... 13 more

原因:测试类书写时,ClassPathXmlApplicationContext的文件名不匹配

调整一下就好了

标签:xml,because,java,support,loadBeanDefinitions,springframework,org,resource
From: https://www.cnblogs.com/yzx-sir/p/17381179.html

相关文章

  • 真的!@Autowired和@Resource注解使用的正确姿势,别再用错的了!
    介绍今天使用Idea写代码的时候,看到之前的项目中显示有warning的提示,去看了下,是如下代码?@AutowiredprivateJdbcTemplatejdbcTemplate;提示的警告信息FieldinjectionisnotrecommendedInspectioninfo:SpringTeamrecommends:"Alwaysuseconstructorbaseddependencyin......
  • Python wordpress-xmlrpc错误:xml.parsers.expat.ExpatError: XML or text declaration
    解决方法:修改打开client.py文件原代码:deffeed(self,data):self._parser.Parse(data,0)改成如下的代码:deffeed(self,data):self._parser.Parse(data.strip(),0)......
  • 微信小程序在wxml里不支持includes,indexOf,findIndex等方法
    小程序的wxml文件内不支持数组的includes,indexOf,findIndex等方法。不是垃圾是什么?玩什么标新立异?不会搞就别TM搞。 开发者:我想上二楼。WX:这里有一坨屎,吃子它,就让你上二楼。开发者:@#$%&@^$*^&*&^$%$^ 咋做?在任意目录创建一个.wxs文件,里面写上如下代码:文件-/utils/wuti......
  • python3 xml.etree.ElementTree.ElementTree
    1、介绍对应整个xml结构。2、初始化classElementTree:def__init__(self,element=None,file=None):self._root=element#firstnodeiffile:self.parse(file)element,ElementTree.Element类型,即设置一个节点对象作为根节点file,str......
  • python3 xml etree使用
    1、创建xml(1)通过ElementTree.ElementTree类创建,并设置一个ElementTree.Element对象作为参数,该参数对象作为根节点(2)通过ElementTree.Element创建一个或多个节点,为这些节点设置tag、attrib、text和tail(3)这些节点通过父节点的append方法添加,管理关系。ElementTree.ElementTr......
  • python3 xml tree
    Python3XML解析|菜鸟教程(runoob.com)Python标准库之xml.etree-Awakenedy-博客园(cnblogs.com)1、介绍通过python3自带的xml.etree.ElementTree模块可以实现对xml的操作。XML是一种固有的分层数据格式,也是用一棵树来表示它。为此,本模块分为两个类:ElementTree将......
  • 无法加载响应数据: No data found for resource with given identifier
    环境Ubuntu22.04IDEADocker中使用nginx问题描述之前使用正常,今天打开前端报错,postman测试正常解决由于nginx在docker中使用,upstream不能使用127.0.0.1,需要使用本机ip,而本机ip是会变的。需要更改新的本机ip......
  • WEB|[NCTF2019]True XML cookbook
    题目提示XML,直接抓包注入XML<?xmlversion="1.0"?><!DOCTYPElkj[<!ENTITYadminSYSTEM"file:///flag">]><user> <username>&admin;</username> <password>1</password></user>读取失败修改......
  • web开发总结----xml的写入、读取---2
    publicclassDOM4JTest{/***//***//***//***//***//***//***//***DOM4J读写XML示例**@paramargs*@throwsException*/publicstaticvoidmain(String[]args){try{XMLWriter......
  • XmlNamespaceManager与XmlDocument.NameTable浅述
    XmlDocumentdoc=newXmlDocument();doc.LoadXml(xml);XmlNamespaceManagernsmgr=newXmlNamespaceManager(doc.NameTable);nsmgr.AddNamespace("ns","http://WebXml.com.cn/");varnodes=doc.SelectNodes("//ns:string",nsmgr);......