Restarting WebLogic Servers in an Oracle Java Cloud Service Instance

 

Before You Begin

Purpose

This tutorial covers how to start and stop servers in an Oracle Java Cloud Service (JCS) instance by using using the WebLogic Server Administration Console and via WebLogic Scripting Tool (WLST) commands.

Time to Complete

Approximately 30 minutes.

Introduction

Oracle Java Cloud Service is built on top of Oracle WebLogic Server. When you create a JCS instance, an Oracle WebLogic Domain is provisioned across all machines that are part of that JCS instance.

An Oracle WebLogic Domain is made up of a set of WebLogic server instances that work together to host and operate your Java EE applications. Within the domain only one WebLogic server instance is responsible for administrative operations, such as creating new server instances or deploying applications. That privileged server is referred to as the admin server, whereas all the rest are managed servers.

The admin server also hosts the WebLogic Server Administration Console.

In this tutorial we will show how start and stop both the admin and the managed servers in two ways:

  • Using the WebLogic Server Administration Console
  • Using WLST Commands

Software Requirements

Any SSH utility

A SSH command line client is required to access the target VMs hosting the JCS Weblogic Instances and execute WLST Commands there. SSH utilities with CLIs include OpenSSH (Unix, Cygwin (Windows) or PuTTy (Windows).

Prerequisites

Before starting this tutorial, you should have:

  • A JCS instance already available.
  • Any SSH utility installed on your local computer.
  • A valid pair of SSH keys, for accessing the JCS instance VMs.
  • A basic knowledge of Linux, for working at the command line.

The tutorial Create SSH Keys for Use with Oracle Cloud Services shows you how to work with SSH keys. Please review that tutorial if you are not familiar with the use of SSH keys in Oracle Cloud Services.

 

Using the WebLogic Server Administration Console to Shutdown Servers

 

Log into the WebLogic Server Administration Console

  1. Sign in to the My Services application at https://cloud.oracle.com/sign_in after selecting the appropriate Public Cloud Services Data Center option. The My Services Dashboard appears.

  2. In the Oracle Java Cloud Service section, click Open Service Console. The Oracle Java Cloud Service Console page is displayed.

    JCS Console
    Description of this image
  3. On your Oracle Java Cloud Service Console, click the preferences preferences_icon icon for the service instance that you want to manage, and then click Open WebLogic Server Console.

    Description of this image
  4. The WebLogic Server Administration Console login page is displayed. Use a valid WebLogic Server administrative user name and password to log into the console. You may want to use the WebLogic Administrator username and password that you provided when creating the service instance (for example wlssandbox/Welcome#1).

    Description of this image
  5. The Fusion Middleware Control Administration Console home page is displayed.

    Description of this image
 

Navigate to the Servers Control page

  1. In the navigation tree under the domain name click the Environment node to expand it and then click Servers.

    Description of this image
  2. The workspace area presents the list of servers that are part of the domain. Click the Control tab.

    Description of this image
 

Select and Stop a Managed Server

  1. Select a managed server by clicking on its selection checkbox.

  2. Click Shutdown > When work completes, to tell the managed server to stop only when all background threads have finished their job.

  3. Click Shutdown > Force Shutdown Now, to send an immediate shutdown order.

    Description of this image
  4. Confirm your order by selecting Yes and wait until it completes.

    Description of this image
    Description of this image
 

Select and Stop the Admin Server

  1. Select a managed server by clicking on its selection checkbox.

  2. Click Shutdown > When work completes, to tell the admin server to stop only when all background threads have finished their job.

  3. Click Shutdown > Force Shutdown Now, to send an immediate shutdown order.

    Description of this image
  4. Confirm your order by selecting Yes and wait.

    Description of this image

    The WebLogic Administration Console is hosted on the admin server. Therefore, stopping the admin server will make you lose the Administration Console until the admin server is restarted. To do so you will have to resort to the command line, as we will explain in the next section of this tutorial.

  5. Description of this image
 

Using WLST Commands to Start Servers

To use WLST Commands you need:

  • Oracle WebLogic Server installed
  • Network connectivity to the VMs on which you want to start servers

As long as those requirements are met, you can use any machine, be it local, remote, or one of the VMs that are part of your JCS instance.

For this tutorial we will SSH to the JCS VM that hosts the admin server.

 

Find the public IP address of the admin server machine

  1. If not already signed in to the My Services application at https://cloud.oracle.com/sign_in, do so again after selecting the appropriate Public Cloud Services Data Center option. The My Services Dashboard appears.

  2. In the Oracle Java Cloud Service section, click Open Service Console.

  3. On your Oracle Java Cloud Service Console, click the link that represents the service instance you want to manage.

    Description of this image

    The details of the selected service instance show up, including a list with all the machines belonging to the service. Take note of the public IP address given to the VM that holds the admin server.

    Description of this image
 

SSH to the admin server VM

  1. Use the SSH client of your choice to access the target machine. Use the public IP address you found out in the step #1 and opc as the username with no password.

    You will also have to provide your SSH client with the SSH private key you created for use with Oracle Cloud Services.

    To get more information about SSH keys see Creating SSH Keys for Use with Oracle Cloud Services.

    Description of this image

    If you created you SSH private key with a passphrase you will be prompted for it.

    Description of this image
  2. After you log in, change to the user oracle issuing the command sudo su – oracle

    Description of this image

    oracle is the owner of the WebLogic domain directory.

 

Set the environment

  1. Issue a df -k command to see the list of filesystems
    (Alternately for these steps, you can change to: $DOMAIN_HOME/servers/<jcs-server> )

    Description of this image

    /u01/data/domains is the filesystem where the domain data reside.

  2. Change to /u01/data/domains/<jcs-domain>/bin, where <jcs-domain> matches your domain name, formed with the first eight letters of the JCS instance name plus the suffix _domain. Execute source ./setDomainEnv.sh

    Description of this image
 

Use WLST to start the server

  1. Execute java weblogic.WLST to enter the WLST Command Line Interface

    Description of this image
  2. As a first step you need to connect to the NodeManager that manages the target server. No matter whether it is the local VM o a different one, as long as it is reachable. That will happen for all JCS VMs.

    Execute:

    nmConnect(
    <username>,<password>,
    <nodemanager-host>,<nodemanager-port>,
    <domain-name>,<domain-folder>,<nodemanager-type>)

    All parameters are self-explanatory except "nodemanager-type" that must be set to ‘SSL’ since that is the default NodeManager communication protocol in JCS.

    Description of this image
  3. Use nmStart(<servername>) to send a server start order. Wait until the process completes.
    If you are unsure about the possible server names, a list of declared servers can be retrieved using the following WLST commands:

    • execute readDomain(‘/u01/data/domains/<jcs-domain>’) to load the required context.
    • execute ls(‘Server’) to get the list of server names

    Description of this image
 

Using the WebLogic Server Administration Console to Start Managed Servers

Managed servers can be started using WLST Commands as explained in the section above "Using WLST Commands to Start Server". However, once the admin server has started and the WebLogic Administration Console becomes available it may come in handy to use the web interface to start the managed servers.
This part of the tutorial shows you how to do it.

 

Log into the WebLogic Server Administration Console

  1. If not already signed in to the My Services application at https://cloud.oracle.com/sign_in, do so again after selecting the appropriate Public Cloud Services Data Center option. The My Services Dashboard appears.

  2. In the Oracle Java Cloud Service section, click Open Service Console. The Oracle Java Cloud Service Console page is displayed.

    Description of this image
  3. On your Oracle Java Cloud Service Console, click the preferences preferences_icon icon for the service instance that you want to manage, and then click Open WebLogic Server Console.

    Description of this image
  4. The WebLogic Server Administration Console login page is displayed. Use a valid WebLogic Server administrative user name and password to log into the console. You may want to use the WebLogic Administrator username and password that you provided when creating the service instance (for example wlssandbox/Welcome#1).

    Description of this image

    The WebLogic Server Administration Console home page is displayed.

    Description of this image
 

Navigate to the Servers Control page

  1. In the navigation tree under the domain name click expand the Environment node and then click Servers.

    Description of this image
  2. The workspace area presents the list of servers that are part of the domain. Click on the Control tab

    Description of this image
 

Select and start a managed server

  1. Select a managed server by clicking on its selection checkbox. Click Start.

    Description of this image
  2. Confirm your order by clicking Yes and then wait until it completes.

    Description of this image
  3. The server is now running and the console indicates the task has been completed.

    Description of this image
 

Want to Learn More?