This section describes how to run XNAT, configure your environment, and monitor and troubleshoot the deployed XNAT application using Tomcat 8.5 or later.
As of version 1.8.2, XNAT runs on Tomcat 8.5 and later by default, but we strongly recommend using Tomcat 9.0.
As a result, we only officially support Tomcat 9.0. You should consider migrating to Tomcat 9.0 as soon as possible.
This section describes how to modify XNAT to run on Tomcat 8.5 or later.
The default war for XNAT 1.8.1 and earlier is built to run under Tomcat 7.0 You should consider upgrading to XNAT 1.8.2 or later and running under Tomcat 8.5 or later, but if you can't:
Extract the file META-INF/context.xml (this requires having the Java JDK available on your path):
$ jar xf xnat-web-1.8.1.war META-INF/context.xml
This file should look something like this (edited for clarity):
<?xml version="1.0" encoding="utf-8"?>
<Context>
<Loader className="org.apache.catalina.loader.VirtualWebappLoader" searchVirtualFirst="true" virtualClasspath="${xnat.home}/plugins/*.jar"/>
<JarScanner scanAllDirectories="true" />
<Parameter name="xnatHome" value="${xnat.home}"/>
<Manager pathname="" />
</Context>
<Loader>
element.Add the following lines to the file right after the <Context>
element:
<Resources>
<PostResources className="org.apache.catalina.webresources.DirResourceSet" base="${xnat.home}/plugins" webAppMount="/WEB-INF/lib" />
</Resources>
<CookieProcessor className="org.apache.tomcat.util.http.LegacyCookieProcessor" />
Update the war file with your modified META-INF/context.xml file:
$ jar uf xnat-web-1.8.1.war META-INF/context.xml
The final version of your modified configuration file should look like this:
<?xml version="1.0" encoding="utf-8"?>
<Context>
<Resources>
<PostResources className="org.apache.catalina.webresources.DirResourceSet" base="${xnat.home}/plugins" webAppMount="/WEB-INF/lib" />
</Resources>
<CookieProcessor className="org.apache.tomcat.util.http.LegacyCookieProcessor" />
<JarScanner scanAllDirectories="true" />
<Parameter name="xnatHome" value="${xnat.home}"/>
<Manager pathname="" />
</Context>
The standard releases of XNAT 1.8.1 and earlier already have the lines required for compatibility with Tomcat 8.5 or later, but they're commented out. Delete the <Loader>
element then delete the !--
string at the beginning of the <Resources>
element and the --
string at the end of the <CookieProcessor>
element.
XNAT 1.8.2 and later requires no changes to run on Tomcat 8.5 or later.