Powered by Blogger.

class path resource [beans.xml] cannot be opened because it does not exist

>> Wednesday, August 25, 2021


 

ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");


Caused by: java.io.FileNotFoundException: class path resource [beans.xml] cannot be opened because it does not exist

at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:187)

at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:333)

... 13 more



Solution:
There are two solutions

1. Take the beans.xml out of package and put in default package.
2. Specify package name of the file..
    ClassPathXmlApplicationContext("com/se/io/beans.xml");

 






Related Posts Plugin for WordPress, Blogger...
© javabynataraj.blogspot.com from 2009 - 2022. All rights reserved.