title: Bean scanned into Dispatcher servlet cannot find a file
body: <p>I have a utility.jar that comprises of a bunch of Spring beans under /src/main/java and a startup.json under src/main/resources. </p>
  
  <p>The beans are scanned into a seperate org.springframework.web.servlet.DispatcherServlet context.  Now although the startup.json file is packaged correctly in the JAR, at runtime, I am getting the following exception </p>
  
  <pre><code> java.io.FileNotFoundException: file:/home/webapps/xxx/WEB-INF/lib/utility-1.2.0-SNAPSHOT.jar!/startup.json (No such file or directory)
  </code></pre>
  
  <p>The code that I am using to read the JSON file is </p>
  
  <pre><code>  Resource resource = new ClassPathResource("startup.json");
    try {
      fileReader = new FileReader(resource.getURL().getFile());
    } catch (FileNotFoundException e) {
      logger.error("File not found to create file reader {} ", e);
      return Collections.emptySet();
    }
  </code></pre>
  
  <p>The dispatcher servlet itself is the child context of the root application context of a web application WAR file. Isn't the JAR on the classpath at runtime in case of the web application? </p>