Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.

In XNAT 1.7, we are trying to make it easier for administrators to configure XNAT via the UI rather than having to modify properties files. However, there are some cases in which configuration must be done via properties file. In order to even access the database in which we store the properties for an XNAT instance, the XNAT instance needs to know how to access that database. These database access settings are stored in the file. If there are other properties that you need (or want) to have set before you start configuring XNAT through the UI, these can also be set in properties files.

Setting properties in

In your xnat webapp directory, there should be a file located at WEB-INF/conf/ In the xnat source code, this file is located at src/main/webapp/WEB-INF/conf/ This file should look something like this (with some comments at the top):

Code Block


The datasource properties here should be set to whatever you set them to when installing XNAT. If you used the dafults defaults suggested in the installation instructions, you should not need to modify these. If you used a different database name than XNAT, you should change the datasource.url line like so:

Code Block

You should also change the username and password lines to match the database username and password you used when setting up XNAT. If you set these properties to the values used when creating your empty database, XNAT should correctly populate the database with all the tables you will need when you start Tomcat.

You should not need to modify any of the hibernate properties, but can if you wish. the dialect should be left set to org.hibernate.dialect.PostgreSQL9Dialect because XNAT queries are written for PostgreSQL version 9. You will probably want to leave the property set to update so that the your schemas will update so that your database stays in sync with any code changes. This is especially important when upgrading from an earlier version of XNAT so that the database tables will match what XNAT expects (e.g. adding a column that is new in 1.7), while preserving your existing data. You can also change hibernate.show_sql to true if you want all SQL statements to be logged to the console. Finally, you can set the cache settings to false if you want to disable the second-level cache and query caching. Your application's performance will likely be worse if you set these caching properties to false. 

Setting Other Properties Files

The datasource properties here s

In addition to the database and hibernate properties, there are a large number of preferences that can be set by going to Administer->Site Administration when logged in to XNAT as an administrator. However, you may want to have your XNAT initialized with some of these preferences already set. You can do this by creating a properties file containing the preferences you want to have set. For most preferences, they would need to go in, but preferences regarding email should go in

If you open org/nrg/xdat/preferences/, you can see all the different site config preferences that you can set. At the top of that file is where XNAT will look for the properties file for site config preferences:

Code Block
properties = "META-INF/xnat/preferences/"

You can also look through to see if there are any properties that you would like XNAT to be initiallized with. For example, let's say you want to set what the XNAT archive path is initiallized to. In, you can see that there is a getArchivePath method which gets the archive path preference value by its name, "archivePath":

Code Block
@NrgPreference(defaultValue = "/data/xnat/archive")
public String getArchivePath() { return getValue("archivePath"); }

By default XNAT will be initialized with the defaultValue for this preference, "/data/xnat/archive", but you can have XNAT be initialized with a different archive path by creating a file which contains a line like this:

Code Block
properties = "META-INF/xnat/preferences/"

Deploy XNAT with your custom configuration