Changing the Context Root in WebLogic July 5, 2007Posted by Phill in Application Servers.
Tags: context root, weblogic
File this under “spent 10 minutes trying to figure this one out”:
I’ve just been trying to change the context root of a web application (WAR File) deployed on WebLogic 8.1. At first I thought it was in the weblogic.xml file (or some other deployment descriptor) – but no, this is a simple application, it doesn’t have one apart from web.xml.
Then I thought, “hmmm, perhaps it’s to do with the application name”. Again, no luck there either.
It turns out that it was to do with the name of the WAR file itself. If the application doesn’t specify a contxt root, it will be taken from the name of the WAR file (whatever you name the application). Which is annoying, because it means if you want to deploy the application under a different context root, you have to rename the WAR file.
Anyway, just for future reference I thought it was worth mentioning…
Update: after feedback in the comments section, it is also possible to change the context-root using the weblogic.xml file.
You can find the relevant documentation here (for WebLogic 9, I believe other versions of WL are similar).