RSS Feed for This PostCurrent Article

Java: Understanding File Check Sequence in Apache Commons Configuration

Well, this is something minor but which actually caused me some time to find out the root cause.

From Apache Commons Configuration documentation, it says for file-based configurations it will perform the following checks (in this order):

  • If the combination from base path and file name is a full URL that points to an existing file, this URL will be used to load the file.
  • If the combination from base path and file name is an absolute file name and this file exists, it will be loaded.
  • If the combination from base path and file name is a relative file path that points to an existing file, this file will be loaded.
  • If a file with the specified name exists in the user’s home directory, this file will be loaded.
  • Otherwise the file name is interpreted as a resource name, and it is checked whether the data file can be loaded from the classpath.

If all these checks fail, a ConfigurationException will be thrown.

My configuration file is in the CLASSPATH, but someone put an old configuration file in the user home directory. So the application keeps on starting with the old configuration.


Trackback URL


Sorry, comments for this entry are closed at this time.