Results 1 to 5 of 5

Thread: problem in handling nested exception while parsing XML.

Threaded View

  1. #1
    Join Date
    Nov 2009
    Posts
    6

    Thumbs up problem in handling nested exception while parsing XML.

    hi,
    i'm running a job to read xml file .when bad record occurs during validation against xsd,job stop's execution.
    i need to continue my job and want to write all bad records in separate file.

    here's my code..

    <batch:job id="simpleJob" job-repository="jobRepository">
    <batch:step id="step1">
    <batch:tasklet>
    <batch:chunk reader="itemReader" writer="Writer"
    commit-interval="500"/>
    <batch:no-rollback-exception-classes>
    org.springframework.oxm.jaxb.JaxbUnmarshallingFail ureException
    </batch:no-rollback-exception-classes>

    </batch:tasklet>
    </batch:step>
    </batch:job>

    <bean id="inputFile" class="org.springframework.core.io.ClassPathResour ce" scope="step">
    <constructor-arg value="com/batch/todb/NHA_Repurchase.xml"/>
    </bean>

    <bean id="itemReader" class="org.springframework.batch.item.xml.StaxEven tItemReader" scope="step">
    <property name="fragmentRootElementName" value="ExposureData" />
    <property name="resource" ref="inputFile" />
    <property name="unmarshaller" ref="unMarshaller" />
    <property name="strict" value="true"/>
    </bean>

    <bean id="unMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshalle r" scope="step">
    <property name="classesToBeBound">
    <value>relationalMapping.ExpData</value>
    </property>
    <property name="schema" value="classpath:com/batch/todb/Exp_Data.xsd"/>
    </bean>

    <bean id="Writer" class="com.batch.todb.XmlFileWriter" scope="step">
    <property name="dataSource" ref="dataSource" />
    <property name="sessionFactory" ref="sessionFactory" />
    </bean>

    can you say me how to continue the job and skip parse exceptions and JaxbUnmarshallingExceptions.

    thanks,
    gokul
    Last edited by krish3085; Nov 24th, 2009 at 04:24 AM. Reason: missed some info

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •