I'm trying to use JBeret implementaton of JSR352 in an EE environment but not Wildfly/JBoss.
I'm working with JBeret 1.4.7.Final deployed on Open Liberty 21.0.0.12. I know that Open Liberty have its own JSR352 implementation but I'm interested by the infinispan JobRepositry proposed by JBeret. I don't want to rely on a persistant database with all its deployment constraint.
I've added all dependencies listed in the documentation : https://github.com/jberet/jsr352/tree/1.4.x#minimal-application-dependencies
But I'm getting an error telling me that there is no BatchEnvironment implementation available.
[INFO] [ERROR ] CNTR0020E: EJB threw an unexpected (non-declared) exception during invocation of method "scheduleJobExecution" on bean "BeanId(scheduleBatchlet#scheduleBatchlet.war#BatchletSingletonBean, null)". Exception data: java.lang.ExceptionInInitializerError
[INFO] at org.jberet.spi.JobOperatorContext.getJobOperatorContext(JobOperatorContext.java:48)
[INFO] at org.jberet.samples.wildfly.batchletsingleton.BatchletSingletonBean.scheduleJobExecution(BatchletSingletonBean.java:46)
[INFO] at sun.reflect.GeneratedMethodAccessor629.invoke(Unknown Source)
[INFO] at java.lang.reflect.Method.invoke(Method.java:498)
[INFO] at com.ibm.ejs.container.EJSContainer.invokeProceed(EJSContainer.java:4886)
[INFO] at [internal classes]
[INFO] Caused by: 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
[INFO] ... 11 more
[INFO]
It seems that there is no implementation in the jberet-core dependency ! Wildfly seems to have its own implementation but obviously Open Liberty don't have one because its JSR352 implementation does not rely on JBeret.
So I've tried to add some other dependencies from the java-ee-bom module (jberet-se actually) : https://github.com/jberet/jsr352/tree/1.4.x/jberet-ee-bom jberet-se have a BatchEnvironment implementation but I don't know if it's the right way to use this implementation in an EE environment... And it's not working either. I'm getting a WeldContainer error. Seems that the SE dependency need all the weld SE dependencies... Don't seems right for my need :s
[INFO] [ERROR ] CNTR0020E: EJB threw an unexpected (non-declared) exception during invocation of method "scheduleJobExecution" on bean "BeanId(scheduleBatchlet#scheduleBatchlet.war#BatchletSingletonBean, null)". Exception data: java.lang.NoClassDefFoundError: org/jboss/weld/environment/se/WeldContainer
[INFO] at org.jberet.se.SEArtifactFactory.<init>(SEArtifactFactory.java:30)
[INFO] at org.jberet.se.BatchSEEnvironment.getArtifactFactory(BatchSEEnvironment.java:117)
[INFO] at org.jberet.operations.AbstractJobOperator.startJobExecution(AbstractJobOperator.java:447)
[INFO] at org.jberet.operations.AbstractJobOperator.access$000(AbstractJobOperator.java:60)
[INFO] at org.jberet.operations.AbstractJobOperator$1.invoke(AbstractJobOperator.java:146)
[INFO] at org.jberet.operations.AbstractJobOperator$1.invoke(AbstractJobOperator.java:142)
[INFO] at org.jberet.operations.AbstractJobOperator.invokeTransaction(AbstractJobOperator.java:465)
[INFO] at org.jberet.operations.AbstractJobOperator.start(AbstractJobOperator.java:142)
[INFO] at org.jberet.operations.AbstractJobOperator.start(AbstractJobOperator.java:102)
[INFO] at org.jberet.operations.AbstractJobOperator.start(AbstractJobOperator.java:81)
[INFO] at org.jberet.operations.DelegatingJobOperator.start(DelegatingJobOperator.java:68)
[INFO] at org.jberet.samples.wildfly.batchletsingleton.BatchletSingletonBean.scheduleJobExecution(BatchletSingletonBean.java:49)
[INFO] at sun.reflect.GeneratedMethodAccessor632.invoke(Unknown Source)
[INFO] at java.lang.reflect.Method.invoke(Method.java:498)
[INFO] at com.ibm.ejs.container.EJSContainer.invokeProceed(EJSContainer.java:4886)
[INFO] at [internal classes]
[INFO]
Is JBeret too tied to Wildfly to be used in an other EE environment ? Do I miss something ? I didn't find any BatchEnvironment suitable for an other EE application server than Wildfly...