webgt
webgt

Reputation: 185

How can I install one Web Application in two context roots in Weblogic 10g?

How can I install one Web Application in two context roots in Weblogic 10g?

Upvotes: 5

Views: 5673

Answers (3)

Gili Nachum
Gili Nachum

Reputation: 5568

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.

Upvotes: 0

Pascal Thivent
Pascal Thivent

Reputation: 570345

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.

Upvotes: 3

John Liptak
John Liptak

Reputation: 41

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

Upvotes: 0

Related Questions