Ok I'm currently trying mavenise
a project. However my project fails to find the xml
file containing the some beans. combined2.xml
I have it defined as:
public RepeatingGrpPoC() {
appContext = new ClassPathXmlApplicationContext(
new String[] { "src/main/java/resources/combined2.xml",});
c = 0;
}
However for a reason unknown to me I constantly get the error.
Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [src/main/java/resources/combined2.xml]; nested exception is java.io.FileNotFoundException: class path resource [src/main/java/resources/combined2.xml] cannot be opened because it does not exist at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:341) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:212) at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:126) at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:92) at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130) at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:465) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:395) at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139) at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:93) at metadataPoC.RepeatingGrpPoC.(RepeatingGrpPoC.java:34) at metadataPoC.Main.main(Main.java:22) Caused by: java.io.FileNotFoundException: class path resource [src/main/java/resources/combined2.xml] cannot be opened because it does not exist at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:141) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:328) ... 14 more
Where else would the program be looking for this file since I've given it the relative path?
An XML file can be read in R using the function xmlParse() . Then, load data is stored in a list. An XML file can also be read in the form of a data frame by using the xmlToDataFrame() method.
It stands for Extensible Markup Language (XML). Similar to HTML it contains markup tags. But unlike HTML where the markup tag describes structure of the page, in xml the markup tags describe the meaning of the data contained into he file. You can read a xml file in R using the "XML" package.
File formats like csv, xml, xlsx, json, and web data can be imported into the R environment to read the data and perform data analysis, data manipulations and after data analysis data in R can be exported to external files in the same file formats.
It is trying to load this file from the classpath and cannot find it. Try specifying just "combined2.xml"
instead of "src/main/java/resources/combined2.xml"
and make sure that src/main/java/resources is on your classpath.
By the way, in Maven, the standard directory for resources is src/main/resources
, so I suggest you put this file there.
Maven, has standard directory for resources is which is src/main/resources, so if you keep your file here it will take it. and in the path simply give the file name.
For example
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("application-context.xml");
I had the same problem it worked for me
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With