Andrii Bobrov
Andrii Bobrov

Reputation: 79

Error while get JobOperatorImpl with Thorntail (Wildfly Swarm) and JBeret

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

Answers (2)

cheng
cheng

Reputation: 1138

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

It should provide all methods you need for managing jobs.

Upvotes: 0

Ken
Ken

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

Related Questions