title: OWASP ESAPI can't find my ESAPI.properties file although it exists in directory
body: <p>I have problems configuring ESAPI to let it work with my Spring Boot Web Application (maven project).</p>
  
  <p>I'm using this URL for help : <a href="https://web.archive.org/web/20161005210258/http://code.google.com/p/owasp-esapi-java/source/browse/trunk/src/main/java/org/owasp/esapi/reference/DefaultSecurityConfiguration.java" rel="nofollow noreferrer">https://web.archive.org/web/20161005210258/http://code.google.com/p/owasp-esapi-java/source/browse/trunk/src/main/java/org/owasp/esapi/reference/DefaultSecurityConfiguration.java</a></p>
  
  <p>And from this URL I have chosen this part to put ESAPI.properties in a specific directory : </p>
  
  <blockquote>
    <p>The reference {@code SecurityConfiguration} manages all the settings used by the ESAPI in a single place. In this reference
     * implementation, resources can be put in several locations, which are searched in the following order:
     * <p>
     * 1) Inside a directory set with a call to SecurityConfiguration.setResourceDirectory( "C:\temp\resources" ).
     * <p></p>
  </blockquote>
  
  <p>So for that here is my code : </p>
  
  <p>1 - In <strong>application.properties</strong> :</p>
  
  <p>esapi.path=/data/folder/testApp/Apps/MyApp/ESAPIConf</p>
  
  <p>2 - In <strong>StartupApplication.java</strong> (class that will be executed only once at the startup of my application) :</p>
  
  <pre><code>@Component
  public class StartupApplication implements InitializingBean {
  
      @Autowired
      private Environment env;
  
  
      @Override
      @Transactional
      public void afterPropertiesSet() throws Exception {
  
          new GlobalVars();
  
          GlobalVars.esapiPropertyFilePath = env.getProperty("esapi.path");
          // this setResourceDirectory to be executed once
          ESAPI.securityConfiguration().setResourceDirectory(GlobalVars.esapiPropertyFilePath);
  
  ...etc
  
  }
  </code></pre>
  
  <p>3 - In my <strong>jsp page</strong> :</p>
  
  <pre><code>&lt;form action="#" method="POST" onsubmit="linkVariabletoDBFields()"&gt;
  
  &lt;input type="hidden" name = "nameconf" id="nameconf" value="&lt;%=ESAPI.encoder().encodeForHTMLAttribute(request.getParameter("confname")) %&gt;" /&gt;
  </code></pre>
  
  <p><strong>The Problem :</strong></p>
  
  <p>When the application server (JBOSS EAP 7.2) is starting and more specifically when StartupApplication class is executed the <strong>setResourceDirectory</strong> is returning : </p>
  
  <pre><code>ESAPI: Reset resource directory to: /data/folder/testApp/Apps/MyApp/ESAPIConf
  ESAPI: Attempting to load ESAPI.properties via file I/O.
  ESAPI: Attempting to load ESAPI.properties as resource file via file I/O.
  ESAPI: Not found in 'org.owasp.esapi.resources' directory or file not readable: /home/linuxuser/ESAPI.properties
  ESAPI: Not found in SystemResource Directory/resourceDirectory: /data/folder/testApp/Apps/MyApp/ESAPIConf/ESAPI.properties
  ESAPI: Not found in 'user.home' (/home/linuxuser) directory: /home/linuxuser/esapi/ESAPI.properties
  ESAPI: Loading ESAPI.properties via file I/O failed. Exception was: java.io.FileNotFoundException
  ESAPI: Attempting to load ESAPI.properties via the classpath.
  ESAPI: SUCCESSFULLY LOADED ESAPI.properties via the CLASSPATH from '/ (root)' using current thread context class loader!
  ESAPI: SecurityConfiguration for Validator.ConfigurationFile.MultiValued not found in ESAPI.properties. Using default: false
  ESAPI: Attempting to load validation.properties via file I/O.
  ESAPI: Attempting to load validation.properties as resource file via file I/O.
  ESAPI: Not found in 'org.owasp.esapi.resources' directory or file not readable: /home/linuxuser/validation.properties
  ESAPI: Not found in SystemResource Directory/resourceDirectory: /data/folder/testApp/Apps/MyApp/ESAPIConf/validation.properties
  ESAPI: Not found in 'user.home' (/home/linuxuser) directory: /home/linuxuser/esapi/validation.properties
  ESAPI: Loading validation.properties via file I/O failed.
  ESAPI: Attempting to load validation.properties via the classpath.
  ESAPI: SUCCESSFULLY LOADED validation.properties via the CLASSPATH from 'esapi/' using current thread context class loader!
  </code></pre>
  
  <p>It cannot find the properties file although the file exists in <strong>/data/folder/testApp/Apps/MyApp/ESAPIConf</strong></p>
  
  <p>And when I access my jsp page I'm getting : </p>
  
  <pre><code>Error :  org.owasp.esapi.errors.ConfigurationException: java.lang.reflect.InvocationTargetException Encoder class (org.owasp.esapi.reference.DefaultEncoder) CTOR threw exception.
  </code></pre>
  
  <p>I guess because the ESAPI.properties was not found.</p>
  
  <p>Kindly help.</p>