Hitachi

uCosminexus Application Server Operation, Monitoring, and Linkage Guide


5.5.7 Stopping a J2EE application

This subsection describes how to use server management commands to stop a J2EE application.

There are five methods of stopping a J2EE application using server management commands as follows:

  1. Executing normal termination by default timeout period

  2. Executing normal termination by setting any timeout period

  3. Executing forced termination when a J2EE application is not stopped with normal termination by default timeout

  4. Executing forced termination when a J2EE application is not stopped by setting any timeout period and executing normal termination

  5. Executing forced termination automatically when a J2EE application is not stopped by setting any timeout period and executing normal termination

When the command is executed in an order other than mentioned above, the command is terminated abnormally. For example, if normal termination is not performed, the command cannot be executed in the forced termination format.

Note that you can execute the above-mentioned process 1., 2., or 5. only once for one J2EE application.

However, forced termination can be executed only in a system where the operation settings of the J2EE server are customized and the system is set in such a way that forced termination is applied. For details on the forced termination settings of J2EE servers, see 5.5.6 Settings for execution environment.

The following processes are executed in the termination process of a J2EE application:

When a J2EE application front is a Web application
  • New requests cannot be received.

  • Requests being processed are kept processing.

  • Within the requests stored in the control queue of concurrently executing number of the Web applications, HTTP503 error is returned only to the requests that are not processed in the Web container.

When a J2EE application front is Enterprise Bean
  • New requests cannot be received.

  • Requests being processed are kept processing.

You cannot invoke the method of Enterprise Beans included in an application that has terminated. If you attempt to invoke this method, the message indicating the stop could not lock string is output in the standard error output of the J2EE server. However, this is not a problem.

The following subsections describe the procedures for executing server management commands for each pattern:

Organization of this subsection

(1) Executing normal termination in default timeout period

The execution procedure, format, and example of the command are described below:

  1. Execute normal termination of a J2EE application.

    Execute the cjstopapp command.

    Execution format
    cjstopapp J2EE-server-name -name J2EE-application-name
    Execution example

    cjstopapp Myserver -name App1

    Note that when the command is executed in default timeout period, the control of the command is returned after 60 seconds even if the stop process is not completed.

  2. Confirm the termination status of the J2EE application when the control of the command is returned by timeout.

    When the control of the command is returned by timeout, the stop process of the J2EE application may not have been completed. Therefore, check the status of the J2EE application when a timeout occurs.

    Check the status of the J2EE application by executing the cjlistapp command of server management commands.

    Execution format
    cjlistapp sever-name
    Execution example

    cjlistapp MyServer

    Either of the following status is output as the status of the J2EE application:

    Table 5‒24: Status of the J2EE application

    The output string

    Meaning of the status

    running

    Start

    stopped

    Terminated

    stopFailure

    Normal termination failure

    forceStopFailure

    Forced termination failure

    blockadeFailure

    Lock failure

    blockading

    Locking

    blockaded

    Locked

    stopping

    Normal termination in-process

    forceStopping

    Forced termination in-process

After executing the procedure, confirm the status of the J2EE server. You need to restart the J2EE server in the following situations:

(2) Setting any timeout period, and executing normal termination

The execution procedure, format, and example of the command are described below:

  1. Execute normal termination of a J2EE application. At that time, set the timeout period for returning the control of the command with the command option.

    Specify the -t option in the cjstopapp command and perform normal termination.

    Execution format
    cjstopapp J2EE-server-name -name J2EE-application-name -t timeout-time
    Execution example

    cjstopapp MyServer -name App1 -t 120

    In this execution example, control of the command is returned after 120 seconds even if the stop process is not completed.

  2. Confirm that the J2EE application is terminated when the control of the command is returned by timeout.

    When the control of the command is returned by timeout, the stop process of the 2EE application may not have been completed. Therefore, check the status of the J2EE application when a timeout occurs.

    Check the status of the J2EE application by executing the cjlistapp command.

    Execution format
    cjlistapp J2EE-server-name
    Execution example

    cjlistapp MyServer

    For details on the contents that are output as the status of J2EE applications, see procedure 2 of the subsection (1) Executing normal termination in default timeout period.

