title: Why I am not read xml file using FileSystemResource class
body: <p>Problem:</p>
  
  <p>I have created a program that will read my applicationContext.xml file from the specified path using FilesystemResource and call B.Method.
  I am unable to understood why I am getting error like this:</p>
  
  <blockquote>
    <p>Can anyone guide me how to solve this problem:</p>
  </blockquote>
  
  <p>Below is the Code  </p>
  
  <pre><code>public static void main(String[] args) {
      Resource res=null;
      BeanFactory factory=null;
      Object obj=null;
      WishMessageGenerator generator=null;
      //Locate Cfg File
      res=new FileSystemResource("com/jc/cfgs/applicationContext.xml");
      //Create IOC Container      
      factory=new XmlBeanFactory(res);
      //getBean Class Object      
      obj=factory.getBean("wish");
      //TypeCasting       
      generator=(WishMessageGenerator)obj;
      //Invoke Businees Method        
      System.out.println("Message ="+generator.wishMsg("jalaj"));
  
  }
  
  }
  </code></pre>
  
  <p>Error Shown :</p>
  
  <pre><code>Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from file [/Users/mansi/Desktop/springapp/SpringApp4/com/jc/cfgs/applicationContext.xml]; nested exception is java.io.FileNotFoundException: com/jc/cfgs/applicationContext.xml (No such file or directory)
  at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:344)
  at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)
  at org.springframework.beans.factory.xml.XmlBeanFactory.&lt;init&gt;(XmlBeanFactory.java:79)
  at org.springframework.beans.factory.xml.XmlBeanFactory.&lt;init&gt;(XmlBeanFactory.java:67)
  at com.jc.test.Test.main(Test.java:20)
  Caused by: java.io.FileNotFoundException: com/jc/cfgs/applicationContext.xml (No such file or directory)
  at java.io.FileInputStream.open(Native Method)
  at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:138)
  at org.springframework.core.io.FileSystemResource.getInputStream(FileSystemResource.java:115)
  at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:330)
  ... 4 more
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/x5ZB3.png" rel="nofollow noreferrer">DirectoryStructure</a></p>