Go to primary content
Oracle® Retail Job Orchestration and Scheduler Oracle® Retail Job Orchestration and Scheduler
Release 16.0.027
E94822-01
  Go To Table Of Contents
Contents

Previous
Previous
 
Next
Next
 

3 Job Admin

This chapter describes the Job Admin functionality.

Job Admin Concepts

Here is a list of the Job Admin features.

  • Provides management and monitoring of batch jobs.

  • Services available to start/restart/monitor jobs programmatically.

  • Monitors executions and logs.

  • Built on JavaEE JSR352 JavaBatch standard and available on WebLogic.

  • GUI to manage/start/restart batch jobs.

  • JavaBatch Runtime Engine to execute job.xml files.

Job Admin Components

The following section includes information about the Job Admin components.

RESTFul Services

This section describes the RESTFul services.

Batch Service

The Batch service is a RESTful service that provides various endpoints to manage batch jobs. Here are the key endpoints in the Batch Service.

Start Job

This endpoint starts a job asynchronously based on a job name and returns the execution ID of the job in the response. If the given job is disabled it throws the exception "Cannot start the disabled Job {jobName}. Enable the Job and start it."

Path: /batch/jobs/<jobName>

HTTP Method: POST

Inputs:

Job Name as path parameter

Job Parameters is a query parameter. Job Parameters is a comma separated list of name value pairs. This is optional.

Sample Request

http://localhost:7001/jos-batch-job-admin/resources/batch/jobs/ShellCommandRunnerJob?jobParameters=key=value

Successful Response

Figure 3-1 Start Job Successful/Error Responses

Surrounding text describes Figure 3-1 .

Error Response in case of disable jobs

JSON
{
        "statusCode": 500, 
        "status": "Internal Server Error",
        "message": "Cannot start the disabled Job {jobName}. Enable the Job 
     and start it.", 
        "stackTrace": "java.lang.RuntimeException:....."
}

Restart Job

This endpoint restarts a job asynchronously using the job execution ID and returns the new job execution ID. If the given job is disabled it throws the exception "Cannot restart the disabled Job {jobName}. Enable the Job and restart."

Path: /batch/jobs/executions/{executionId}

HTTP Method: POST

Inputs: executionId as path parameter

Sample Request

http://localhost:7001/jos-batch-job-admin/resources/batch/jobs/executions/2

Figure 3-2 Start Job Successful/Error Responses

Surrounding text describes Figure 3-2 .

Error Response in case of disable jobs

JSON
{
        "statusCode": 500, 
        "status": "Internal Server Error",
        "message": "Cannot restart the disabled Job {jobName}. Enable the 
                Job and restart.", 
        "stackTrace": "java.lang.RuntimeException:....."
}

Inputs

jobName as path parameter

jobExecutionId as path parameter

Sample Request

http://localhost:7001/jos-batch-job-admin/resources/batch/jobs/ShellCommandRunnerJob/1

Figure 3-3 Inputs Successful/Error Responses

Surrounding text describes Figure 3-3 .

Enable or Disable the jobs

This endpoint enables or disables the jobs using jobId, jobEnableStatus and returns the jobId, status and message.

Path: /batch/jobs/enable-disable

HTTP Method: POST

Inputs

JSON
[
      {
      "jobId": "Diff_Fnd_DownloaderAndTransporterToRxmJob",
      "jobEnableStatus": "false"
   },
      {
      "jobId": "CodeHead_Fnd_DownloaderAndTransporterToSimJob",
      "jobEnableStatus": "true"
   }
]

Sample Request

http://localhost:7001/bdi-batch-job-admin/resources/batch/jobs/enable-disable

Successful Response

JSON
[
      {
      "jobId": "DiffGrp_Fnd_DownloaderAndTransporterToSimJob",
      "jobEnableStatus": "DISABLED",
      "message": "Job Disabled Successfully"
   },
  {
      "jobId": "CodeHead_Fnd_DownloaderAndTransporterToSimJob",
      "jobEnableStatus": "ENABLED",
      "message": "Job Enabled Successfully"
   }
]

System Setting Service

See Appendix A for details about System Setting Service.

Job Metrics Service

Job Metrics service provides an end point that produces metrics for jobs based on time range.

Path: /telemetry/jobs

HTTP Method: GET

Inputs: fromTime as query parametertoTime as a query parameter

Sample Response

{
     "data-requested-at": "2017-10-09T10:49:57.208-06:00",
     "data-requested-from-time": "2017-10-08T10:49:57.197-06:00",
     "data-requested-to-time": "2017-10-09T10:49:57.197-06:00",
     "jobs-server-runtime-info": {
         "id": "bdi-rms-batch-job-admin.war",
         "app-type": "BDI",
         "app-status": "RUNNING",
         "up-since": 1642,
         "total-jobs-count": 1,
         "total-executions-count": 4,
         "successful-executions-count": 0,
         "failed-executions-count": 4,
         "job": [
             {
                 "name": "ShellCommandRunnerBatchlet",
                 "slowest-run-duration": 0,
                 "fastest-run-duration": 0,
                 "avg-run-duration": 0,
                 "executions": {
                     "execution_count": 4,
                     "success_count": 0,
                     "failure_count": 4,
                     "execution": [
                         {
                             "execution-id": 121,
                             "instance_id": 121,
                             "status": "FAILED",
                             "startTime": "2017-10-09T10:06:43-06:00",
                             "endTime": "2017-10-09T10:06:43-06:00",
                             "step": [
                                 {
                                     "step-execution-id": 121,
                                     "name": "shellCmd",
                                     "duration": 0,
                                     "status": "FAILED"
                                 }
                             ]
                         },
                         {
                             "execution-id": 122,
                             "instance_id": 122,
                             "status": "FAILED",
                             "startTime": "2017-10-09T10:07:36-06:00",
                             "endTime": "2017-10-09T10:07:36-06:00",
                             "step": [
                                 {
                                     "step-execution-id": 122,
                                     "name": "shellCmd",
                                     "duration": 0,
                                     "status": "FAILED"
                                 }
                             ]
                         },
                         {
                             "execution-id": 123,
                             "instance_id": 123,
                             "status": "FAILED",
                             "startTime": "2017-10-09T10:08:20-06:00",
                             "endTime": "2017-10-09T10:08:20-06:00",
                             "step": [
                                 {
                                     "step-execution-id": 123,
                                     "name": "shellCmd",
                                     "duration": 0,
                                     "status": "FAILED"
                                 }
                             ]
                         },
                         {
                             "execution-id": 124,
                             "instance_id": 124,
                             "status": "FAILED",
                             "startTime": "2017-10-09T10:13:20-06:00",
                             "endTime": "2017-10-09T10:13:20-06:00",
                             "step": [
                                 {
                                     "step-execution-id": 124,
                                     "name": "shellCmd",
                                     "duration": 0,
                                     "status": "FAILED"
                                 }
                             ]
                         }
                     ]
                 }
             }
         ]
     }
}

Job Admin UI

The Job Admin UI provides functionality to manage and monitor jobs. The Job Admin UI is described in detail in Appendix A.

Best Practices

Best practices include:

  • Use Batchlet if a job must run a script or program that resides locally.

  • Use ItemReader, ItemWriter, and so on, if a job requires more control over the processing of data. Chunk processing allows data to be processed in chunks, and, if a job fails, it can only process the remaining chunks during a restart.

  • Use job parameters to dynamically pass parameters to a job.

  • Use PartitionMapper to specify the number of partitions and the threads for chunk processing so that all data is processed concurrently.

Job Admin Security

Both Job Admin UI and REST Services are secured with SSL and basic authentication. The following roles are defined to restrict access to operations in Job Admin.

  • JobAdminRole

  • JobOperatorRole

  • JobMonitorRole

Batch jobs can be run from the Job Admin UI or through the Batch REST service. Here are the operations that can be performed by the users based on their roles.

Table 3-1 Job Admin Functions and Roles

Function Admin Role Operator Role Monitor Role

Edit configuration from UI

Yes

No

No

Create/update/delete system options

Yes

No

No

Create/update/delete system credentials

Yes

No

No

View credentials

Yes

No

No

Run jobs

Yes

Yes

No

Monitor jobs

Yes

Yes

Yes


Job Admin Customization

During the deployment of Job Admin, seed data is loaded to various tables. Seed data files are located in the jos-<app>-home/setup-data/dml folder. If seed data is changed, Job Admin must be reinstalled and redeployed. In order to load seed data again during the redeployment, the LOADSEEDDATA flag in the BDI_SYSTEM_OPTIONS table must be set to TRUE.

During the deployment, Job XMLs get loaded to BDI_JOB_DEFINITION table. Job XML files are located in the "jos-job-home/setup-data/META-INF/batch-jobs" folder. If job xmls are changed, Job Admin must be reinstalled and redeployed. In order to load job xmls during redeployment, the LOADJOBDEF flag in the BDI_SYSTEM_OPTIONS table must be set to TRUE.


Note:

Restart of job does not load job definition from the BDI_JOB_DEFINITION table. Java Batch loads job xml from JOBSTATUS table during the restart of a job.

If there is an issue with Job XML, job needs to be started after fixing the job XML.


Job Admin Troubleshooting

This section describes the Job Admin errors and troubleshooting.

Deployment Error

Issue: Job Admin deployment can encounter this error if the database credentials are invalid:

Caught: javax.management.RuntimeMBeanException: java.lang.RuntimeException: weblogic.management.provider.EditFailedException: java.lang.NullPointerException

javax.management.RuntimeMBeanException: java.lang.RuntimeException: weblogic.management.provider.EditFailedException: java.lang.NullPointerException

at weblogic.utils.StackTraceDisabled.unknownMethod()

Caused by: java.lang.RuntimeException: weblogic.management.provider.EditFailedException: java.lang.NullPointerException

1 more

Caused by: weblogic.management.provider.EditFailedException:

java.lang.NullPointerException

1 more

Caused by: java.lang.NullPointerException

1 more

Solution:

Undo all changes in the WebLogic domain session. Redeploy the application, setting up new credentials and verifying that the deployment has been successful.

Runtime WSMException

Issue: Log files contain this exception:

oracle.wsm.common.sdk.WSMException: WSM-07620 : Agent cannot enforce policies due to either failure in retrieving policies or error in validations, detail= "WSM-02557 The documents required to configure the Oracle Web Services Manager runtime have not been retrieved from the Policy Manager application (wsm-pm), possibly because the application is not running or has not been deployed in the environment. The query "&(@appliesTo~="REST-CLIENT()")(policysets:global:%)" is queued for later retrieval.

Solution: Follow the BDI Installation guide and verify that the WSM- policy manager is configured for the admin server URL.

Open the WebLogic domain console and target the wsm-pm application to Admin Server. Bounce Admin server and verify that the wsm-pm application is in an active state.

Job Fails and Job Admin Log Files Contain No Details of the Failure

Issue: A job fails and the Job Admin log files contain no evidence of or details about the failure.

Solution: Examine the WebLogic server log files to identify the root cause of the job failure. A possible root cause is the improper data source configuration.

Job Admin UI Throwing Error: Job XML Not Found

Issue: Log files contain this exception:

Caused By: javax.ejb.EJBException: EJB Exception: : java.lang.RuntimeException: Could not find jobName(ShellCommandRunnerBatchlet) xml file. You may have renamed the job file or your job repository has more jobs than your application. To resolve the issue either delete the job repository or add the correct job xml file to the app.

Solution: The job has been deleted from the jos-job-home before redeployment. Either add the missing job XML or delete the execution records of the job from the batch database.

Job Admin UI Throwing Error: Table or View Doesn't Exists

Issue: Log files contain this exception:

<Error> <javax.enterprise.resource.webcontainer.jsf.application> <BEA-000000> <Error Rendering View[/index.xhtml] javax.el.ELException: /index.xhtml @15,84 value="#{batchSummaryRequestBean.refreshPage}": javax.ejb.EJBException: EJB Exception: : com.ibm.jbatch.container.exception.PersistenceException: java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist

Solution: BatchInfrastructure database is not pointing to a valid schema. Check if the schema has the following tables: CHECKPOINTDATA, STEPEXECUTIONINSTANCEDATA, STEPSTATUS, EXECUTIONINSTANCEDATA, JOBINSTANCEDATA, JOBSTATUS. If not, then run the DDL:

$Oracle_Home/oracle_common/common/sql/wlsservices/batch/oracle/jbatch.sql

IO Exception or Permissions Issue On Running A Shell Runner Job

Issue: java.io.IOException: Cannot run program "./TestShell1.sh" (in directory "/u00/webadmin/16.1.0/Scripts"): error=13, Permission denied

Solution: Check if the script the job is running is present in the specified location or not.

Check if the required permissions are provided for running the script.

Missing Credentials Access Permission

Issue: Caused by: java.lang.RuntimeException: Cannot get the Credential Map with the specified appLevelKeyPartitionName(DEFAULT_KEY_PARTITION_NAME).at com.oracle.retail.integration.common.security.credential.CredentialStoreManager.getAllUserNameAliases(CredentialStoreManager.java:1171) ~[retail-public-security-api-16.1.0.jar:?]Caused by: java.security.AccessControlException: access denied ("oracle.security.jps.service.credstore.CredentialAccessPermission" "context=SYSTEM,mapName=DEFAULT_KEY_PARTITION_NAME,keyName=*" "read")

Solution: Verify weblogic.policy file. The credential access permissions should be added for the domain where the applications are deployed. Add the permissions and restart the Admin and managed server.

Missing System Credentials

Issue: Caused by: java.lang.IllegalArgumentException: alias(processCallBackServiceUrlUserAlias) not found in the credential store.

Solution: Add the system credentials using the UI or REST service.

Missing System Options

Issue: 2017-03-31T02:49:42,628 [Thread-132] DEBUG Logger$debug - Starting job: null/resources/batch/jobs/DiffGrp_Fnd_ExtractorJob 2017-03-31T02:49:42,658 [Thread-132] ERROR Logger$error$0 - Error calling activity. java.lang.NullPointerException: Cannot invoke method getBytes() on null object

Solution: Add the system options using the UI or ReST service.