title: Java WebApp and tomcat context.xml
body: <p>I build webApp . When I run app from Eclipse everything work OK.  Now I build WAR file, put in tomcat root, andI want to all my system property put in context.xml in tomcat. Then, when app is start, that values from context.xml is read and use in app.
  Problem is I don't know how to get values from context.xml in my webapp? 
  This is context:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Context path="" docBase="fileupload.war" privileged="true"    antiResourceLocking="false" antiJARLocking="false"&gt;
      &lt;Resource 
          mail.smtp_server = "127.0.0.1"
          mail.smtp_username = "no-reply@gmail.rs"
          mail.mailTo = "test@gmail.com"
          rootFolder = "D:/project/"
          rootFolderBackup = "D:/project/Backup/"
       /&gt;
  </code></pre>
  
  <p></p>
  
  <p>Here I want to get a values from context.xml : </p>
  
  <pre><code>@RequestMapping(value="api/files")
  public class FileController {
  
  final static Logger logger = Logger.getLogger(FileController.class);
  @Autowired
  ApplicationContext applicationContext;
  
  private String mailTo;
  private String sender;
  private String rootFolder = "";
  private String rootFolderBackup = "";   
  
  @PostConstruct
  private void init(){
  
          try {
              InitialContext ic = new InitialContext();
              Context xmlContext = (Context) ic.lookup("java:comp/env"); // thats everything from the context.xml and from the global configuration
              DataSource myDatasource = (DataSource) xmlContext.lookup("rootFolder");
          } catch (NamingException e1) {
              // TODO Auto-generated catch block
              e1.printStackTrace();
          }
  
  }
  </code></pre>
  
  <p>This is common error :</p>
  
  <pre><code>Name [rootFolder] is not bound in this Context. Unable to find [rootFolder].
  </code></pre>
  
  <p>I try few solution which I found on web but not working...
  My context.xml file is in <code>C:\tomcat-7.0\conf\Catalina\localhost</code> , and war file is in <code>C:\tomcat-7.0\webapps</code></p>