title: Facing FileNotFoundException while accessing JSON File in classpath using java in docker containers(SprintBootApplication)
body: <p>I'm Facing a FileNotFoundException while loading a JSON file which is in class path of Java jar using docker containers, it is a Spring-Boot application. This JSON file is available in resource folder . I'm Able to see the JSON file in docker under ./target/classes/ path.</p>
  
  <pre><code>Resource resource = resourceLoader.getResource("classpath:folderNm/file.json");
  HashMap&lt;String, String&gt; headerMapping = (HashMap&lt;String, String&gt;) parser.parse(new FileReader(resource.getFile().getAbsolutePath()));
  </code></pre>
  
  <p>But I get this exception:</p>
  
  <pre><code>java.io.FileNotFoundException: class path resource [folderNm/file.json] cannot be resolved to absolute file path because it does not reside in the file system: jar:file:/app.jar!/folderNm/file.json
  </code></pre>
  
  <p>I tried</p>
  
  <p>-> <code>resource.getFile().getPath();</code>
  -> <code>resource.getFile().getCanonicalPath();</code>
  -> "<code>./target/classes/folderName/fileName</code>" (hardcoded FilePath location)
  -> "<code>/app.jar!/folderNm/file.json</code>" (hardcoded FilePath location)</p>
  
  <pre><code>InputStream inputStream = getClass().getResourceAsStream("xyz.json");
  BufferedReader br = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"));
              StringBuilder responseStrBuilder = new StringBuilder();
              String inputStr;
              while ((inputStr = br.readLine()) != null)
                  responseStrBuilder.append(inputStr);
  </code></pre>
  
  <p>none of the way above are running. Kindly Suggest a way to resolve this issue.</p>