0

I need to get JobOperatorImpl for dealing with programmatically defined jobs in JBeret. I use Thorntail as a container with io.thorntail:batch-jberet dependency.

JobOperatorImpl jobOperator = (JobOperatorImpl) JobOperatorContext.getJobOperatorContext().getJobOperator();

But I get an exception:Caused by: java.lang.ClassCastException: org.wildfly.extension.batch.jberet.deployment.JobOperatorService cannot be cast to org.jberet.operations.JobOperatorImpl

It works normally when I use JBeret dependency without Thorntail fraction.

Andrii Bobrov
  • 79
  • 1
  • 6

2 Answers2

0

I believe that org.wildfly.extension.batch.jberet.deployment.JobOperatorService can only be cast to javax.batch.operations.JobOperator and not the JBeret implementation class

Ken
  • 835
  • 4
  • 11
0

You can cast it to org.jberet.operations.AbstractJobOperator.

It should provide all methods you need for managing jobs.

cheng
  • 1,076
  • 6
  • 6
  • Yes, it works, thanks! Now I have another problem WFLYBATCH000005: The job name 'test01_1' was not found for the deployment. But it is the next challenge. – Andrii Bobrov Jul 18 '18 at 13:20