jump to navigation

Changing the Context Root in WebLogic July 5, 2007

Posted by Phill in Application Servers.
Tags: ,

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).



1. karan - February 5, 2008

This blog helped me, as i was busy trying to set context root name for web application (WAR) deployed on weblogic.

Thanks Phill

2. Mark van Holsteijn - June 16, 2008

You can set the context root of the web application in the weblogic specific deployment descriptor too, under the element ‘context-root’. Checkout
the documentation on edocs.bea.com/wls/docs81/webapp/weblogic_xml.html#1040721 for the complete specification of context root algorithm.



3. Sreeni - July 23, 2008

I agree with Mark. My web application is deployed on weblogic 9.2. In my case, I wanted to keep my web application’s context path to be different than the name of the war file itself. I ended up changing the context-root in weblogic.xml.

Here is the entry I had to add:


4. Sreeni - July 23, 2008

The entry is not displayed right. here it is again.. attempt# 2:


5. Sreeni - July 23, 2008

Well. I gave up. put your context-root element with your context path inside weblogic-web-app element in weblogic.xml.

6. Phill - July 24, 2008

Thanks Sreeni. I have updated the post to reflect this!

7. Tom - September 15, 2008

I have a slight headache with this. Anyone have an asprin? I’ve changed my context root and got this to work with no problem, except for when I deploy my application in exploded fashion to my autodeploy directory on my dev box. In that case, I can’t seem to hit any part of the application. I’ve tried mucking around with the context in the URL I’m using but to no avail. Anyone run into this?

8. Phill - September 15, 2008

What does the WebLogic console say? I’m sure if you browse around the application config it will tell you what it thinks the context root is. If you still can’t access the app by using the context root, it’s time to start checking log files to see what’s going wrong!

9. Bhavya - December 4, 2008

Thanks for the post. It helped me in the right moment

10. Satish - February 18, 2009

Nice post Phill..

11. chandra - August 4, 2011

I am running into a similar situation like Tom, ideally i access my application running on weblogic using the URL
and I am getting a blank page now.
The context root of the application is playweb, so when I try to access using the URL
It comes up with an page which says that it is redirecting to Login page but then it goes blank.
I have checked everything, the application.xml has the context-root tag set to playweb.
I am running out of ideas any help is appreciated.

Sorry comments are closed for this entry

%d bloggers like this: