Hello,
So I have been working with the Sample Batch project provided by STS using Spring Batch 2.1.7 along with Spring Web Admin 1.2.0 and I was able to create several jobs that cover reading/writing delimited flat files, xml files, and database. Everything is working fine. Now I am configuring Spring Batch Web Admin as a completely seperate project and I imported the jobs I created in my other Spring Batch project to this one. I am able to successfully run the database jobs fine, but any jobs that work with writing files are not working as expected. For both flatfile and xml jobs, I read from a flatfile/xml file and write to another flatfile/xml file. When I execute the job via batch web admin, the web admin says that the job executed successfully and says that the appropriate number of reads and writes are successful. The problem is when I check the classpath to look for these written files, they are NOT THERE! In the other Batch project, it works fine. In this batch web admin project, the files are not getting written to classpath/src/main/resources. Below is a sample of the XML job. Any help is greatly appreciated. Thanks!
Code:<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:batch="http://www.springframework.org/schema/batch" xsi:schemaLocation=" http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-2.1.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> <description>Example job to get you started. It provides a skeleton for a typical batch application.</description> <batch:job id="xmlProductProcessing" incrementer="sampleIncrementer"> <batch:step id="productXMLProcessingChunk" > <batch:tasklet transaction-manager="transactionManager" start-limit="100" > <batch:chunk reader="productXMLReader" processor="productProcessor" writer="productXMLWriter" commit-interval="10" /> </batch:tasklet> </batch:step> </batch:job> <bean id="productXMLReader" class="org.springframework.batch.item.xml.StaxEventItemReader"> <property name="resource" value="products.xml" /> <property name="fragmentRootElementName" value="product" /> <property name="unmarshaller" ref="productXMLUnmarshaller" /> </bean> <bean id="productXMLUnmarshaller" class="org.springframework.oxm.castor.CastorMarshaller"> <property name="mappingLocation" value="mapping.xml" /> </bean> <bean id="productXMLWriter" class="org.springframework.batch.item.xml.StaxEventItemWriter"> <property name="resource" value="file:src/main/resources/productsWrite.xml" /> <property name="overwriteOutput" value="true" /> <property name="rootTagName" value="products" /> <property name="marshaller" ref="productXMLMarshaller" /> </bean> <bean id="productXMLMarshaller" class="org.springframework.oxm.castor.CastorMarshaller"> <property name="mappingLocation" value="mapping.xml" /> </bean> </beans>


Reply With Quote
