Announcement Announcement Module
Collapse
No announcement yet.
Skipping on exception Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Skipping on exception

    HI,

    I am confused about how to configure my batch if while writing(commit-interval -5) if 3rd record throws exception I have to skip it and also rollback it.
    Also I am using hibernate.

    Please help with some code.

  • #2
    The hibernate sample has a skip configured: https://src.springframework.org/svn/...bernateJob.xml

    Comment


    • #3
      But the same configuration is not run ifro version 2.0.
      Code:
      <tasklet>
      				<chunk reader="readDb" skip-limit="10" processor="process" writer="opWriter" commit-interval="5">
      				<skippable-exception-classes>
      				java.lang.RuntimeException
      				</skippable-exception-classes>
      				</chunk>				
      			</tasklet>
      It give some error "cvc-complex-type.2.2: Element 'skippable-exception-classes' must have no element [children], and the value must be valid."
      What else to do for Spring batch 2.0 version.
      Code:
      Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': Cannot resolve reference to bean 'runUpgradeBatch' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'runUpgradeBatch': FactoryBean threw exception on object creation; nested exception is java.lang.NoSuchMethodError: org.springframework.batch.retry.policy.SimpleRetryPolicy.<init>(I)V
      	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)
      	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
      	at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:479)
      	at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:162)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:925)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:835)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
      	at java.security.AccessController.doPrivileged(Native Method)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
      	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:219)
      	... 39 more
      Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'runUpgradeBatch': FactoryBean threw exception on object creation; nested exception is java.lang.NoSuchMethodError: org.springframework.batch.retry.policy.SimpleRetryPolicy.<init>(I)V
      	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport$1.run(FactoryBeanRegistrySupport.java:127)
      	at java.security.AccessController.doPrivileged(Native Method)
      	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:116)
      	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:98)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1288)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:217)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
      	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:269)
      	... 49 more
      Caused by: java.lang.NoSuchMethodError: org.springframework.batch.retry.policy.SimpleRetryPolicy.<init>(I)V
      	at org.springframework.batch.core.step.item.FaultTolerantStepFactoryBean.configureRetry(FaultTolerantStepFactoryBean.java:347)
      	at org.springframework.batch.core.step.item.FaultTolerantStepFactoryBean.configureChunkProcessor(FaultTolerantStepFactoryBean.java:317)
      	at org.springframework.batch.core.step.item.SimpleStepFactoryBean.applyConfiguration(SimpleStepFactoryBean.java:505)
      	at org.springframework.batch.core.step.item.FaultTolerantStepFactoryBean.applyConfiguration(FaultTolerantStepFactoryBean.java:254)
      	at org.springframework.batch.core.step.item.SimpleStepFactoryBean.getObject(SimpleStepFactoryBean.java:333)
      	at org.springframework.batch.core.configuration.xml.StepParserStepFactoryBean.getObject(StepParserStepFactoryBean.java:149)
      	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport$1.run(FactoryBeanRegistrySupport.java:121)
      	... 57 more
      Last edited by kousik.majumder; Nov 15th, 2010, 07:55 AM.

      Comment


      • #4
        The 2.0 samples are in SVN in a branch and also in the .ZIP distribution (http://www.springsource.com/download/community). You can also use an XML editor that knows the grammar. If you use STS and declare the schema as version 2.0 it should have the rules built in, or you can use any XML editor that is strict and let it go to the internet for the grammar.

        Comment

        Working...
        X