9 Replies Latest reply on Nov 6, 2017 1:17 PM by cfang

    Failed to create artifact with ref name jasperReportsBatchlet

    richardmoore

      I pulled down the test artifacts for the jasterReportsTest and am getting -

       

      java.lang.IllegalStateException: JBERET000600: Failed to create artifact with ref name jasperReportsBatchlet.  Ensure CDI beans.xml is present and batch.xml, if any, is configured properly.

      at org.jberet.runtime.context.JobContextImpl.createArtifact(JobContextImpl.java:194) ~[jberet-core-1.3.0.Beta3.jar:1.3.0.Beta3]

      at org.jberet.runtime.runner.AbstractRunner.createArtifact(AbstractRunner.java:156) ~[jberet-core-1.3.0.Beta3.jar:1.3.0.Beta3]

      at org.jberet.runtime.runner.BatchletRunner.run(BatchletRunner.java:66) [jberet-core-1.3.0.Beta3.jar:1.3.0.Beta3]

      at org.jberet.runtime.runner.StepExecutionRunner.runBatchletOrChunk(StepExecutionRunner.java:229) [jberet-core-1.3.0.Beta3.jar:1.3.0.Beta3]

      at org.jberet.runtime.runner.StepExecutionRunner.run(StepExecutionRunner.java:147) [jberet-core-1.3.0.Beta3.jar:1.3.0.Beta3]

      at org.jberet.runtime.runner.CompositeExecutionRunner.runStep(CompositeExecutionRunner.java:164) [jberet-core-1.3.0.Beta3.jar:1.3.0.Beta3]

      at org.jberet.runtime.runner.CompositeExecutionRunner.runFromHeadOrRestartPoint(CompositeExecutionRunner.java:88) [jberet-core-1.3.0.Beta3.jar:1.3.0.Beta3]

      at org.jberet.runtime.runner.JobExecutionRunner.run(JobExecutionRunner.java:60) [jberet-core-1.3.0.Beta3.jar:1.3.0.Beta3]

      at org.jberet.spi.JobExecutor$1.run(JobExecutor.java:99) [jberet-core-1.3.0.Beta3.jar:1.3.0.Beta3]

      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_121]

      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_121]

      at java.lang.Thread.run(Thread.java:745) [?:1.8.0_121]

      Caused by: java.lang.IllegalStateException: JBERET000600: Failed to create artifact with ref name jasperReportsBatchlet.  Ensure CDI beans.xml is present and batch.xml, if any, is configured properly.

      at org.jberet.creation.ArtifactFactoryWrapper.getClassFromBatchXmlOrClassLoader(ArtifactFactoryWrapper.java:65) ~[awg-jberet-framework.jar:?]

      at org.jberet.creation.ArtifactFactoryWrapper.create(ArtifactFactoryWrapper.java:41) ~[awg-jberet-framework.jar:?]

      at org.jberet.runtime.context.JobContextImpl.createArtifact(JobContextImpl.java:192) ~[jberet-core-1.3.0.Beta3.jar:1.3.0.Beta3]

      ... 11 more

      Caused by: java.lang.ClassNotFoundException: jasperReportsBatchlet

      at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[?:1.8.0_121]

      at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:1.8.0_121]

      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) ~[?:1.8.0_121]

      at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:1.8.0_121]

      at org.jberet.creation.ArtifactFactoryWrapper.getClassFromBatchXmlOrClassLoader(ArtifactFactoryWrapper.java:63) ~[awg-jberet-framework.jar:?]

      at org.jberet.creation.ArtifactFactoryWrapper.create(ArtifactFactoryWrapper.java:41) ~[awg-jberet-framework.jar:?]

      at org.jberet.runtime.context.JobContextImpl.createArtifact(JobContextImpl.java:192) ~[jberet-core-1.3.0.Beta3.jar:1.3.0.Beta3]

      ... 11 more

        • 1. Re: Failed to create artifact with ref name jasperReportsBatchlet
          cfang

          Are you talking about this test: org.jberet.support.io.JasperReportsTest ?

           

          I just ran these tests with no problem, in my local workspace.

           

          If you were running this in your own test environment, make sure you have META-INF/beans.xml in your test application.  The error suggests WELD failed to find the CDI bean jasperReportsBatchlet.

           

          A workaround is to add a META-INF/batch.xml in your application to declare all the batch artifacts.

           

          I remember there are similar problems and discussions before and if you search inside this forum, you may find more info.  For example, Failed to create artifact with ref name restItemReader.

          • 2. Re: Failed to create artifact with ref name jasperReportsBatchlet
            richardmoore

            I have META-INF/batch.xml with the following content. What is the class for the jasperReportsBatchlet so I can put it in my batch.xml to see if it works then?

             

            <batch-artifacts xmlns="http://xmlns.jcp.org/xml/ns/javaee">

            <ref id="sendMessage" class="com.awginc.batch.system.smtp.batchlet.SendSmtpMessageBatchlet"/>

            <ref id="addJar" class="com.awginc.batch.system.batchlet.classpath.LoadClasspathEntriesBatchlet"/>

            <ref id="cobolToBeanConverter" class="com.awginc.batch.system.batchlet.cobol.CobolToBeanConverterBatchlet" />

            <ref id="beanIOCollectionItemWriter" class="org.jberet.support.io.BeanIOCollectionItemWriter" />

            <ref id="vfsDelivery" class="com.awginc.batch.system.vfs.batchlet.VfsDeliveryBatchlet"/>

            <ref id="vfsPickup" class="com.awginc.batch.system.vfs.batchlet.VfsPickupBatchlet"/>

            <ref id="javascript" class="com.awginc.batch.system.batchlet.javascript.JavascriptProcessor"/>

            <ref id="fileDataToList" class="com.awginc.batch.system.batchlet.file.ReadFileDataToTransientDataBatchlet"/>

            <ref id="initializeTransientVariable" class="com.awginc.batch.system.batchlet.variable.InitializeTransientDataVariableBatchlet"/>

            <ref id="jdbcSubstitutionItemReader" class="com.awginc.batch.system.chunk.jdbc.VariableSubstitutionJdbcItemReader"/>

            <ref id="jdbcSqlFromFileItemReader" class="com.awginc.batch.system.batchlet.jdbc.SqlFromFileJdbcItemReader"/>

            <ref id="deleteFile" class="com.awginc.batch.system.batchlet.file.DeleteFileBatchlet"/>

            <ref id="renameFile" class="com.awginc.batch.system.batchlet.file.RenameFileBatchlet"/>

            <ref id="moveFile" class="com.awginc.batch.system.batchlet.file.MoveFileBatchlet"/>

            <ref id="copyFile" class="com.awginc.batch.system.batchlet.file.CopyFileBatchlet"/>

            <ref id="sortFile" class="com.awginc.batch.system.batchlet.file.SortFileBatchlet"/>

            <ref id="createFile" class="com.awginc.batch.system.batchlet.file.CreateFileBatchlet"/>

            <ref id="fileDiff" class="com.awginc.batch.system.batchlet.file.DiffFilesBatchlet" />

            <ref id="appendFiles" class="com.awginc.batch.system.batchlet.file.AppendFilesBatchlet" />

            <ref id="testFile" class="com.awginc.batch.system.batchlet.file.FileTestBatchlet" />

            <ref id="deliverFileToFpe" class="com.awginc.batch.system.batchlet.fpe.DeliverToFpeBatchlet" />

            <ref id="cobolItemReader" class="com.awginc.batch.system.chunk.file.cobol.CobolItemReader"/>

            <ref id="listDirectoryItemReader" class="com.awginc.batch.system.chunk.file.DirectoryFileItemReader"/>

            <ref id="listDirectoryItemWriter" class="com.awginc.batch.system.chunk.file.DirectoryFileItemWriter"/>

            <ref id="createDirectory" class="com.awginc.batch.system.batchlet.directory.CreateDirectoryBatchlet"/>

            <ref id="deleteDirectory" class="com.awginc.batch.system.batchlet.directory.DeleteDirectoryBatchlet"/>

            <ref id="moveFileToGdg" class="com.awginc.batch.system.batchlet.gdg.MoveFileToGdgBatchlet"/>

            <ref id="copyFileToGdg" class="com.awginc.batch.system.batchlet.gdg.CopyFileToGdgBatchlet"/>

            <ref id="gdgRollUp" class="com.awginc.batch.system.batchlet.gdg.RollupGdgBatchlet"/>

            <ref id="createGdgBase" class="com.awginc.batch.system.batchlet.gdg.CreateGdgBaseBatchlet"/>

            <ref id="createEmptyGdgGeneration" class="com.awginc.batch.system.batchlet.gdg.CreateEmptyGenerationBatchlet"/>

            <ref id="createSeedGdg" class="com.awginc.batch.system.batchlet.gdg.CreateSeedGdgBatchlet"/>

            <ref id="testGdg" class="com.awginc.batch.system.batchlet.gdg.GdgTestBatchlet"/>

            <ref id="jobStatsListener" class="com.awginc.batch.system.listener.JobStatsListener"/>

            <ref id="restartJobListener" class="com.awginc.batch.system.listener.JobRestartListener"/>

            <ref id="cawaStepListener" class="com.awginc.batch.system.listener.CawaStepListener"/>

            <ref id="cawaJobListener" class="com.awginc.batch.system.listener.CawaJobListener"/>

            <ref id="stepStatsListener" class="com.awginc.batch.system.listener.StepStatsListener"/>

            <ref id="jobStepListener" class="com.awginc.batch.system.listener.JobStepListener"/>

            <ref id="restart" class="com.awginc.batch.system.decider.RestartDecider"/>

            </batch-artifacts>

            • 3. Re: Failed to create artifact with ref name jasperReportsBatchlet
              cfang

              org.jberet.support.io.JasperReportsBatchlet

               

              JasperReportsBatchlet (jberet-support 1.3.0.Beta4 API)

              • 4. Re: Failed to create artifact with ref name jasperReportsBatchlet
                richardmoore

                I am on Beta3,  what version should I be on - which version is the most stable? What jars do I need to pick up from maven to run stand alone?

                • 5. Re: Failed to create artifact with ref name jasperReportsBatchlet
                  cfang

                  The last time org.jberet.support.io.JasperReportsBatchlet was updated was Oct 2014.  So I think jberet-support 1.3.0.Beta3 should work as well.  The difference between Beta3 and Beta6 for jberet-support is probably insignificant.

                   

                  To use jasper reports, from looking at jberet-support pom.xml, the only additional dependency is

                   

                  <dependency>
                    <groupId>net.sf.jasperreports</groupId>
                    <artifactId>jasperreports</artifactId>
                    <version>6.1.0</version>
                  </dependency>

                   

                  the version 6.1.0 is what I have in pom.xml, and used in tests.  We haven't tested with more recent versions of jasperreports.

                  • 6. Re: Failed to create artifact with ref name jasperReportsBatchlet
                    richardmoore

                    Here is what I found. When I changed my version of jasperreports to the 6.1.0 version the jasperReportsBatchlet was found and ran.

                    • 7. Re: Failed to create artifact with ref name jasperReportsBatchlet
                      richardmoore

                      I noticed that unlike chunk writers there is no logging for the output filename so it does not look like the step even ran but it does. Can you add that to the batchlet?

                      • 8. Re: Failed to create artifact with ref name jasperReportsBatchlet
                        cfang

                        Good point.  I created teh following jira for this issue:

                        1. JBERET-361

                        Add logging to org.jberet.support.io.JasperReportsBatchlet

                        • 9. Re: Failed to create artifact with ref name jasperReportsBatchlet
                          cfang

                          Interesting.  I'll try it with more recent versions of jasperreports.  If all works, we should upgrade teh project dependency version just to keep up with new releases of jasperreports.