springboot + spring batch + mybatis + qurtaz实践之问题汇总

 

由于最近需要改写一个批处理框架,看到spring batch非常符合需求,打算使用spring batch与spring boot实践下。在这里做个实践中遇到的问题汇总:

1.spring batch集成后,启动时报ORA-08177: 无法连续访问此事务处理?

项目搭建后,启动时报错ORA-08177: 无法连续访问此事务处理。查询后得到处理方法如下:

http://blog.csdn.net/zhengyong15984285623/article/details/50125637

 

2.使用触发器模式(controller触发),将itemreader修改为FlatFileItemReader。因为ItemReader接口没有read方法。如果使用ItemReader,会报“Reader must be open before it can be read”错误。

 

3.改用FlatFileItemReader后,报错处理:

No ItemReader set (must be concurrent step), so ignoring offset data.

ItemStream was opened in a different thread.  Restart data could be compromised

扫描二维码关注公众号,回复: 530165 查看本文章

由于FlatFileItemReader非线程安全类,多线程调用会导致报错,如果使用多线程处理需要改写下FlatFileItemReader类。

可以参考:http://www.hollischuang.com/archives/576

错误原因为:在step中配置了

 .taskExecutor(new SimpleAsyncTaskExecutor()) //设置并发方式执行  

 .throttleLimit(1)        //并发任务数为 10,默认为4  

这样会调用并发处理,导致错误出现,代码注释后,该问题解决。

 

 

参考资料:spring boot 实战,spring batch批处理框架

猜你喜欢

转载自ailaopo415.iteye.com/blog/2350753