After executing the procedure, confirm the status of the J2EE server. You need to restart the J2EE server in the following situations:

(3) Executing forced termination when a J2EE application is not terminated by executing normal termination in default timeout

The execution procedure, format, and example of the command are described below:

  1. Execute normal termination of a J2EE application.

    Execute the cjstopapp command.

    Execution format
    cjstopapp J2EE-server-name -name J2EE-application-name
    Execution example

    cjstopapp MyServer -name App1

    Note that when the command is executed in default timeout period, the control of the command is returned after 60 seconds even if the stop process is not completed.

  2. Confirm that the J2EE application is terminated when the control of the command is returned by timeout.

    When the control of the command is returned by timeout, the stop process of the 2EE application may not have been completed. Therefore, check the status of the J2EE application when a timeout occurs.

    Check the status of the J2EE application by executing the cjlistapp command.

    Execution format
    cjlistapp J2EE-server-name
    Execution example

    cjlistapp MyServer

    For details on the contents that are output as the status of J2EE applications, see procedure 2 of the subsection (1) Executing normal termination in default timeout period.

  3. Execute forced termination of the J2EE application.

    Execute forced termination when the J2EE application is not stopped by normal termination.

    Specify the -cancel option in the cjstopapp command, and forcefully terminate the J2EE application.

    Execution format
    cjstopapp J2EE-server-name -name J2EE-application-name -cancel
    Execution example

    cjstopapp MyServer -name App1 -cancel

    If forced termination is successful, the request being processed in the J2EE application is aborted and normal termination that was being executed earlier finishes.

After executing the procedure, confirm the status of the J2EE server. You need to restart the J2EE server in the following situations:

(4) Performing forced termination when the J2EE application does not stop even by setting a timeout and executing normal termination

The execution procedure, format, and example of the command are described below:

  1. Execute normal termination of a J2EE application. At that time, set the timeout period for returning the control of the command with the command option.

    Specify the -t option in the cjstopapp command and perform normal termination.

    Execution format
    cjstopapp J2EE-server-name -name J2EE-application-name -t timeout-time
    Execution example

    cjstopapp MyServer -name App1 -t 120

    In this execution example, control of the command is returned after 120 seconds even if the stop process is not completed.

  2. Confirm that the J2EE application is terminated when the control of the command is returned by timeout.

    When the control of the command is returned by timeout, the stop process of the 2EE application may not have been completed. Therefore, check the status of the J2EE application when a timeout occurs.

    Check the status of the J2EE application by executing the cjlistapp command.

    Execution format
    cjlistapp J2EE-server-name
    Execution example

    cjlistapp MyServer

    For details on the contents that are output as the status of J2EE applications, see procedure 2 of the subsection (1) Executing normal termination in default timeout period.

  3. Execute forced termination of the J2EE application.

    Execute forced termination when the J2EE application is not stopped by normal termination.

    Specify the -cancel option in the cjstopapp command, and forcefully terminate the J2EE application.

    Execution format
    cjstopapp J2EE-server-name -name J2EE-application-name -cancel
    Execution example

    cjstopapp Myserver -name App1 -cancel

    If forced termination is successful, the request being processed in the J2EE application is aborted and normal termination that was being executed earlier finishes.

After executing the procedure, confirm the status of the J2EE server. You need to restart the J2EE server in the following situations:

(5) Executing forced termination automatically, when a J2EE application does not terminate by setting a timeout period and executing normal termination

The execution procedure, format, and example of the command are described below:

  1. Terminate the J2EE application with forced termination after timeout.

    In this format, first try to stop the J2EE application normally and if the J2EE application does not stop in the specified timeout, terminate it forcefully.

    Specify the -t option and -force option in the cjstopapp command, and then execute forced termination.

    Execution format
    cjstopapp J2EE-server-name--name J2EE-application-name -t timeout-time -force
    Execution example

    cjstopapp MyServer -name App1 -t 120 -force

After executing the procedure, confirm the status of the J2EE server. You need to restart the J2EE server in the following situations: