-
Oct 7th, 2010, 10:04 AM
#1
Problem Using StaxEventItemWriter in spring batch
Hi,
In my application my reading data drom the database and writing into the physical file using StaxEventItemWriter .After some data get written into the file, NullPoniterException occured .
I am unable find the cause of it
My bean configuration is as below
!-- Archiving the Data from the PWHH database to physical files and then deleting the Files -->
<batch:job id="archiveToDiskJob" restartable="true">
<batch:step id="archivingStep">
<batch:tasklet>
<batch:chunk
commit-interval="${archivingStep.commitInterval}"
retry-limit="1"
reader="archivingItemReader"
writer="archivingItemWriter"
throttle-limit="1"
task-executor="jobLauncherTaskExecutor"
skip-limit="1">
<batch:retryable-exception-classes>
org.springframework.dao.DeadlockLoserDataAccessExc eption
</batch:retryable-exception-classes>
<batch:skippable-exception-classes>
org.springframework.batch.core.step.item.FaultTole rantChunkProvider
</batch:skippable-exception-classes>
<batch:streams>
<batch:stream ref="archivingStaxEventItemWriter"/>
</batch:streams>
</batch:chunk>
<batch:listeners>
<batch:listener ref="genericItemFailureListener" />
</batch:listeners>
</batch:tasklet>
</batch:step>
</batch:job>
<!--Reading the PWHH database to Archive -->
<bean id="archivingItemReader" class="com.te.pwh.services.history.jobs.Historical izationItemReader" scope="step">
<property name="jdbcTemplate">
<bean class="org.springframework.jdbc.core.JdbcTemplate" >
<property name="dataSource" ref="pwhHistoryDatasource" />
</bean>
</property>
<property name="paymentFileDao" ref="historicPaymentFileDao" />
<property name="numFileRows" value="${historicalizationStep.fileFetchRowSize}" />
</bean>
<!--Translating data from PWHH database to physical File -->
<bean name="archivingItemWriter" class="org.springframework.batch.item.support.Comp ositeItemWriter">
<property name="delegates">
<list>
<ref bean="archivingStaxEventItemWriter" />
<bean class="com.te.pwh.services.history.jobs.DeletePaym entFileItemWriter">
<property name="historicalizationPaymentFileDao" ref="historyHistoricalizationPaymentFileDao" />
</bean>
</list>
</property>
</bean>
<!--Writing data into physical file -->
<bean id="archivingStaxEventItemWriter" class="org.springframework.batch.item.xml.StaxEven tItemWriter">
<property name="resource" ref="archiveFile" />
<property name="rootTagName" value="Root" />
<property name="overwriteOutput" value="true" />
<property name="marshaller" ref="archivingFilesMarshaller" />
</bean>
<bean id="archiveFile" class="org.springframework.core.io.FileSystemResou rce" scope="step">
<constructor-arg type="java.io.File" value="${archiveFile.filePattern}#{jobParameters['archvingFile']}" />
</bean>
<bean id="archivingFilesMarshaller" class="org.springframework.oxm.xstream.XStreamMars haller">
<property name="aliases">
<util:map id="aliases" map-class="java.util.HashMap">
<entry key="Tpwpayfi" value="com.te.pwh.hibernate.Tpwpayfi" />
</util:map>
</property>
<property name="mode" value="1001"/>
</bean>
If any body know the cause of the Nullpointer error , please let me know
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules