uCosminexus Application Server, Expansion Guide
You use the cjexecjob command to start batch applications. When execution of the main method of batch applications ends, a batch server performs full garbage collection. This subsection describes how to start batch applications, and processing for starting and ending the batch applications.
If you want to stop a running batch application, you forcefully stop the batch application. For details on how to forcefully stop the batch applications, see 2.3.3 Forcefully stopping a batch application.
This subsection describes how to start batch applications.
You use the cjexecjob command to start a batch application. You use the following three methods execute the cjexecjob command:
For details on the definitions of JP1/AJS, BJEX and JP1/Advanced Shell jobs that are used when starting a batch application with method 2, 3, and 4, see 2.13 Integrating with JP1/AJ S.
You start a batch server in advance for executing a batch application from JP1/AJS, BJEX, and JP1/Advanced Shell.
If you specify a class name and class path of a batch application in the cjexecjob command, the batch application specified in the cjexecjob command starts. The following processing is executed when you start a batch application:
When starting a batch application, the public static void main(String[]) method or the public static int main(String[]) method of an execution class that is specified in the cjexecjob command is invoked. For method arguments, you set up the arguments specified after class name of the cjexecjob command.
Table 2-3 Conditions where an attempt to start a batch application fails
| Condition where an attempt to starting batch application fails | Message output by batch server |
|---|---|
| An attempt to read usrconf.properties (user property file for batch application) fails. | KDJE55035-E |
| The class specified in the cjexecjob command does not exist. | KDJE55006-E |
| The public static void main(String[]) method or the public static int main(String[]) method is not defined. | |
| Signatures of both the public static void main(String[]) method and the public static int main(String[]) method are different. | |
| java.lang.NoClassDefFoundError occurs when loading a class specified in the cjexecjob command. | KDJE55007-E |
| A class required for invoking the public static void main(String[]) method or the public static int main(String[]) method is not found. | |
| An error occurs in the static{} block. | |
| You cannot execute the main method due to a problem other than those mentioned above. | KDJE55008-E |
The batch application processing ends after execution of the main method is complete. The processing executed at the end a batch application is as follows:
The following table describes the end conditions of batch applications and operations of batch servers and the cjexecjob command during that time.
Table 2-4 End conditions of batch applications
| End condition of batch application | Batch server operation | cjexecjob command operation |
|---|---|---|
| The main method is executed until end. | Outputs the KDJE55002-I message and ends the execution of the batch application. Outputs the KDJE55003-I message after ending the application. | Ends normally. Return value: 0 |
| The return statement is executed using the public static void main(String[]) method. | ||
| return end-code is executed using the public static int main(String[]) method. | Ends normally. Return value: end code specified in return |
|
| A class that inherits java.lang.Throwable or java.lang.Throwable is thrown outside the main method. | Outputs the KDJE55009-E message. Outputs exception stack trace to exception log. Ends execution of the batch application. | Outputs exception stack trace to standard error output. Abnormally ends execution of the batch application. Return value: 1 |
| Batch server terminated (forced termination of batch server or unexpected down of JavaVM). | None. | Outputs the KDJE55021-E message and abnormally ends execution of the batch application. Return value: 1 |
An execution of a batch application does not end even if you end the cjexecjob command by using Ctrl+C or signal during the execution of the batch application. Execute cjkilljob if you want to forcefully stop execution of a batch application. However, if you forcefully stop using the cjkilljob command, the end code of the cjexecjob command is indefinite. For details on the batch forced stop command, see 2.3.3 Forcefully stopping a batch application.
If you invoke and use EJB or DB Connector from batch applications, existence of EJB and DB Connector to be used is not checked when you start the batch applications. If EJB or DB Connector referenced from the batch applications do not exist, a runtime error occurs during the execution of the batch applications. Before starting a batch application, check whether EJB at the reference location exists or not. When connecting to a database from a batch application by using DB Connector, keep the DB Connector started on the batch server.
All Rights Reserved. Copyright (C) 2013, 2015, Hitachi, Ltd.