ClassPathResource.getInputStream() has thrown a FileNotFoundException

java.io.FileNotFoundException
at org.springframework.core.io.ClassPathResource.getInputStream

Typical Exception Messages

  1. class path resource [applicationContext.xml] cannot be opened because it does not exist
  2. class path resource [Beans.xml] cannot be opened because it does not exist
  3. class path resource [beans.xml] cannot be opened because it does not exist
  4. class path resource [org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.class] cannot be opened because it does not exist
  5. class path resource [spring-servlet.xml] cannot be opened because it does not exist
  6. class path resource [application.properties] cannot be opened because it does not exist
  7. class path resource [WEB-INF/applicationContext.xml] cannot be opened because it does not exist
  8. class path resource [META-INF/cxf/cxf.xml] cannot be opened because it does not exist
  9. class path resource [cas.properties] cannot be opened because it does not exist
  10. class path resource [test/test/applicationContext.xml] cannot be opened because it does not exist

Specific cases

Solution

chinthana, 5 months ago

Use this method to gain access to the ApplicationContext:

@Autowired
private ApplicationContext applicationContext;

Check the source of this solution for more info

External results for this pattern (447)

  1. Exeyvia GitHub21 hours ago
    class path resource [org/menacheri/zombie/game/ZombieSpringConfig.class] cannot be opened because it does not exist
    Show stack trace
  2. class path resource [applicationContext.xml] cannot be opened because it does not exist
    Show stack trace
  3. dennislaumenvia GitHub21 hours ago
    class path resource [META-INF/cxf/cxf-servlet.xml] cannot be opened because it does not exist
    Show stack trace
  4. tabbyvia Stack Overflow23 hours ago
    class path resource [WEB-INF/spring-security.xml] cannot be opened because it does not exist
    Show stack trace
  5. Unknown authorvia javatpoint.com1 day ago
    class path resource [my.xml] cannot be opened because it does not exist
    Show stack trace
  6. Unknown authorvia iteye.com1 day ago
    class path resource [ehcache-application.xml] cannot be opened because it does not exist
    Show stack trace
  7. Joevia Stack Overflow1 day ago
    class path resource [META-INF/cxf/cxf-extension-soap.xml] cannot be opened because it does not exist
    Show stack trace
  8. Unknown authorvia issuehub.io1 day ago
    class path resource [comcompanysales/web-spring.xml] cannot be opened because it does not exist
    Show stack trace
  9. Unknown authorvia csdn.net1 day ago
    class path resource [applicationContext.xml] cannot be opened because it does not exist
    Show stack trace
  10. Rabe, Jensvia karaf-user1 day ago
    class path resource [org/springframework/boot/autoconfigure/EnableAutoConfigurationImportSelector.class] cannot be opened because it does not exist
    Show stack trace