bea.com | products | dev2dev | support | askBEA
 Download Docs   Site Map   Glossary 
Search

Administration Console Online Help

 Previous Next Contents Index  

Startup and Shutdown Classes

You can use startup and shutdown classes to configure a WebLogic Server to perform tasks when you start or gracefully shut down the server. A startup class is a Java program that is automatically loaded and executed when a WebLogic Server is started or restarted.

By default, startup classes are loaded and executed after all other server subsystems have initialized and after the server deploys modules. For any startup class, you can override the default and specify that the server loads and executes it after the server deploys JDBC connection pools and before it deploys Web applications and EJBs.

A shutdown class is a Java program that is automatically loaded and executed when the WebLogic Server is shut down either from the Administration Console or the weblogic.admin shutdown command. For more information about when a server invokes startup and shutdown classes, refer to "Server Lifecycle."

To use startup or shutdown classes, you must configure and assign them to servers or clusters.

The following sections describe how to use startup and shutdown classes:

 


Configuring a Server to Use a Startup or Shutdown Class: Main Steps

To configure a server instance to use a startup or shutdown class, complete the following tasks:

  1. Configure a Startup or Shutdown Class or Clone a Configuration of a Startup or Shutdown Class.
  2. Assign a Startup or Shutdown Configuration to Servers or Clusters.
  3. Add the Class to the Server's Classpath.

Configure a Startup or Shutdown Class

  1. In the left pane, expand the Deployments folder.
  2. Click on the name of the Startup & Shutdown folder. (See Figure 6-1.)

    Figure 6-1 Click on the Name of the Startup & Shutdown Folder


     

    The Administration Console displays the Startup & Shutdown page. This page includes a list of the configurations that already exist in this domain. If any existing configuration is similar to the one that you want to create, consider cloning it. For more information, refer to Clone a Configuration of a Startup or Shutdown Class.

  3. On the Startup & Shutdown page, do one of the following:

    The Administration Console displays the set of tabs that you use to configure a startup or shutdown class.

  4. Enter values in the Name, Class Name, Deployment Order, and Arguments attribute fields. For more information about each field, refer to Attributes for startup classes or Attributes for shutdown classes.

    In the Arguments field, separate multiple arguments with a comma. For example,
    firstname=MyFirst,lastname=MyLast

    Do not use spaces to separate the arguments; use only a comma.

  5. Select any other configuration options.
  6. Click Create.

    The Administration Console adds your new configuration under the Startup & Shutdown node in the left pane.

  7. If you want to add a note that describes your configuration, click the Notes tab. Enter a note and click Apply.

When you are ready to make the configured class available to one or more servers, refer to Assign a Startup or Shutdown Configuration to Servers or Clusters.

Clone a Configuration of a Startup or Shutdown Class

  1. In the left pane, click the Startup & Shutdown node.

    The Administration Console displays the Startup & Shutdown page. This page displays a list of the configurations that already exist in this domain.

  2. On the Startup & Shutdown page, click the Clone icon in the row of the class you want to clone.

    The Administration Console displays the set of tabs that you use to configure a startup or shutdown class.

  3. Enter a value in the Name field.
  4. You can modify any of the values in the Class Name, Deployment Order, and Arguments attribute fields. You can also change the setting for the Abort Startup on Failure checkbox.
  5. Click Clone to create a configuration with the name that you specified in the Name field.

    The Administration Console adds your new configuration under the Startup & Shutdown node in the left pane.

  6. If you want to add or modify a note that describes your configuration, click the Notes tab. Enter a note and click Apply.

When you are ready to make the new configuration class available to one or more servers, refer to Assign a Startup or Shutdown Configuration to Servers or Clusters.

Assign a Startup or Shutdown Configuration to Servers or Clusters

  1. In the left pane, expand the Startup & Shutdown folder and click a configuration.

    The Administration Console displays the configuration in the right pane.

  2. In the right pane, click the Target and Deploy tab.

    If you have configured a cluster for the domain, the Target and Deploy tab displays a Clusters table, which lists all servers that are assigned to the cluster.

  3. To assign a startup or shutdown class to servers that are in a cluster, do the following:
    1. On the Target and Deploy tab, in the Clusters table, select the check box next to the cluster.
    2. To assign the class to all servers in the cluster, click the All Servers in the Cluster button. (See Figure 6-2.)
    3. To assign the class only to one or more specific servers, click the Part of the Cluster button. Then select the servers you want to target.

    When you deploy to all or part of a cluster, the Administration Console initiates a two-phase deployment. In general, such a deployment ensures that if the deployment fails for one active server, it fails for all active servers. For more information, refer to "Introduction to Two-Phase Deployment" and "Guidelines for Deploying to a Cluster."

    Figure 6-2 Deploy to an Entire Cluster


     

  4. To assign the startup or shutdown class to servers that are not in a cluster, in the Independent Servers table, select one or more servers.

    If the deployment fails for one server, the Administration Console reports the error but continues deploying on any remaining servers that you selected.

  5. Click Apply.
  6. If you have not already done so, Add the Class to the Server's Classpath.

    Note that clicking Apply sets the value of the Server (or Cluster)—>Deployments—>Startup/Shutdown list for each server or cluster that you specified.

Add the Class to the Server's Classpath

The startup or shutdown class must be on the classpath of each server to which it is assigned. To add a class to a server's classpath, do one of the following:

 


Modify an Existing Startup or Shutdown Configuration

  1. In the left pane, expand the Startup & Shutdown node and click a configuration.

    The Administration Console displays the configuration in the right pane.

  2. On the Configuration tab, modify any of the values in the Class Name, Deployment Order, and Arguments attribute fields. You can also change the settings for the Failure is fatal or Run before application deployments checkboxes.
  3. Click Apply to save any changes.
  4. On the Notes tab, modify or add a note.
  5. Click Apply to save any changes.
  6. On the Targets tab reassign the configuration to different clusters or servers. To remove the configuration from a target, select the target in the Chosen column and click the mover control to move it to the Available column.
  7. Click Apply to save any changes.

 


Delete a Startup or Shutdown Class Configuration

  1. In the left pane, click the Startup & Shutdown node.

    The Administration Console displays the Startup & Shutdown page. This page displays a list of the configurations that already exist in this domain.

  2. On the Startup & Shutdown page, click the Delete icon in the row of a configuration.

    A dialog displays in the right pane asking you to confirm your deletion request.

  3. Click Yes to delete the configuration.

 

Back to Top Previous Next