Reputation: 674
I would like to have a symbolic link in tomcat's webapps directory that points to a war file at another place in my file system, and I would like that war file to be served as the default webapp. I have pieced together the following solution, but the app is not accessible from the browser.
I have a folder in my home directory ~/tomcat/webapps. The owner is tomcat7. In this folder, I have my war file, myapp-1.0.war.
In my /var/lib/tomcat7/webapps directory, I have a symbolic link:
myapp -> /home/[me]/tomcat/webapps/myapp-1.0.war.
In my /etc/tomcat7/server.xml, I have:
<Context docBase="/var/lib/tomcat7/webapps/myapp" path="" reloadable="true" allowLinking="true"/>
Tomcat starts with no complaints in the logs, but my app is not accessible. [host]:8080/rest/ returns 404, where it would normally take me to the home page.
I partially want to do this to abstract out the version number from my war file. Any ideas why this is not working, or what I'm doing wrong?
Thanks.
Upvotes: 2
Views: 5216
Reputation: 674
I found the problem. The symlink in the webapps directory needs to have a .war extension. So, instead of:
myapp -> /home/[me]/tomcat/webapps/myapp-1.0.war
It should be:
myapp.war -> /home/[me]/tomcat/webapps/myapp-1.0.war
I was also able to shorten the value of the docBase attribute as below:
<Context docBase="myapp" path="" reloadable="true" allowLinking="true"/>
Upvotes: 2