Page tree
Skip to end of metadata
Go to start of metadata

Goal

It's time to get XNAT ready for initialization and configuration. To do this, you need to start the Tomcat service, which in turn loads XNAT into the application server process.

You have only a couple more steps to get XNAT up and running:

  • Create the base XNAT configuration file
  • Start Tomcat

Create the base XNAT configuration file

When you set the value for xnat.home in the Tomcat configuration file, you told XNAT where to go to find its basic system configuration. Most of the configuration for XNAT 1.7 is stored in the database, but the configuration for accessing the database can't be stored in the database. For this, XNAT looks in the xnat.home folder for the subfolder config and the file xnat-conf.properties. We will create this file now.

$ cd ~/config
xnat@xnat-11:~/config$ nano xnat-conf.properties
 

Copy and paste this text into the editor:

datasource.driver=org.postgresql.Driver
datasource.url=jdbc:postgresql://localhost/xnat
datasource.username=xnat
datasource.password=xnat

hibernate.dialect=org.hibernate.dialect.PostgreSQL9Dialect
hibernate.hbm2ddl.auto=update
hibernate.show_sql=false
hibernate.cache.use_second_level_cache=true
hibernate.cache.use_query_cache=true

The values set in here for datasource.url, datasource.username, and datasource.password should work in your current virtual machine because the database is named xnat, the database user is named xnat, etc. If you've changed any of these values, you'll need to modify the contents of this configuration appropriately as well.

Note

You can download a version of this file directly to your config folder:

xnat@xnat-11:~$ cd ~/config
xnat@xnat-11:~/config$ wget -O xnat-conf.properties http://bit.ly/1Z7lRm6
...
2016-05-29 23:58:56 (124 MB/s) - ‘xnat-conf.properties’ saved [511/511]
xnat@xnat-11:~/config$ cat xnat-conf.properties

The last step here will display the properties file so that you can verify the proper contents were retrieved.

When adding the configuration file, the full absolute path to the file should be:

/data/xnat/home/config/xnat-conf.properties

 

Start Tomcat

Starting Tomcat really means starting XNAT for the first time. Before doing so, you should make sure that you've copied the XNAT war file to /var/lib/tomcat7/webapps/ROOT.war and that there is no folder named /var/lib/tomcat7/webapps/ROOT (Tomcat will use the folder instead of the war file). If that's all good, you can start the service:

xnat@xnat-11:~$ ls /var/lib/tomcat7/webapps/
ROOT.war
xnat@xnat-11:~$ sudo service tomcat7 start
 * Starting Tomcat servlet engine tomcat7                                                                                                                                                                                                                                                                                                                           [ OK ]
xnat@xnat-11:~$ tail -f /var/log/tomcat7/catalina.out
May 30, 2016 12:08:51 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
May 30, 2016 12:08:51 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.52 (Ubuntu)
May 30, 2016 12:08:51 AM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor /etc/tomcat7/Catalina/localhost/host-manager.xml
May 30, 2016 12:08:51 AM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor /etc/tomcat7/Catalina/localhost/manager.xml
May 30, 2016 12:08:51 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive /var/lib/tomcat7/webapps/ROOT.war
SOURCE: /var/lib/tomcat7/webapps/ROOT/
===========================
New Database -- BEGINNING Initialization
===========================
===========================
Database initialization complete.
===========================
May 30, 2016 12:11:18 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
May 30, 2016 12:11:18 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 147565 ms

The last command here uses the tail command to monitor the Tomcat start-up log. This is a good way to determine when XNAT has finished initializing and is ready to accept requests: once you see that message INFO: Server startup in ... ms, you'll know that you can go to the application in your browser. 

Problems?

If anything goes wrong during these steps, there are a couple places you can look for more information:

  • The XNAT logs are located in the logs folder under your user's home folder. These can help with errors inside of XNAT.
  • The Tomcat logs are located in the folder /var/log/tomcat7. These can help with start-up and configuration errors.
  • The nginx logs are located in the folder /var/log/nginx. These can help if there are issues with the proxy connection between nginx and Tomcat.

Note

  • If you've installed or worked with XNAT before, you'll notice that there are no steps to configure and populate the initial XNAT database. These steps are actually performed by XNAT itself on the fly as it starts up for the first time.
  • If you happen to run: ls /var/lib/tomcat7/webapps after the Tomcat restart, you will see that a ROOT directory does exist now.  Don't panic.  Tomcat expands the war file when it starts up.

Completed!

Tomcat has successfully started and the XNAT service has completed its initialization. Your XNAT server is ready to start working.

Go to the next step

  • No labels

3 Comments

  1. This didn't work for me
    $ cd ~
    xnat@xnat-11:~$ nano xnat-conf.properties 
    I had to put xnat-conf.properties in ~/config to get it to run
  2. I ran into this too and noticed it wasn't mentioned in the documentation - I'll add it.

  3. That was a typo. I've fixed it. Should have been cd ~/config.