As part of the WebLogic 12.2.1 release a new new feature called “WebLogic Server Multitenant” has been introduced. I’ve taken a couple of paragraphs from the Oracle WebLogic Server Documentation as it explains it nicely.
Multitenancy in WebLogic Server provides a sharable infrastructure for use by multiple organizations. These organizations are a conceptual grouping of your own choosing, which you can think of as tenants. By allowing one domain to support multiple tenants, WebLogic Server MT improves density and achieves a more efficient use of resources while eliminating the hurdles typically present when trying to share multiple applications: runtime cross-application impact, security differences, data co-mingling, and administrative challenges.
WebLogic Server MT provides resource isolation within a domain partition, an administrative and runtime slice of a WebLogic domain that is dedicated to running application instances and related resources for a tenant. Domain partitions achieve greater density by allowing application instances and related resources to share the domain, WebLogic Server itself, the Java virtual machine, and the operating system while isolating tenant-specific application data, configuration, and runtime traffic.
Coherence, when used in conjunction with WebLogic Server is fully supported in a multitenant environment. When you deploy GARs (Grid Archives) and applications using Coherence, the services started within the applications are isolated by domain partition allowing multiple tenants to run the same Coherence application, but have private data and services.
Coherence & WebLogic Server Multitenant Example
When we released Coherence and WebLogic 12.1.2 back in August 2013, I showed how to run the examples we shipped which demonstrate how to use the new “GAR” model. See here for the details.
The standard examples are still there but we have included an example with a fully fledged Coherence & WebLogic Server application in a multi tenant domain.
The rest of this post will walk you though, in varying levels of detail, how to install and run these examples.
STEP 1 – Download and install JDK and WebLogic Server Generic
Download the Generic installer from OTN as well as the supported JDK for your platform. At the time of writing this it is 1.8.0_51 or above.
After you have installed the JDK, go do the directory where you downloaded WebLogic Server. You should see a file named: fmw_126.96.36.199.0_wls_Disk1_1of1.zip.
Unzip this file which will create a file called fmw_188.8.131.52.0_wls.jar.
Follow the installation instructions in my original post here. When you have completed the install, remembering to choose “Complete Install”, return to this post as some of the directories have changed slightly in this version.
STEP 2- Viewing the Examples Home Page
Now thats you’ve installed the JDK and WebLogic Server (with Examples 🙂 ), we will take a look at the examples home page. In my case I installed WebLogic into the following directory:
Using your browser, open up the following file, (replacing the WebLogic Server home with yours)
The page should look similar to the following:
You can see the second example is the Multitenant example. If you click on the link you will see the instructions for running the example as shown below.
The instructions are quite detailed and explain how the example works.I’ve included a summary of how to run/ build below.
STEP 3 – Building and Start the Multitenant Domain
To build the domain, open a command prompt and issue the setWLSEnv.sh/cmd file for your environment.
E.g. for Windows
cd \Oracle\Middleware\1221\wlserver\server\bin setWLSEnv.cmd
cd /u01/Middleware/1221/wlserver/server/bin . ./setWLSEnv.sh
Once you have set your environment, change to the following directory:
Once here, you can issue the following command to build the domain. You will be asked a few questions. Be sure to check your hostname is correct, otherwise the build may not succeed. You can just press enter to leave the ports as default.
The output should be similar to below:
At the end of the build, you will see instructions showing you how to run the sample applications and get the the WebLogic Server Admin Console.
STEP 4 – Run The Applications
There are two demonstration applications deployed.
This application shows the same contact application we shipped with previous versions, deployed unchanged in a multi tenant environment. The data for each for the domain partitions (tenants) is totally isolated. You can go to either of the URLs below and see the different data:
In the example above we are using URL prefixes for convenience to determine the different domain partitions, company1 and company2, but in normal environments you could use Virtual Targets behind a load balancer and map them to http://company1.com/example-web-app and http://company2.com/example-web-app.
The stores application shows an example of sharing data between domain partitions in multi tenant application.
The concept of a “shared cache” between domain partitions is not enabled out of the box for obvious reasons but the administrator can configure this if required.
You can also go to the Admin console (URL in the output about) to see how this configuration is setup. A few sample screens are shown below.
STEP 5 – Stopping the Domain
You can issue the following to stop the enter WebLogic Server domain:
“WebLogic Server Multitenant” is an exciting new feature and is a great way to achieve more density and better utilise your WebLogic Server environments and is fully supported by Coherence applications.
For more information on configuring Coherence in a multitenant environment see the WebLogic Server / Coherence Documentation.