How can I install one Web Application in two context roots in Weblogic 10g?
views:
324answers:
3If you really need this, I recommend making your application a shared library and creating just a new web.xml file to change the context root for the two deployments.
This way you won't duplicate the entire war file and you still can configure them individually.
This is a packaging issue. Package the WAR twice, each with a specific WEB-INF/weblogic.xml
, to solve it.
For the first WAR:
<?xml version='1.0' encoding='UTF-8'?>
<weblogic-web-app>
<context-root>my-context-1</context-root>
</weblogic-web-app>
For the second WAR:
<?xml version='1.0' encoding='UTF-8'?>
<weblogic-web-app>
<context-root>my-context-2</context-root>
</weblogic-web-app>
This will allow you to use standard deployment tools. I don't recommend installing your application as a shared library.
Assuming you have an Apache reverse proxy in front of the app server, you could use mod_rewrite to change the context root on-the-fly on the server side (transparent for the client).
For example: adding the iinstructions below to httpd.conf will return the content of 2.html when the client calls 1.html:
RewriteEngine on
RewriteRule ^/1.html$ /2.html
Respectivly, you could make the obvious translation to translate the second context root to the other single context root.