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

Alexander Rühl picture Alexander Rühl · Mar 22, 2012 · Viewed 7.1k times · Source

We have developed a JEE5 web application (WAR) and running it in production under WebLogic 11g (10.3.5).

Now the same application should be deployed as separate applications for different customers (different URLs, different data) on the same WebLogic.

I managed the first part by setting different context roots after deployment for each of them.

But I have yet to make them use different datasources - and since I want to avoid customer specific builds, the persistence.xml is the same for all applications, thus also the persistence unit name.

What is the best setup for this scenario? Am I forced making separate builds and by that different WARs or do I have to separate Managed Servers or Domains wihtin the server or is there a better way to solve it?

Answer

asboree picture asboree · Nov 16, 2015

I know this thread is very old,but replying so that it may help someone with the same question stumbling on this thread.

The latest weblogic 12.2.1 comes with Multi-tenancy(add-on I guess) which can let you run same applications in a single domain.

Edit: Weblogic 12.2.1 introduced concept called Partitions. Partitions are both config and run-time subdivision of a weblogic Domain. In a single weblogic domain you can create multiple partitions. Each partition will have one or more resource groups. Resource groups are the logical grouping of weblogic resorces like data sources,jms,Java EE apps ,etc. For example to achieve what the original posts asked for , we create a Resource Group template with the web-application and the datasource as the resources. In the Data source configuration we can provide a place holder variable instead of actual URL as DB URL. Then we can create two partitions that refers to this Resource Group Template(Each partition will now have a separate web application and data source) . Each partition will override the DB URL property there by creating two data sources with same JNDI name.In each Partition we create virtual host/port so that the client can use that to access the application running in the respective partitions.

A better and more detailed information on this can be found in https://blogs.oracle.com/WebLogicServer/entry/domain_partitions_for_multi_tenancy