New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JBERET000640 - Wildfly 14 #117
Comments
On the surface it looks like a class path problem. The BatchEnvironment impl for WildFly is included in WildFly distro and normally should already be available to jberet. Do you see the same error when running other batch jobs that do not involve programmatic job definition? Can you also paste the full stack trace? |
With JBeret i only tried programmatic job definition. But i tried to run a simple job from javax library and worked. 16:54:20,609 ERROR [io.undertow.request] (default task-1) UT005023: Exception handling request to /testBatch/api/ping: org.jboss.resteasy.spi.UnhandledException: javax.batch.operations.BatchRuntimeException: JBERET000640: A BatchEnvironment implementation could not be found. Please ensure the SPI has been implemented and is on the class path |
Did you use BatchRuntime.getJobOperator() to obtain the job operator? This should be used instead of directly instantiating JobOperatorImpl. |
I have using this. This code work in old projects that are running with java ee 7 and WF 10. Job job = new JobBuilder("JobName")
|
BatchRuntime.getJobOperator() is the standard and portable API, but JobOperatorImpl is an implementation class and should not be directly accessed by applications. |
But how can i start a org.jberet.job.model.Job using the BatchRuntime.getJobOperator()? |
The above is also used by the test app that uses programmatic job definition: |
Note that this solution is for jberet 1.3 or later. In summary, if you only need to access the standard API in javax.batch.operations.JobOperator, then call BatchRuntime.getJobOperator(). If you need to access the additional non-spec-defined API in JBeret's implementation of JobOperator, then use AbstractJobOperator jobOperator = (AbstractJobOperator) JobOperatorContext.getJobOperatorContext().getJobOperator(); as demonstrated in JBeret test class AbstractIT. |
This still does not working. Now i am getting:
`Job job = new JobBuilder("JobName")
|
These are the dependencies:
|
cast the job operator impl to org.jberet.operations.AbstractJobOperator (the super class of JobOperatorImpl). AbstractJobOperator should provide all the methods you will need to access jberet-specific operations. This applies for JBeret running in either Java SE or Java EE (WildFly) environment. |
Sorry for the confusion. I've updated my comments and casting to AbstractJobOperator (instead of JobOperatorImpl) should work. Casting to JobOperatorImpl only works in JBeret in Java SE. |
I am getting the follow error when i try to run a programmatic job definition. I am using wildfly 14, java ee 8 and jberet 1.3.1.Final.
JBERET000640: A BatchEnvironment implementation could not be found. Please ensure the SPI has been implemented and is on the class path
The text was updated successfully, but these errors were encountered: