"javax.batch.operations.NoSuchJobException: WFLYBATCH000005: The job name '<batch-job-name>' was not found for the deployment" happens when querying batch jobs in a sub-deployment or libary jar in EAP 7.0.x/7.1.x

Solution Unverified - Updated

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 7.0.x
    • 7.1.x

Issue

As mentioned in this knowledge article, we are now able to start a batch job in a sub-deployment or library jar after upgrading to EAP 7.0.6 or later.

However, javax.batch.operations.NoSuchJobException: WFLYBATCH000005: The job name '<batch-job-name>' was not found for the deployment. happens when the application queries the batch job by executing Content from docs.oracle.com is not included.javax.batch.operations.JobOperator API like javax.batch.operations.JobOperator#getJobInstance().

javax.batch.operations.NoSuchJobException: WFLYBATCH000005: The job name '<batch-job-name>' was not found for the deployment.
   at org.wildfly.extension.batch.jberet.deployment.JobOperatorService.validateJob(JobOperatorService.java:404)
   at org.wildfly.extension.batch.jberet.deployment.JobOperatorService.getJobInstance(JobOperatorService.java:282)
   at org.jberet.operations.DelegatingJobOperator.getJobInstance(DelegatingJobOperator.java:87)
   at com.redhat.jboss.support.example.service.BatchService.getJobName(BatchService.java:26)
   at com.redhat.jboss.support.example.controller.BatchTestController.getJobName(BatchTestController.java:57)
   ....

Resolution

  • This issue will be fixed in EAP 7.2.0 or later. Once EAP 7.2.0 is released, please upgrade.
  • Until EAP 7.2.0 is released, package a job xml within your application archive instead of a library jar.

Root Cause

Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.