javawebspheregeronimojbatch

How to run BatchEE jobs on managed threads within WebSphere Application Server?


I have a web application, that uses batchee-jbatch to execute some batches within the web application on a IBM WAS.

The JobOperator seems to start properly, but the application fails when I try to execute the batch. The serve log file shows the following output:

[15.09.23 13:59:14:975 MESZ] 00000177 Init          I   
 ____        _       _     ______ ______ 
|  _ \      | |     | |   |  ____|  ____|
| |_) | __ _| |_ ___| |__ | |__  | |__   
|  _ < / _` | __/ __| '_ \|  __| |  __|  
| |_) | (_| | || (__| | | | |____| |____ 
|____/ \__,_|\__\___|_| |_|______|______|0.4-incubating
[15.09.23 13:59:15:107 MESZ] 00000177 SystemOut     O 2023-09-15 13:59:15,107 WebContainer : 6 TRACE Log4jLoggerFactory.getContext() found anchor class com.example.core.impl.BatchJobObserver
[15.09.23 13:59:15:109 MESZ] 00000177 SystemOut     O 2023-09-15 13:59:15,109 WebContainer : 6 TRACE Log4jLoggerFactory.getContext() found anchor class com.example.core.impl.BatchWatchdogTask
[15.09.23 13:59:15:138 MESZ] 000002af BaseStepContr E   javax.batch.operations.BatchRuntimeException: unable to resolve BeanManager
                                 java.lang.RuntimeException: javax.batch.operations.BatchRuntimeException: unable to resolve BeanManager
    at org.apache.batchee.container.proxy.ProxyFactory.loadArtifact(ProxyFactory.java:60)
    at org.apache.batchee.container.proxy.ProxyFactory.createItemReaderProxy(ProxyFactory.java:124)
    at org.apache.batchee.container.impl.controller.chunk.ChunkStepController.initializeChunkArtifacts(ChunkStepController.java:778)
    at org.apache.batchee.container.impl.controller.chunk.ChunkStepController.invokeCoreStep(ChunkStepController.java:728)
    at org.apache.batchee.container.impl.controller.BaseStepController.execute(BaseStepController.java:157)
    at org.apache.batchee.container.impl.controller.ExecutionTransitioner.doExecutionLoop(ExecutionTransitioner.java:106)
    at org.apache.batchee.container.impl.controller.JobThreadRootController.originateExecutionOnThread(JobThreadRootController.java:110)
    at org.apache.batchee.container.util.BatchWorkUnit.run(BatchWorkUnit.java:62)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
    at java.lang.reflect.Method.invoke(Method.java:508)
    at org.apache.batchee.container.util.ClassLoaderAwareHandler.invoke(ClassLoaderAwareHandler.java:39)
    at com.sun.proxy.$Proxy504.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1160)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.lang.Thread.run(Thread.java:820)
Caused by: javax.batch.operations.BatchRuntimeException: unable to resolve BeanManager
    at org.apache.batchee.container.cdi.BatchCDIInjectionExtension.getBeanManager(BatchCDIInjectionExtension.java:113)
    at org.apache.batchee.container.services.factory.CDIBatchArtifactFactory.getBeanManager(CDIBatchArtifactFactory.java:68)
    at org.apache.batchee.container.services.factory.CDIBatchArtifactFactory.load(CDIBatchArtifactFactory.java:34)
    at org.apache.batchee.container.proxy.ProxyFactory.loadArtifact(ProxyFactory.java:50)
    ... 16 more

I have no idea why the batch runtime exception unable to resolve BeanManager is fired and how to solve this issue. Does anybody has an idea what could be the problem?

Best Regards


Solution

  • setting the Property BatchThreadPoolService = org.apache.batchee.container.services.executor.JNDIThreadPoolService as mentioned in the comment from Scott Kurz solved the problem for me!

    Thanks! Michael