Submitting a Java batch job

You can submit a job for your Java™ batch application and run that Java batch application on a Liberty server.

Before you begin

Complete the following steps:
  1. Install the Java batch feature for WebSphere® Application Server Developer Tools for Eclipse.

    This feature is optional. You can install it from Help > Install WebSphere Software.

  2. Create a Java batch project.
  3. Create a Java batch job in the Java batch project.
  4. Ensure that your Java batch application is packaged.

    The wizard automatically packages the resulting batch project in a web archive (WAR) file, but you can also package your project in other resources.

  5. Create a Liberty server or create a remote Liberty server and configure it for Java batch applications.
  6. Deploy the resource that contains the batch application to a Liberty server.
    1. Select Window > Show View > Servers.
    2. Right-click the Liberty server and select Add and Remove....

      The Add and Remove wizard displays.

    3. Select the resource that you want to deploy from the Available area to the Configured area by clicking Add >; then, click Finish.
  7. Start the Liberty server.
    1. Select Window > Show View > Servers.
    2. Right-click the Liberty server and select Start.

Procedure

  1. For Java batch projects, in the Enterprise Explorer view, select a Java batch project, and then select src > META-INF > batch-jobs > batch_job.xml.
  2. Right-click the batch_job.xml file.
  3. Select Run As > Java EE Batch Job.
  4. Select the target server on which the Java batch job runs.
  5. Specify the user ID and password of a user who is configured in your Liberty server.

    This user ID is used to submit Java batch jobs.

  6. Optional: In the Job parameters section, enter any job parameters that you defined for your batch application.
    1. Click Add.
    2. The Add Parameter dialog is displayed.
    3. Enter or select the name of the parameter.
    4. Enter the value of the parameter, and then click OK.
    5. Repeat the process to add any additional parameters.
  7. Click Apply and then Run.

Results

You submitted a batch job to your Liberty server so that you can run your Java batch application.

If the job submission is successful, a dialog shows information about the job instance that you submitted, and job execution details.

If the submission fails, a dialog shows possible causes of the problem. If the information provided in the dialog is not sufficient to diagnose the problem, you can check the Error log view to see more details about the failure. You can also check the server logs, which are located in the wlp\usr\servers\<server>\logs directory.


Feedback