0

I have an application with WAR name like "test< Version >.war",every time the version changes. I need my context path to be "/test", I know that I can rename WAR file to test.war and deploy it. I added a file called ROOT.xml in <catalina_home>/conf/Catalina/localhost/ and tried below configuration, it didn't wprk

<Context 
 docBase="test*.war" 
 path="/test" 
 reloadable="true" 
/> 

Any suggestions to make this work?

Vipin CP
  • 3,642
  • 3
  • 33
  • 55
Nagendra
  • 191
  • 1
  • 3
  • 20
  • My war has been deployed in webapps folder. Is it still necessary to provide full path ?But the my war file name changes every time that is version changes, I cannot hardcode the war name – Nagendra Aug 10 '16 at 06:50

1 Answers1

0

Do not set the path attribute in a context.xml file.

Instead, re-name the WAR file to be appname.war. In your case, it sounds like the WAR file has to contain version information, so you need to do things a little bit differently.

You were on the right track using conf/Catalina/localhost/ROOT.xml. This will set the context path for the application to "" (empty string, the "root" web application). If you want the application to be deployed under /test, then you need to re-name ROOT.xml to test.xml.

For the docBase, you need to have the correct WAR filename in there; no wildcards or anything like that are acceptable. You should use the fully-qualified path to your WAR file if possible. Also, the WAR file should not be in Tomcat's webapps/ directory, or you'll end up deploying the application twice on to different context paths (/test and /test-1.2.3.4).

Christopher Schultz
  • 20,221
  • 9
  • 60
  • 77