Reputation: 79
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.
Upvotes: 0
Views: 203
Reputation: 1138
You can cast it to org.jberet.operations.AbstractJobOperator
.
It should provide all methods you need for managing jobs.
Upvotes: 0
Reputation: 835
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
Upvotes: 0