Announcement Announcement Module
Collapse
No announcement yet.
Sping Batch JobInterruptedException Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Sping Batch JobInterruptedException

    Hi,

    I'm having a problem with a Spring Batch. Concretely speaking, my problem is realted to JobInterruptedException.

    In my case, I'm processing a collection of registers and one of them fails due to a PersitenceException. The error in fact is caused by a PropertyAccessException, caused by a IllegalArgumentException (Hibernate tries to recover an entity from DB where one on its not nullable fields is null). The error is known and we have a try/catch block so as to correctly capture the exception. We discard this register and log the proper information.

    My question here is: In spite of the fact that the exception is correctly captured and the rest of the process continues its exectution, at the end of the Writer I get a JobInterruptionExpection. There is also a warning complaing about the commit fails due to an unknown state, but I don't understand why...if the exception is captured and the process continues correctly, why do I get at the end of the exectution the JobInterruptedException?

    If anyone has had a similar problem or can give an idea of how to solve it...

    Thanks in advance!

    The detail of the PersistenceException, which is conveniently captured is:

    javax.persistence.PersistenceException: org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter of gnf.gps.facturacioncobro.facturacion.persistence.e ntities.CalculationDocument.idContractedService
    at org.hibernate.ejb.AbstractEntityManagerImpl.conver t(AbstractEntityManagerImpl.java:1214)
    at org.hibernate.ejb.AbstractEntityManagerImpl.find(A bstractEntityManagerImpl.java:635)
    at org.hibernate.ejb.AbstractEntityManagerImpl.find(A bstractEntityManagerImpl.java:589)
    at sun.reflect.GeneratedMethodAccessor369.invoke(Unkn own Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    Caused by: org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter of gnf.gps.facturacioncobro.facturacion.persistence.e ntities.CalculationDocument.idContractedService
    at org.hibernate.property.BasicPropertyAccessor$Basic Setter.set(BasicPropertyAccessor.java:109)
    at org.hibernate.tuple.entity.AbstractEntityTuplizer. setPropertyValues(AbstractEntityTuplizer.java:583)
    at org.hibernate.tuple.entity.PojoEntityTuplizer.setP ropertyValues(PojoEntityTuplizer.java:229)
    at org.hibernate.persister.entity.AbstractEntityPersi ster.setPropertyValues(AbstractEntityPersister.jav a:3847)
    at org.hibernate.engine.TwoPhaseLoad.initializeEntity (TwoPhaseLoad.java:152)
    at org.hibernate.loader.Loader.initializeEntitiesAndC ollections(Loader.java:982)
    at org.hibernate.loader.Loader.doQuery(Loader.java:85 7)
    at org.hibernate.loader.Loader.doQueryAndInitializeNo nLazyCollections(Loader.java:274)
    at org.hibernate.loader.Loader.loadEntity(Loader.java :2037)
    at org.hibernate.loader.entity.AbstractEntityLoader.l oad(AbstractEntityLoader.java:86)
    at org.hibernate.loader.entity.AbstractEntityLoader.l oad(AbstractEntityLoader.java:76)
    at org.hibernate.persister.entity.AbstractEntityPersi ster.load(AbstractEntityPersister.java:3293)
    at org.hibernate.event.def.DefaultLoadEventListener.l oadFromDatasource(DefaultLoadEventListener.java:49 6)
    at org.hibernate.event.def.DefaultLoadEventListener.d oLoad(DefaultLoadEventListener.java:477)
    at org.hibernate.event.def.DefaultLoadEventListener.l oad(DefaultLoadEventListener.java:227)
    at org.hibernate.event.def.DefaultLoadEventListener.p roxyOrLoad(DefaultLoadEventListener.java:285)
    at org.hibernate.event.def.DefaultLoadEventListener.o nLoad(DefaultLoadEventListener.java:152)
    at org.hibernate.impl.SessionImpl.fireLoad(SessionImp l.java:1090)
    at org.hibernate.impl.SessionImpl.get(SessionImpl.jav a:1005)
    at org.hibernate.impl.SessionImpl.get(SessionImpl.jav a:998)
    at org.hibernate.ejb.AbstractEntityManagerImpl.find(A bstractEntityManagerImpl.java:614)
    at org.hibernate.ejb.AbstractEntityManagerImpl.find(A bstractEntityManagerImpl.java:589)
    at sun.reflect.GeneratedMethodAccessor369.invoke(Unkn own Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.springframework.orm.jpa.SharedEntityManagerCre ator$SharedEntityManagerInvocationHandler.invoke(S haredEntityManagerCreator.java:240)
    at $Proxy53.find(Unknown Source)
    at gnf.ada.core.persistence.PersistenceFacade.searchB yPrimaryKey(PersistenceFacade.java:839)
    at gnf.ada.core.persistence.CommonDaoImplementation.s earchByPrimaryKey(CommonDaoImplementation.java:534 )
    at gnf.gps.facturacioncobro.facturacion.emisionfactur a.services.business.impl.GcbiSifcoProcessImpl.proc essCalcDoc(GcbiSifcoProcessImpl.java:307)
    at gnf.gps.facturacioncobro.facturacion.emisionfactur a.services.business.impl.GcbiSifcoProcessImpl.getC onsumCNE(GcbiSifcoProcessImpl.java:236)
    at gnf.gps.facturacioncobro.facturacion.emisionfactur a.services.business.impl.GcbiSifcoProcessImpl.extr actConsumption(GcbiSifcoProcessImpl.java:184)
    at gnf.gps.facturacioncobro.facturacion.emisionfactur a.services.business.impl.GcbiSifcoProcessImpl$$Fas tClassByCGLIB$$1a70ff50.invoke(<generated>)
    at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy. java:191)
    at org.springframework.aop.framework.Cglib2AopProxy$D ynamicAdvisedInterceptor.intercept(Cglib2AopProxy. java:617)
    at gnf.gps.facturacioncobro.facturacion.emisionfactur a.services.business.impl.GcbiSifcoProcessImpl$$Enh ancerByCGLIB$$8666c36c.extractConsumption(<generat ed>)
    at gnf.gps.facturacioncobro.facturacion.batch.steps.w riters.GcbiSifcoProcessCalcDocsWriter.write(GcbiSi fcoProcessCalcDocsWriter.java:56)
    at org.springframework.batch.core.step.item.SimpleChu nkProcessor.writeItems(SimpleChunkProcessor.java:1 71)
    at org.springframework.batch.core.step.item.SimpleChu nkProcessor.doWrite(SimpleChunkProcessor.java:150)
    at org.springframework.batch.core.step.item.SimpleChu nkProcessor.write(SimpleChunkProcessor.java:268)
    at org.springframework.batch.core.step.item.SimpleChu nkProcessor.process(SimpleChunkProcessor.java:196)
    at org.springframework.batch.core.step.item.ChunkOrie ntedTasklet.execute(ChunkOrientedTasklet.java:74)
    at org.springframework.batch.core.step.tasklet.Taskle tStep$ChunkTransactionCallback.doInTransaction(Tas kletStep.java:371)
    at org.springframework.transaction.support.Transactio nTemplate.execute(TransactionTemplate.java:130)
    at org.springframework.batch.core.step.tasklet.Taskle tStep$2.doInChunkContext(TaskletStep.java:263)
    at org.springframework.batch.core.scope.context.StepC ontextRepeatCallback.doInIteration(StepContextRepe atCallback.java:76)
    at org.springframework.batch.repeat.support.TaskExecu torRepeatTemplate$ExecutingRunnable.run(TaskExecut orRepeatTemplate.java:257)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run Task(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:909)
    ... 1 more
    Caused by: java.lang.IllegalArgumentException
    at sun.reflect.GeneratedMethodAccessor396.invoke(Unkn own Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.hibernate.property.BasicPropertyAccessor$Basic Setter.set(BasicPropertyAccessor.java:66)
    at org.hibernate.tuple.entity.AbstractEntityTuplizer. setPropertyValues(AbstractEntityTuplizer.java:583)
    at org.hibernate.tuple.entity.PojoEntityTuplizer.setP ropertyValues(PojoEntityTuplizer.java:229)
    at org.hibernate.persister.entity.AbstractEntityPersi ster.setPropertyValues(AbstractEntityPersister.jav a:3848)
    at org.hibernate.engine.TwoPhaseLoad.initializeEntity (TwoPhaseLoad.java:154)
    ... 45 more

    The JobInterruptionException thrown at the end of the Writer is:

    09-05-12 13:31:23,999 * DEBUG* GcbiSifcoProcessCalcDocsWriter: 64 - THREAD [23] Fin GcbiSifcoProcessCalcDocsWriter
    09-05-12 13:31:24,017 * INFO * TaskletStep : 327 - Commit failed while step execution data was already updated. Reverting to old version.
    09-05-12 13:31:24,019 * ERROR* TaskletStep : 336 - Rolling back with transaction in unknown state
    09-05-12 13:31:24,026 * INFO * ThreadStepInterruptionPolicy : 59 - Step interrupted through StepExecution
    09-05-12 13:31:24,036 * ERROR* AbstractStep : 212 - Encountered an error executing the step
    org.springframework.batch.core.JobInterruptedExcep tion: Job interrupted status detected.
    at org.springframework.batch.core.step.ThreadStepInte rruptionPolicy.checkInterrupted(ThreadStepInterrup tionPolicy.java:42)
    at org.springframework.batch.core.step.tasklet.Taskle tStep$2.doInChunkContext(TaskletStep.java:258)
    at org.springframework.batch.core.scope.context.StepC ontextRepeatCallback.doInIteration(StepContextRepe atCallback.java:76)
    at org.springframework.batch.repeat.support.TaskExecu torRepeatTemplate$ExecutingRunnable.run(TaskExecut orRepeatTemplate.java:257)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run Task(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:909)
    at java.lang.Thread.run(Thread.java:662)



  • #2
    Hi did you get this problem solved?

    Comment

    Working...
    X