title: Java EE EAR shared location of read/write resources within clustered environment
body: <p>Within a Java EE environment (happens to be WAS 6.1 but could be any application server) I need to place a XML file, which is a configuration file, so that I can read and write to it.  </p>
  
  <p>This needs to be available in a clustered environment so I am looking at using the class path to load the file. </p>
  
  <p>I am thinking I can store this file in the EAR root, reference it in the manifest and then load and save it. </p>
  
  <p>I have tried this approach by having my file in a JAR and making this available via the MANIFES and I can load the config file from the class path no problem using the following. </p>
  
  <pre><code>this.getClass().getClassLoader().getResourceAsStream("configFileName");
  </code></pre>
  
  <p>That loads the file that is in the JAR, which is fantastic.  But if I want to edit this file, programmatically, I cannot access the JAR files location (the EAR root) it returns me an interpreted path like this:</p>
  
  <pre><code> /usr/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/localhostNode01Cell/MyApp.ear/MyApp.war/TB_config.jar
  </code></pre>
  
  <p>That is not the correct location of the JAR the correct location is at MyApp.ear.</p>
  
  <p><strong>So the question is:</strong> how can I access and update (copy contents, create new, save, delete old) the JAR with my config file.<br>
  Or should I put the config file somewhere else? </p>
  
  <p>What is the standard Java EE to make files that need read/write access available to WARs on a cluster?</p>