Making JasperReports Server the Default Tomcat App

If you’re running JasperReports Server Community Edition, and want to access it at the root url (http://reports.example.com) instead of the jasperserver sub-directory (http://reports.example.com/jasperserver), here is how I did it.

My installation is in /opt/jasperserver.
Go to /opt/jasperserver/apache-tomcat/webapps

# cd /opt/jasperserver/apache-tomcat/webapps

Move the ‘ROOT’ application out of the way. You need to move it outside the webapps directory. I just moved mine to /root. I figure it’s better than deleting it, just in case you need it later.

# mv ROOT /root/webapp_ROOT_backup

Then, create a soft-link from the jasperserver directory to ROOT.

# ln -s jasperserver ROOT
# ls -l
drwxr-x---  5 root root 4096 Apr 15 12:00 host-manager
drwxr-xr-x 11 root root 4096 Apr 15 12:00 jasperserver
drwxr-x---  5 root root 4096 Apr 15 12:00 manager
lrwxrwxrwx  1 root root   12 Apr 15 12:00 ROOT -> jasperserver

Now we need to make Tomcat skip over the original jasperserver directory. We do this by editing the server.xml file in apache-tomcat/conf/server.xml. Find the <Host … line and add the “deployIgnore” directive to it, like this:

From:
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true" startStopThreads="-1">
To:
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true" startStopThreads="-1" deployIgnore="jasperserver">

Then restart everything. Now the Jasper Reports server will be running at the root url, and not at /jasperserver.

I’m sharing this here because it took me far to long to find the right information, which wasn’t all in one place. I hope someone else finds it useful.

I’m not sure if this configuration will be overwritten on an upgrade, but it’s not too big of a hassle if it does.