Change context-root inside WAR file

2.8k views Asked by At

I am really new to WebLogic deployments. I have the below situation: I have a war file which is already deployed on WebLogic 8.1, I want to pick the same war and deploy it on the same server without bringing the original site down. This would definitely give me a exception saying the context path already exists. I have no way of recreating the war file, hence I will somehow have to modify the war file to change the context root. Is this possible? And if it is possible could you also confirm that both using the same data-source(JNDI) would not cause any issues to the existing site.

Thanks, Sahana

1

There are 1 answers

0
Display Name is missing On BEST ANSWER

Yes you can deploy the same war file multiple times and yes you can change the context root. You will want to do something like the following if you cannot rebuild the war file yourself.

  • Unzip the war file (jar xvf myfile.war)

    • This isn't entirely necessary but it will help you understand the structure of the war file. Zip tools can modify a file in place. Try 7zip or use the Windows zip utility via right-click Open
  • Edit the weblogic.xml file with the new root <context-root>/new-root</context-root>

  • Rezip the war file (jar cvf mywar.war folder_it_is_in)

Here are other examples that may help as well:

How to deploy EAR application twice on WebLogic server?

How to deploy the same web application twice on WebLogic 11g?

How can I use Weblogic (12 C) without the application context in the URL?