title: java.io.EOFException: No content to map to Object due to end of input
body: <p>I am trying to load file at server(tomcat) deployment time. It is working great in case if i run webapp from eclipse.
  But if i make war and deploy it i get this exception  </p>
  
  <pre><code>java.io.EOFException: No content to map to Object due to end of input
  at org.codehaus.jackson.map.ObjectMapper._initForReading(ObjectMapper.java:2173)
  at org.codehaus.jackson.map.ObjectMapper._readMapAndClose(ObjectMapper.java:2125)
  at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1395)
  at com.vems.util.JSONUtil.jsonToObject(JSONUtil.java:76)
  at com.vems.util.DataUtil.loadData(DataUtil.java:54)
  at com.vems.security.VEMSApplicationObject.loadApplicationSetups(VEMSApplicationObject.java:65)
  at com.vems.security.VEMSApplicationObject.startApplication(VEMSApplicationObject.java:53)
  at com.vems.security.VEMSContextListener.contextInitialized(VEMSContextListener.java:16)
  at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5099)
  at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5615)
  </code></pre>
  
  <p>I tried <code>ClassLoader classLoader = Thread.currentThread().getContextClassLoader();</code></p>
  
  <p>and </p>
  
  <pre><code>`&lt;build&gt;
  &lt;resources&gt;
      &lt;resource&gt;
          &lt;filtering&gt;true&lt;/filtering&gt;
          &lt;directory&gt;src/main/resources&lt;/directory&gt;
      &lt;/resource&gt;
  &lt;/resources&gt;
  </code></pre>
  
  <p>`</p>
  
  <p>and </p>
  
  <pre><code>`InputStream in=ClassLoader.getSystemResourceAsStream("data/budgetSetup.json");
  BufferedReader br = new BufferedReader(new InputStreamReader(in));`
  </code></pre>
  
  <p>But still i am getting same error. Please help me.
  Here is my VEMSApplicationObject.java code where fileName = "data/budgetSetup.json";</p>
  
  <pre><code>`public String readFile(String fileName, boolean resourceFile) {
          try {
              File file;
              if (resourceFile) {
                  ClassLoader classLoader = this.getClass().getClassLoader();
                  file = new File(classLoader.getResource(fileName).getFile());
              } else {
                  file = new File(fileName);
              }
              FileReader fr = new FileReader(file);
              BufferedReader br = new BufferedReader(fr);
              try {
                  StringBuilder sb = new StringBuilder();
                  String line = br.readLine();
  
                  while (line != null) {
                      sb.append(line);
                      line = br.readLine();
                  }
                  return sb.toString();
              } finally {
                  fr.close();
                  br.close();
              }
          } catch (Exception e) {
             System.out.println("Here is The Exception " + e);
          }
          return "";
      }`
  </code></pre>
  
  <p>Here is The Exception java.io.FileNotFoundException: C:\Program%20Files\Apache%20Software%20Foundation\Tomcat%207.0\webapps\VEMS\WEB-INF\classes\data\budgetSetup.json (The system cannot find the path specified)</p>