Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Batch inside a Java EE server

Could you run Spring Batch inside a Java EE server (eg. WebLogic), let's say as a Web Application? Is there any issue with Spring Batch creating more threads (for multi threaded steps and parallel steps) inside a Java EE server? Is this creation of threads by the framework against Java EE specification?

I am thinking it is okay and people are doing this after reading the following link

http://static.springsource.org/spring-batch/reference/html-single/index.html#runningJobsFromWebContainer

Please help.

like image 902
Ajith Jose Avatar asked Jan 18 '26 17:01

Ajith Jose


1 Answers

This is an old question, but I will add an answer after all.
Yes, there may be some problems. I encountered such problems on WebSphere server.
According to their documentation: http://www-01.ibm.com/support/docview.wss?uid=swg21246676

Using a Java™ call such as "newThread()" to spawn a new thread is not supported according to the J2EE specification. This spawned thread does not inherit the J2EE context. What is recommended to do instead is to use an asynchronous bean or Commonj WorkManager thread. These threads have a proper J2EE context and support an indirect JNDI lookup.

Spring batch creates it's own threads using new Thread, and these threads do not inherit J2EE context.
In my specific case one of Spring Batch Job consumed a few REST services over https, and it turned out that threads spawned by Spring Batch don't see https cerificates installed in WebSphere server, causing certificate's errors.

like image 65
krokodilko Avatar answered Jan 20 '26 09:01

krokodilko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!