Files   Prepare   Deploy   Troubleshooting   Related Topics 

About the Example

Managed Coherence Servers provide a tight integration between Weblogic Server and Coherence, allowing for a simplified and streamlined development and management environment for distributed applications. The functionality allows you to build a new archive type, called a Grid Archive (GAR), which can be deployed and managed on WebLogic Server in a manner similar to other Java EE artifacts. Developers can now streamline their build artifacts to generate GARs, and the operations departments can have a standardized way of deploying Coherence in test and production environments.

This example shows how to perform a thread dump for managed Coherence servers in a WebLogic domain. A thread dump is a snapshot of the state of all threads that are running as part of a Managed Server. This information is useful when trying to diagnose problems with an application.

The example uses a WLST script that can be run against a WebLogic cluster that contains storage-enabled and disabled Coherence members.

 


Files Used in the Example

Directory Location: @EXAMPLES_HOME/examples/src/examples/coherence/managed-coherence-servers/common/resource/wlst

File Description
coherence_thread_dump.py WLST script that, after copied to the ORACLE_HOME/wlserver/common/wlst directory, effects a thread dump based upon a number of arguments passed.

Prepare the Example

Prerequisites

Before working with this example, install Oracle WebLogic Server, including the examples, if you have not already done so.

Configure Oracle WebLogic Server

Copy the coherence_thread_dump.py file from the @EXAMPLES_HOME/examples/src/examples/coherence/managed-coherence-servers/common/resource/wlst directory to the ORACLE_HOME/wlserver/common/wlst directory. This file contains the WLST functions that must be made available to the other WLST scripts in this example.

Build the Example

To run this example, you must have an existing WebLogic Server environment configured with Coherence. Your environment must have a Coherence cluster defined, with one or more Managed Servers associated with that cluster. If you do not have an environment available, you can use the environment that is created by building and running the multi server Coherence example, which is described in Managed Coherence Servers - Multi Server. See Prepare the Example for information about how to build and run the multi server example.

After you have set up the environment for running the example, complete the steps in Deploy the example.


Deploy the Example

The coherence_thread_dump.py script makes the following WLST function available for use:

   coherenceThreadDump(dumpDirectory, targetName='All' ,targetType='ManagedServer')

This function has the following arguments:

Argument Description
dumpDirectory (Required) Name of the directory to contain the thread dumps. For example, /home/oracle.
targetName Represents the name of the target on which the the thread dump is run. The target is a Managed Server, WebLogic cluster, or Coherence cluster, depending on the targetType specified.
targetType Type of target on which to run the thread dump. This argument can be specified as one of the following:

  • All—(Default) Thread dumps are carried out on all Managed Servers.
  • CoherenceCluster—Specifies that the target consists of all Managed Servers that are associated, either directly or indirectly, with the Coherence cluster specified as the targetName.
  • WebLogicCluster—Specifies that the target consists of all Managed Servers in the WebLogic cluster specified as the targetName.
  • ManagedServer—Specifies that the target is an individual Managed Server.

To deploy the example, complete the following steps:

  1. Make sure you have completed the steps described in Prepare the Example.
  2. Open a command shell and navigate to the ORACLE_HOME/wlserver/server/bin directory, where ORACLE_HOME represents the central support directory for all WebLogic products installed on your machine. For example, C:\Oracle\Middleware.
  3. Set your WebLogic Server environment by entering the following command:

    UNIX or Linux:
    . ./setWLSEnv.sh

    Windows:
    setWLSEnv.cmd
  4. Enter the following command to start WLST:

    java weblogic.WLST
  5. Enter the following command to connect to the Administration Server of the WebLogic domain that is configured with Coherence:

    connect()

    If you omit arguments to the connect command, WLST prompts you for the host name and listen address of the server to which you want to connect, the administrator username, and the administrator password.
  6. Enter the following command to create the thread dump:

    coherenceThreadDump('directory')

    In the preceding command, directory represents the path to an existing directory on your machine in which the thread dump file is to be created. For example, C:\home\coherence.
  7. If you specify only the first argument to the WLST function in the coherence_thread_dump.py script, a thread dump is created on all Managed Servers. Output similar to the following is displayed:
      The Thread Dump for server ms1 
      has been successfully written to /home/coherence/ms1_threaddump.txt
    
      ******************************
      All thread dumps completed.
      Managed server AdminServer, thread dump=/home/coherence/AdminServer_threaddump.txt
      Managed server storage2, thread dump=/home/coherence/storage2_threaddump.txt
      Managed server storage2, thread dump=/home/coherence/storage1_threaddump.txt
      Managed server client2, thread dump=/home/coherence/client2_threaddump.txt
      Managed server client1, thread dump=/home/coherence/client1_threaddump.txt
    
      
    The dump files are named ServerName_threaddump.txt in the directory specified.

    Note: The thread dump is also sent to stdout because this is the default behavior for the threadDump() WLST command.

  8. Optionally, you can try one of the following:

Troubleshooting


Related Topics

(Internet connection required.)


Copyright © 2012, 2020, Oracle and/or its affiliates. All rights reserved.