Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-3409

(7.0.z) When a job listener is not found and the batch fails to start, we cannot detect the error using Batch API.

XMLWordPrintable

    • Hide

      [Step to Reproduce]

      1. Download jboss-eap-7.0.0.Beta-quickstarts.zip from access.redhat.com and extract it.
      2. Use "batch-processing" quickstart.
        $ cd jboss-eap-7.0.0.Beta1-quickstarts/batch-processing
      3. Modify ref attribute of listener element (at line 22) of src/main/resources/META-INF/batch-jobs/import-file.xml from "jobListener" to "jobListener1".
                :
                <listeners>
                    <listener ref="jobListener1" />    <---- here
                </listeners>
                :
        
      4. Start EAP 7 Beta as a standalone server using standalone.xml.
      5. Build, package and deploy the batch-processing quickstart.
        $ mvn clean package wildfly:deploy
      6. Access http://localhost:8080/jboss-batch-processing .
      7. Click on "Generate a new file and start import job" button. The EAP server will print error messages like below.
        18:30:16,554 INFO  [org.jboss.as.quickstarts.batch.controller.BatchController] (default task-8) Starting to generate 10 records in file /tmp/temp-file.txt
        18:30:16,555 INFO  [org.jboss.as.quickstarts.batch.controller.BatchController] (default task-8) File generated at /tmp/temp-file.txt
        18:30:16,670 ERROR [stderr] (Batch Thread - 1) Exception in thread "Batch Thread - 1" java.lang.IllegalStateException: JBERET000600: Failed to create artifact with ref name jobListener1.  Ensure CDI beans.xml is present and batch.xml, if any, is configured properly.
        18:30:16,671 ERROR [stderr] (Batch Thread - 1) 	at org.jberet.runtime.context.JobContextImpl.createArtifact(JobContextImpl.java:185)
        18:30:16,671 ERROR [stderr] (Batch Thread - 1) 	at org.jberet.runtime.runner.JobExecutionRunner.createJobListeners(JobExecutionRunner.java:131)
        18:30:16,671 ERROR [stderr] (Batch Thread - 1) 	at org.jberet.runtime.runner.JobExecutionRunner.run(JobExecutionRunner.java:51)
        18:30:16,671 ERROR [stderr] (Batch Thread - 1) 	at org.wildfly.extension.batch.jberet.impl.BatchEnvironmentService$WildFlyBatchEnvironment$1.run(BatchEnvironmentService.java:173)
        18:30:16,671 ERROR [stderr] (Batch Thread - 1) 	at org.jberet.spi.JobExecutor$1.run(JobExecutor.java:99)
        18:30:16,671 ERROR [stderr] (Batch Thread - 1) 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        18:30:16,671 ERROR [stderr] (Batch Thread - 1) 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        18:30:16,671 ERROR [stderr] (Batch Thread - 1) 	at java.lang.Thread.run(Thread.java:745)
        18:30:16,672 ERROR [stderr] (Batch Thread - 1) 	at org.jboss.threads.JBossThread.run(JBossThread.java:320)
        18:30:16,672 ERROR [stderr] (Batch Thread - 1) Caused by: java.lang.IllegalStateException: JBERET000600: Failed to create artifact with ref name jobListener1.  Ensure CDI beans.xml is present and batch.xml, if any, is configured properly.
        18:30:16,672 ERROR [stderr] (Batch Thread - 1) 	at org.jberet.creation.ArtifactFactoryWrapper.getClassFromBatchXmlOrClassLoader(ArtifactFactoryWrapper.java:65)
        18:30:16,672 ERROR [stderr] (Batch Thread - 1) 	at org.jberet.creation.ArtifactFactoryWrapper.create(ArtifactFactoryWrapper.java:41)
        18:30:16,672 ERROR [stderr] (Batch Thread - 1) 	at org.jberet.runtime.context.JobContextImpl.createArtifact(JobContextImpl.java:183)
        18:30:16,672 ERROR [stderr] (Batch Thread - 1) 	... 8 more
        18:30:16,672 ERROR [stderr] (Batch Thread - 1) Caused by: java.lang.ClassNotFoundException: jobListener1 from [Module "deployment.jboss-batch-processing.war:main" from Service Module Loader]
        18:30:16,673 ERROR [stderr] (Batch Thread - 1) 	at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:205)
        18:30:16,673 ERROR [stderr] (Batch Thread - 1) 	at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:455)
        18:30:16,673 ERROR [stderr] (Batch Thread - 1) 	at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:404)
        18:30:16,673 ERROR [stderr] (Batch Thread - 1) 	at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:385)
        18:30:16,673 ERROR [stderr] (Batch Thread - 1) 	at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:130)
        18:30:16,673 ERROR [stderr] (Batch Thread - 1) 	at org.jberet.creation.ArtifactFactoryWrapper.getClassFromBatchXmlOrClassLoader(ArtifactFactoryWrapper.java:63)
        18:30:16,673 ERROR [stderr] (Batch Thread - 1) 	... 10 more
        

        You can see Batch Status of this batch in "List of Jobs" area of the "Batch Processing" page. The status will be STARTED and Exit Status will be empty.
        Even if you click on "Update Jobs List" button after the error occurred, Batch Status and Exit Status will still be the same.

      [Actual Behavior]

      • Batch Status is STARTED though the batch did not successfully start.
      • There is no way to get the error message above from jBatch (JSR-352) API.

      [Expected Behavior]

      • Batch Status is FAILED after running the batch.
      • We can get the error messages above from jBatch (JSR-352) API, for example, using JobExecution#getExitStatus() or by notification like some sort of a special listener (if possible).
      Show
      [Step to Reproduce] Download jboss-eap-7.0.0.Beta-quickstarts.zip from access.redhat.com and extract it. Use "batch-processing" quickstart. $ cd jboss-eap-7.0.0.Beta1-quickstarts/batch-processing Modify ref attribute of listener element (at line 22) of src/main/resources/META-INF/batch-jobs/import-file.xml from "jobListener" to "jobListener1". : <listeners> <listener ref= "jobListener1" /> <---- here </listeners> : Start EAP 7 Beta as a standalone server using standalone.xml. Build, package and deploy the batch-processing quickstart. $ mvn clean package wildfly:deploy Access http://localhost:8080/jboss-batch-processing . Click on "Generate a new file and start import job" button. The EAP server will print error messages like below. 18:30:16,554 INFO [org.jboss.as.quickstarts.batch.controller.BatchController] (default task-8) Starting to generate 10 records in file /tmp/temp-file.txt 18:30:16,555 INFO [org.jboss.as.quickstarts.batch.controller.BatchController] (default task-8) File generated at /tmp/temp-file.txt 18:30:16,670 ERROR [stderr] (Batch Thread - 1) Exception in thread "Batch Thread - 1" java.lang.IllegalStateException: JBERET000600: Failed to create artifact with ref name jobListener1. Ensure CDI beans.xml is present and batch.xml, if any, is configured properly. 18:30:16,671 ERROR [stderr] (Batch Thread - 1) at org.jberet.runtime.context.JobContextImpl.createArtifact(JobContextImpl.java:185) 18:30:16,671 ERROR [stderr] (Batch Thread - 1) at org.jberet.runtime.runner.JobExecutionRunner.createJobListeners(JobExecutionRunner.java:131) 18:30:16,671 ERROR [stderr] (Batch Thread - 1) at org.jberet.runtime.runner.JobExecutionRunner.run(JobExecutionRunner.java:51) 18:30:16,671 ERROR [stderr] (Batch Thread - 1) at org.wildfly.extension.batch.jberet.impl.BatchEnvironmentService$WildFlyBatchEnvironment$1.run(BatchEnvironmentService.java:173) 18:30:16,671 ERROR [stderr] (Batch Thread - 1) at org.jberet.spi.JobExecutor$1.run(JobExecutor.java:99) 18:30:16,671 ERROR [stderr] (Batch Thread - 1) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 18:30:16,671 ERROR [stderr] (Batch Thread - 1) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 18:30:16,671 ERROR [stderr] (Batch Thread - 1) at java.lang.Thread.run(Thread.java:745) 18:30:16,672 ERROR [stderr] (Batch Thread - 1) at org.jboss.threads.JBossThread.run(JBossThread.java:320) 18:30:16,672 ERROR [stderr] (Batch Thread - 1) Caused by: java.lang.IllegalStateException: JBERET000600: Failed to create artifact with ref name jobListener1. Ensure CDI beans.xml is present and batch.xml, if any, is configured properly. 18:30:16,672 ERROR [stderr] (Batch Thread - 1) at org.jberet.creation.ArtifactFactoryWrapper.getClassFromBatchXmlOrClassLoader(ArtifactFactoryWrapper.java:65) 18:30:16,672 ERROR [stderr] (Batch Thread - 1) at org.jberet.creation.ArtifactFactoryWrapper.create(ArtifactFactoryWrapper.java:41) 18:30:16,672 ERROR [stderr] (Batch Thread - 1) at org.jberet.runtime.context.JobContextImpl.createArtifact(JobContextImpl.java:183) 18:30:16,672 ERROR [stderr] (Batch Thread - 1) ... 8 more 18:30:16,672 ERROR [stderr] (Batch Thread - 1) Caused by: java.lang.ClassNotFoundException: jobListener1 from [Module "deployment.jboss-batch-processing.war:main" from Service Module Loader] 18:30:16,673 ERROR [stderr] (Batch Thread - 1) at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:205) 18:30:16,673 ERROR [stderr] (Batch Thread - 1) at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:455) 18:30:16,673 ERROR [stderr] (Batch Thread - 1) at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:404) 18:30:16,673 ERROR [stderr] (Batch Thread - 1) at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:385) 18:30:16,673 ERROR [stderr] (Batch Thread - 1) at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:130) 18:30:16,673 ERROR [stderr] (Batch Thread - 1) at org.jberet.creation.ArtifactFactoryWrapper.getClassFromBatchXmlOrClassLoader(ArtifactFactoryWrapper.java:63) 18:30:16,673 ERROR [stderr] (Batch Thread - 1) ... 10 more You can see Batch Status of this batch in "List of Jobs" area of the "Batch Processing" page. The status will be STARTED and Exit Status will be empty. Even if you click on "Update Jobs List" button after the error occurred, Batch Status and Exit Status will still be the same. [Actual Behavior] Batch Status is STARTED though the batch did not successfully start. There is no way to get the error message above from jBatch (JSR-352) API. [Expected Behavior] Batch Status is FAILED after running the batch. We can get the error messages above from jBatch (JSR-352) API, for example, using JobExecution#getExitStatus() or by notification like some sort of a special listener (if possible).
    • EAP 7.0.2

      When a job listener specified in a batch XML file is not found and the batch fails to start with error messages, we cannot detect the error using jBatch (JSR-352) API, because after failing to start,

      • Batch Status is STARTED (not FAILED),
      • Exit Status is empty.

      We should be able to detect the error occurrence by Batch Status and to know the details of the error by Exit Status.

              spyrkob Bartosz Spyrko-Smietanko
              rhn-support-myoshida Masato Yoshida
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Created:
                Updated:
                Resolved: