1 Reply Latest reply on Mar 5, 2017 1:02 PM by Cheng Fang

    Jbatch standalone with JBeret JdbcItemReader/Writer

    Sławomir Wojciechowski Newbie

      Hello,

       

       

      I have download jberet standalone example from page: https://github.com/kaape/jberet-standalone-example. It work's fine.

      Now I would like to modify it to use jdbcItemReader and jdbcItemWriter from Jberet. I add to pom:

       

        <dependency>

        <groupId>com.fasterxml.jackson.core</groupId>

        <artifactId>jackson-core</artifactId>

        <version>2.8.7</version>

        </dependency>

        <dependency>

        <groupId>com.fasterxml.jackson.core</groupId>

        <artifactId>jackson-databind</artifactId>

        <version>2.8.7</version>

        </dependency>

        <dependency>

        <groupId>com.fasterxml.jackson.core</groupId>

        <artifactId>jackson-annotations</artifactId>

        <version>2.8.7</version>

        </dependency>

       

       

        <!-- POJO beans may contain either jackson annotations, or JAXB annotations -->

        <!-- Include this dependency if JAXB annotation introspector is needed -->

        <dependency>

        <groupId>com.fasterxml.jackson.module</groupId>

        <artifactId>jackson-module-jaxb-annotations</artifactId>

        <version>2.8.7</version>

        </dependency>

       

      Next prepared according jbatch xml and class to start job. Unfortunately when I try to start this project i got error:

       

      ERROR: item-count=10, time-limit=0, skip-limit=-1, skipCount=0, retry-limit=-1, retryCount=0

      mar 05, 2017 2:26:32 PM org.jberet.runtime.runner.ChunkRunner run

      ERROR: JBERET000007: Failed to run job jdbcReaderWriterTest, step1, org.jberet.job.model.Chunk@1c51b97a

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

        at org.jberet.runtime.context.JobContextImpl.createArtifact(JobContextImpl.java:195)

        at org.jberet.runtime.runner.AbstractRunner.createArtifact(AbstractRunner.java:150)

        at org.jberet.runtime.runner.ChunkRunner.run(ChunkRunner.java:133)

        at org.jberet.runtime.runner.StepExecutionRunner.runBatchletOrChunk(StepExecutionRunner.java:218)

        at org.jberet.runtime.runner.StepExecutionRunner.run(StepExecutionRunner.java:139)

        at org.jberet.runtime.runner.CompositeExecutionRunner.runStep(CompositeExecutionRunner.java:164)

        at org.jberet.runtime.runner.CompositeExecutionRunner.runFromHeadOrRestartPoint(CompositeExecutionRunner.java:88)

        at org.jberet.runtime.runner.JobExecutionRunner.run(JobExecutionRunner.java:56)

        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)

        at java.util.concurrent.FutureTask.run(FutureTask.java:266)

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

        at java.lang.Thread.run(Thread.java:745)

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

        at org.jberet.creation.ArtifactFactoryWrapper.getClassFromBatchXmlOrClassLoader(ArtifactFactoryWrapper.java:65)

        at org.jberet.creation.ArtifactFactoryWrapper.create(ArtifactFactoryWrapper.java:41)

        at org.jberet.runtime.context.JobContextImpl.createArtifact(JobContextImpl.java:193)

        ... 12 more

      Caused by: java.lang.ClassNotFoundException: jdbcItemReader

        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

        at org.jberet.creation.ArtifactFactoryWrapper.getClassFromBatchXmlOrClassLoader(ArtifactFactoryWrapper.java:63)

       

       

      What should I do to could execute this standalone example with JdbcItemReades/Writer from Jberet?