By Rose Pan-Oracle on Nov 04, 2015
Oracle WebLogic Server 12.2.1 added support for multitenancy (WLS MT). In WLS MT, WLS can be configured with a domain, as well as one or more partitions. A partition contains new elements introduced in WLS MT, like resource groups, resource group templates, virtual targets, etc. Setting up a domain with partitions requires additional steps compared to a traditional WLS domain. For more detailed information about these new WLS MT related concepts, please see Oracle Docs listed in the "References" section.
Oracle recommends to use Fusion Middleware Control (FMWC) to create WebLogic domains via Restricted JRF template. Oracle also support creating WebLogic Server domains using WLST. In this article, I will demonstrate how to create a WLS domain with 2 partitions using WLST. This includes:
- Displaying domain topology
- Creating a domain with 2 partitions using WLST
- Displaying domain config file sample
These tasks are described in the subsequence sections.
In this article, I will create a domain that is configured with:
- One AdminServer named "admin", one partition named "coke", one partition named "pepsi".
- The "coke" partition contains one resource group named "coke-rg1", targeting to a virtual target named "coke-vt".
- The "pepsi" partition contains one resource group named "pepsi-rg1", targeting to a virtual target named "pepsi-vt".
- An application "helloTenant.ear" is deployed to the domain, the "coke-rg1" in the "coke" partition and the "pepsi-rg1" in the "pepsi" partition.
The following picture shows what the domain topology looks:
Note this domain topology does not contain other MT related concepts, like a resource group template. They are not covered in this article. To see more information about other MT related concepts, please check the "References" section for details.
2. Create a domain with partitions
To create a domain with the topology shown in the picture above, several steps are required:
- Create a traditional WLS domain
- Start the domain
- Create a partition in the domain
- Create a security realm for the partition
- Create a user for the partition
- Add the user to the groups in the security realm
- Create a virtual target
- Create a partition
- Create a resource group
- Set a virtual target as a default target
- Setup security IDD for the partition
- Restart the server
- Start the partition
Below will illustrate each step in details.
2.1 Create a traditional WLS domain
A traditional WLS domain can be created by using the Config Wizard. Start the Config Wizard via a command script:
Create a domain using all the defaults, Specify the following:
- Domain name = base_domain
- User name = weblogic
- User password = welcome1
2.2 Start the domain
2.3 Create a partition: coke in a domain
The steps below require WLST to be started. Use the following command to start WLST:
Note, all of the WLST commands shown below are run after connecting to the Admin server "admin" with the admin user "weblogic" credentials, e.g.,
Now, WLST is ready to run commands to setup the partition for coke. The partition for coke has the following values:
- Partition name = coke
- Partition user name = mtadmin1
- Partition password = welcome1
To do that, a security realm and a user are created for the partition as shown below. We explain it step-by-step.
2.3.1 Create a security realm for the partition
The security realm is created using the standard WLS APIs.
2.3.2 Add a user and group to the security realm for the partition
Create a user and add the user to a security group Administrators in the realm. In this use case, the username and the password for the coke partition are mtadmin1 and welcome1. There is no need to start an edit session when looking up the Authentication Provider to create a user/group.
2.3.3 Create a virtual target for the partition
This virtual target is targeted to the admin server. The uri prefix is /coke. This is the url prefix used for making JMX connections to WebLogic Server MBeanServer.
2.3.4 Create the partition: coke
The partition name is coke and it is targeted to the coke-vt virtual target.
2.3.5 Setup IDD for the partition
Set up primary identity domain (IDD) for the partition.
2.3.6 Restart the Server
Restart WebLogic Server because of the security setting changes.
2.3.7 Start the partition
This is required for a partition to receive requests.
2.4 Create another partition: pepsi in a domain
Repeat the same steps in 2.3 to create another partition: pepsi, but with different values:
- Partition name = pepsi
- User name = mtadmin2
- Password = welcome2
- Security realm = pepsi_realm
- IDD name = pepsiIDD
- Virtual target name = pepsi-vt
- Resource group name = pepsi-rg1
2.5 Deploy User Application
Now the domain is ready to use. Let's deploy an application ear file. The application, e.g., helloTenant.ear, is deployed to the WebLogic Server domain, the coke partition, the pepsi partition.
2.6 Domain config file sample
When all of the steps are finished, the domain config file in $DOMAIN_HOME/config/config.xml will contain all of the info needed for the domain and the partitions. Here is a sample snippet related to the coke partition in the config.xml:
For the pepsi partition, there is a similar <virtual-target> element and the <partition> element for pepsi added in the config.xml.
From now on, the domain with 2 partitions are created and ready to serve requests. Users can access their applications deployed onto this domain. Check this blog Application MBean Visibility in Oracle WebLogic Server 12.2.1 regarding how to access the application MBeans registered on WebLogic Server MBeanServers in MT in 12.2.1.
3. Debug Flags
In case of errors during domain creation, there are debug flags which can be used to triage the errors:
- If the error is related to security realm setup, restart the WLS server with these debug flags:
- -Dweblogic.debug.DebugSecurityAtn=true -Dweblogic.debug.DebugSecurity=true -Dweblogic.debug.DebugSecurityRealm=true
- If the error is related to a bean config error in a domain, restart the WLS server with these debug flags:
- -Dweblogic.debug.DebugJMXCore=true -Dweblogic.debug.DebugJMXDomain=true
- If the error is related to an edit session issue, restart the WLS server with these debug flags:
- -Dweblogic.debug.DebugConfigurationEdit=true -Dweblogic.debug.DebugDeploymentService=true -Dweblogic.debug.DebugDeploymentServiceInternal=true -Dweblogic.debug.DebugDeploymentServiceTransportHttp=true
An Oracle WebLogic Server domain in 12.2.1 can contain partitions. Creating a domain with partitions needs additional steps compared to creating a traditional WLS domain. This article shows the domain creation using WLST. There are other ways to create domains with partitions, e.g., FMW Control. For more information on how to create a domain with partitions, please check the "References" section.