With the recent launch of Coherence 12c (12.1.2), I'd like to go into more detail about one of the new features, Managed Coherence Servers, as well as outline how you can run the sample application available with a WebLogic Server 12.1.2 install.
Managed Coherence Servers - Introduction
Managed Coherence Servers provide tight integration between WebLogic Server and Coherence. This integration allows for a simplified and streamlined development and management environment for distributed applications. The functionality allows end users to build a new archive type (Grid Archive aka GAR), which can be deployed and managed via standard WebLogic Server best practices. Developers can now streamline their build processes to generate GARs. Operations departments can now standardize deployment of Coherence and Coherence applications in the test and production environments.
Traditionally, Coherence has been deployed as a jar incorporated into a Java application (e.g., WAR or standalone Java application) along with a tier of standalone cache server JVMs (often using the DefaultCacheServer class). The embedded java usages (such as in a WAR) are referred to as clients and the standalone cache servers are referred to as servers. The lifecycles of the “clients” and cache servers are managed separately, often manually, with the cache servers managed by custom shell scripts. Application development and deployment in this model can be a complicated process involving many moving parts that require custom management processes.
Within the new model, the artifacts required to run Coherence based applications, such as POJO's, server side logic and cache configuration are packaged into a GAR. This mirrors to a large degree the structure of other Java EE artifacts such as Web Archives (WAR). This GAR can be deployed and managed in the same using the standard WebLogic Server tools such as:
- Admin Console
- WebLogic Deployer
- WebLogic Development Maven Plugin
The Coherence cluster's operational configuration and structure is defined within the Admin Console, or via WLST. You can then take advantage of the traditional WebLogic Server constructs such as Clusters (not to be confused with the new Coherence Cluster artifact), to build a tiered application architecture that might include a data tier, application tier, and proxy tier. The Coherence configuration is targeted to those WebLogic Server Clusters and Managed Servers that are assigned to those WebLogic Server Clusters inherit the operation configuration by being members of those WebLogic Server Clusters. You can then deploy Coherence based applications, (EARs, GARs) to clusters and they will be automatically deployed to all members of the cluster.
Please see the Oracle Coherence YouTube Channel for more in-depth videos and demonstrations of Managed Coherence Servers.
Running The Sample Application
When you download WebLogic Server 12c and complete the full install, there is a sample application and sample WLST scripts that you can use to get familiar with the new feature. I'll explain the steps to do this below.
Downloading WebLogic Server and a supported JDK
Firstly you need to download WebLogic Server 12c from Oracle Technology Network. You can download the "Generic WebLogic Server and Coherence Installer" or the specific installer for your operating system. If you choose to download the generic installer you must download a certified JDK as well. See here for detailed installation information.
In my example I downloaded the latest "Java SE Development Kit 7u25" available here.
Installing WebLogic Server
For my example, on Windows 7, I ran a command prompt as administrator, set my JAVA_HOME to my installed JDK and ran the installer.
Click Next on the "Welcome Screen", and choose C:\Oracle\Middleware (or appropriate directory) as install location. Click Next to continue.
On the next screen ensure you select Complete Install as this will install the examples as well. Select Next to continue.
Continue through the installer and after the installation is completed, ensure the "Automatically Launch the Quickstart Configuration Wizard" check-box is checked, and click Finish.
When the Config Wizard starts, choose a a password, such as welcome1, and click Create to configure the examples.
After the creation is complete, you don't need to start the domain for these examples.
Viewing the Examples Home Page
Open the index.html file in the examples home directory. For my install the home directory was c:\Oracle\Middleware\user_projects\applications\wl_server\index.html. This page is the home for all WebLogic Server examples. You can select the Managed Coherence Servers Examples link to view the examples.
There are a number of examples showcasing the new functionality. If your machine doesn't have too much memory, e.g, 4GB or less you can follow the instructions in the Single Server example which will deploy only to a single Admin Server. Below, I will explain how to run the Multi Server example which uses a tiered approach.
Running the Multi-Server Example
Open a command prompt and set your WebLogic Server environment by using the setWLSEnv.cmd/ setWLSEnv.sh in your installation. For my install the location of setWLSEnv.cmd is C:\Oracle\Middleware\wlserver\server\bin.
Next change to the examples home directory. This is a nice long directory, but in my install the location was C:\Oracle\Middleware\user_projects\wl_server\examples\src\examples\coherence\managed-coherence-servers.
Under this directory there are a number of directories, but as we are going to run the multi-server example, change to the multi-server directory.
Next type ant deploy to build and install the application. If ant is not found, ensure you have correctly run setWLSEnv.cmd/sh. After the compilation has completed answer the prompts to enter a password (note this will be displayed in clear text) and hostname for your machine. You can leave the other ports as defaults.
The build process will create a new domain called multi_domain with a data tier and app tier and deploy the application to this domain.
On completion, you can then access the URL shown above and run the sample JSP application, shown below. You can also access the Admin console to view the applications and configuration that was created.
There are other examples available in the same location showing you how to carry out a rolling redeploy and thread-dump of all managed servers using WLST.
See the following links for more information on Coherence 12.1.2 and Managed Coherence Servers.
Hope you enjoy the new functionality!