Uploaded image for project: 'JBeret'
  1. JBeret
  2. JBERET-558

Refine the logic to check if the injection value target is primitive

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2.1.0.Final
    • None
    • jberet-core
    • None

      In order to determine the default value for a batch property (0 or null), the batch producer bean needs to check if it's a primitive or wrapper type. Currently it assumes the target is a field and tries to get the type of the field. This does not work when batch injections expand to all of field, method and constructor injections.

      java.lang.IllegalStateException: JBERET000600: Failed to create artifact with ref name propertyInjectionBatchlet.  Ensure CDI beans.xml is present and batch.xml, if any, is configured properly.
      	at org.jberet.runtime.context.JobContextImpl.createArtifact(JobContextImpl.java:197)
      	at org.jberet.runtime.runner.AbstractRunner.createArtifact(AbstractRunner.java:154)
      	at org.jberet.runtime.runner.BatchletRunner.run(BatchletRunner.java:68)
      	at org.jberet.runtime.runner.StepExecutionRunner.runBatchletOrChunk(StepExecutionRunner.java:226)
      	at org.jberet.runtime.runner.StepExecutionRunner.run(StepExecutionRunner.java:142)
      	at org.jberet.runtime.runner.CompositeExecutionRunner.runStep(CompositeExecutionRunner.java:170)
      	at org.jberet.runtime.runner.CompositeExecutionRunner.runFromHeadOrRestartPoint(CompositeExecutionRunner.java:94)
      	at org.jberet.runtime.runner.JobExecutionRunner.run(JobExecutionRunner.java:58)
      	at org.jberet.spi.JobExecutor$1.run(JobExecutor.java:100)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      	at java.base/java.lang.Thread.run(Thread.java:834)
      Caused by: java.lang.ClassCastException: class java.lang.reflect.Method cannot be cast to class java.lang.reflect.Field (java.lang.reflect.Method and java.lang.reflect.Field are in module java.base of loader 'bootstrap')
      	at org.jberet.creation.BatchBeanProducer.getInt(BatchBeanProducer.java:63)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      

              cfang@redhat.com Cheng Fang
              cfang@redhat.com Cheng Fang
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: