Error
Solution
It is trying to load this file from the classpath and cannot find it. Try specifying just "user.xml" instead of "src/main/java/resources/user.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 to put this file there.
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.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
at metadataPoC.RepeatingGrpPoC.<init>(RepeatingGrpPoC.java:34)
at metadataPoC.Main.main(Main.java:22)
Solution
It is trying to load this file from the classpath and cannot find it. Try specifying just "user.xml" instead of "src/main/java/resources/user.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 to put this file there.
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("user.xml");
Comments
Post a Comment