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

[GSS](7.1.0) Unable to load job xml in jar files inside WAR (and EAR)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.1.0.DR9
    • 7.0.2.GA
    • Batch
    • None
    • Workaround Exists
    • Hide

      Add META-INF/services/org.jberet.spi.JobXmlResolver with the following content to your batch jar file:

      org.jberet.tools.MetaInfBatchJobsJobXmlResolver
      
      Show
      Add META-INF/services/org.jberet.spi.JobXmlResolver with the following content to your batch jar file: org.jberet.tools.MetaInfBatchJobsJobXmlResolver
    • Hide

      batch-jar-in-war

      1. Extract batch-jar-in-war.zip
      2. cd batch-jar-in-war/batch-jar/ then execute mvn clean install
      3. cd batch-jar-in-war/batch-war/ then execute mvn clean package wildfly:deploy
      4. Access web app: http://localhost:8080/batch-jar-in-war/index.jsf
      5. Click the Exec button to invoke a batch job in JAR or WAR.

      Then, you will see "javax.batch.operations.JobStartException: JBERET000601: Failed to get job xml file for job batchInJar.xml" when executing a batch job in jar inside WAR.

      batch-jar-in-ear

      1. Extract batch-jar-in-ear.zip
      2. cd batch-jar-in-ear/ then execute mvn clean install wildfly:deploy
      3. Access web app: http://localhost:8080/batch-jar-in-ear/index.jsf
      4. Click the Exec button to invoke a batch job in JAR or WAR.

      Then, you will see "javax.batch.operations.JobStartException: JBERET000601: Failed to get job xml file for job batchInJar.xml" when executing a batch job in jar inside EAR.

      Show
      batch-jar-in-war 1. Extract batch-jar-in-war.zip 2. cd batch-jar-in-war/batch-jar/ then execute mvn clean install 3. cd batch-jar-in-war/batch-war/ then execute mvn clean package wildfly:deploy 4. Access web app: http://localhost:8080/batch-jar-in-war/index.jsf 5. Click the Exec button to invoke a batch job in JAR or WAR. Then, you will see "javax.batch.operations.JobStartException: JBERET000601: Failed to get job xml file for job batchInJar.xml" when executing a batch job in jar inside WAR. batch-jar-in-ear 1. Extract batch-jar-in-ear.zip 2. cd batch-jar-in-ear/ then execute mvn clean install wildfly:deploy 3. Access web app: http://localhost:8080/batch-jar-in-ear/index.jsf 4. Click the Exec button to invoke a batch job in JAR or WAR. Then, you will see "javax.batch.operations.JobStartException: JBERET000601: Failed to get job xml file for job batchInJar.xml" when executing a batch job in jar inside EAR.

      META-INF/batch-jobs/batchInJar.xml in a batch jar file inside WAR is ignored and never loaded. This resulted in "javax.batch.operations.JobStartException: JBERET000601: Failed to get job xml file for job batchInJar.xml" when executing a batch job in jar inside WAR.

      Here's an example directory structure of the war file and the jar file included in the war file:

      [1] batch-jar-in-war.war
          |-- index.xhtml
          |-- META-INF
          |   `-- MANIFEST.MF
          `-- WEB-INF
              |-- classes
              |   |-- ...
              |   `-- META-INF
              |       `-- batch-jobs
              |           `-- batchInWar.xml <-- This job xml works
              |-- faces-config.xml
              |-- lib
              |   `-- simpleBatch-1.0.jar --- [2]
              `-- web.xml
      
      [2] simpleBatch-1.0.jar
          |-- META-INF
          |   |-- batch-jobs
          |   |   `-- batchInJar.xml  <-- This job xml is unable to load
          |-- processor
          |   `-- ...
          |-- reader
          |   `-- ...
          |-- service
          |   `-- ...
          `-- writer
              `-- ...
      

      It appears that org.wildfly.extension.batch.jberet.deployment.BatchEnvironmentProcessor and org.wildfly.extension.batch.jberet.deployment.WildFlyJobXmlResolver are never invoked for batch jar files under WAR's WEB-INF/lib. And same applies to batch jar files under EAR's lib. Therefore, any job xml in META-INF/batch-jobs is not scanned for such batch jar files.

      A same issue was reported in WFLY-4988.

        1. batch-jar-in-ear_customlib.zip
          92 kB
        2. batch-jar-in-ear.zip
          84 kB
        3. batch-jar-in-war.zip
          63 kB
        4. batch-jar-only-in-war.zip
          65 kB

              jperkins-rhn James Perkins
              rhn-support-mmiura Masafumi Miura
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: