Announcement Announcement Module
Collapse
No announcement yet.
SpringBatch Integration with struts2 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • SpringBatch Integration with struts2

    hello,
    We have are integrating a standalone application into webapplication.When we are trying convert a file we are getting an error saying "input source must exist (reader is in 'strict' mode)"


    <?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:jdbc="http://www.springframework.org/schema/jdbc"
    xmlns:batch="http://www.springframework.org/schema/batch"
    xsi:schemaLocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schem...g-jdbc-3.0.xsd
    http://www.springframework.org/schema/beans http://www.springframework.org/schem...-beans-3.0.xsd http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-2.1.xsd">

    <!-- bean -->
    <bean id="transactionManager"
    class="org.springframework.batch.support.transacti on.ResourcelessTransactionManager">
    <!-- <property name="dataSource" ref="dataSource" /> -->
    </bean>
    <bean id="jobRepository"
    class="org.springframework.batch.core.repository.s upport.MapJobRepositoryFactoryBean">
    <property name="transactionManager" ref="transactionManager" />

    </bean>


    <!--<bean id="jobRepository" class="org.springframework.batch.core.repository.s upport.JobRepositoryFactoryBean"
    > <property name="databaseType" value="oracle"></property> <property name="dataSource"
    ref="dataSource"></property> <property name="transactionManager" ref="transactionManager"></property>
    <property name="isolationLevelForCreate" value="ISOLATION_DEFAULT"/> <property
    name="tablePrefix" value="BATCH_"></property> </bean> -->

    <bean id="jobLauncher"
    class="org.springframework.batch.core.launch.suppo rt.SimpleJobLauncher">
    <property name="jobRepository" ref="jobRepository" />
    </bean>

    <!-- <bean class="org.springframework.jdbc.core.JdbcTemplate" > <constructor-arg
    ref="dataSource" /> </bean> -->

    <bean id="GenericReader" class="org.springframework.batch.item.file.FlatFil eItemReader"
    abstract="true">
    <property name="recordSeparatorPolicy" ref="GenericRecordSeparatorPolicy" />
    <property name="linesToSkip" value="1" />

    </bean>

    <bean id="GenericRecordSeparatorPolicy"
    class="org.springframework.batch.item.file.separat or.DefaultRecordSeparatorPolicy">
    </bean>

    <!-- Generic Transaction FIle writer -->
    <bean id="GenericTXNWriter" class="org.springframework.batch.item.file.FlatFil eItemWriter"
    abstract="true">
    <property name="shouldDeleteIfExists" value="true" />
    <property name="lineAggregator">
    <bean
    class="org.springframework.batch.item.file.transfo rm.DelimitedLineAggregator">
    <property name="delimiter" value="~" />

    <property name="fieldExtractor">
    <bean
    class="org.springframework.batch.item.file.transfo rm.BeanWrapperFieldExtractor">
    <property name="names"
    value="exchangeFileName,exchangeCode,recordType,fr omDealerCode,transactionNumber,transactionDate,due Date,transactionCode,fromAcNumber,toAcNumber,trans actionFlagDrCrFlag,transactedAmount,transactionAmo unt,shortageAmount,amountPosted,cLGNo,transactionD escription,chequeNo,settlementType,settlementNo,tr ansactionnoofBank,narration,lienReasonCode,lienInd icator" />
    </bean>
    </property>


    </bean>
    </property>
    </bean>


    <bean id="GenericMcxGrpOutTxnWriter" class="com.indusind.ecc.common.bean.CustomFlatFile ItemWriter"
    abstract="true">

    <property name="fieldExtractors">
    <bean
    class="org.springframework.batch.item.file.transfo rm.BeanWrapperFieldExtractor">
    <property name="names"
    value="fromDealerCode,transactionDate,accountNumbe r,transactionFlagDrCrFlag,transactionAmount,transa ctedAmount,shortageAmount,status,chequeNo,settleme ntType,settlementNo,narration" />
    </bean>
    </property>
    <property name="delimiter" value="," />
    <property name="shouldDeleteIfExists" value="true" />
    </bean>

    <!-- INPUT Transcation File Exchange to CBS -->

    <bean id="headerBean" class="com.indusind.ecc.common.bean.HeaderBean"
    scope="singleton" />




    <job id="NSE_TXN_FIN" xmlns="http://www.springframework.org/schema/batch"
    restartable="true">

    <step id="readWriteNSEinTXN">
    <tasklet allow-start-if-complete="true">
    <chunk reader="NSEinTXNreader" writer="NSEinTXNwriter"
    commit-interval="0" skip-limit="5">
    <skippable-exception-classes>
    </skippable-exception-classes>
    </chunk>
    </tasklet><!-- <end on="FAILED"/> --><!--<end on="*"/> -->
    </step>
    <!--<step id="readWriteNSEinTXN"> </step> -->
    </job>


    <bean id="NSEinTXNreader" class="com.indusind.ecc.fileupload.action.FlatFile ItemReader" scope="step" parent="GenericReader" >
    <property name="resource" value="file:#{jobParameters['resource1']}" />
    <property name="lineMapper" ref="NSEinTXNlineMapper" >


    </bean>

    <bean id="NSEinTXNlineMapper" class="com.indusind.ecc.nse.bal.NewLineMapper">
    <property name="lineTokenizer" ref="NSEinTXNLineTokenizer" />
    <property name="fieldSetMapper" ref="NSEinTXNFieldSetMapper" />
    </bean>

    <bean id="NSEinTXNFields" class="com.indusind.ecc.nse.NseVector"
    scope="prototype">
    <property name="headerBean" ref="headerBean" />
    </bean>



    <bean id="NSEinTXNLineTokenizer"
    class="org.springframework.batch.item.file.transfo rm.DelimitedLineTokenizer">
    <property name="delimiter" value="," />
    <property name="names"
    value="recordType,transactionDate,transactionNumbe r,dueDate,transactionCode,transactionDescription,f romAcNumber,toAcNumber,transactionAmount,transacte dAmount,shortageAmount,amountPosted,transactionnoo fBank" />

    </bean>



    <bean id="NSEinTXNFieldSetMapper" class="com.indusind.ecc.nse.NseVectorFieldSetMappe r">
    <property name="domainController" ref="domainController" />
    <property name="headerBean" ref="headerBean" />
    </bean>



    <bean id="NSEinTXNwriter" class="org.springframework.batch.item.file.FlatFil eItemWriter"
    scope="step">
    <property name="resource" value="file:#{jobParameters['opFileName']}" />
    <property name="shouldDeleteIfExists" value="true" />
    <property name="lineAggregator">
    <bean
    class="org.springframework.batch.item.file.transfo rm.DelimitedLineAggregator">
    <property name="delimiter" value="~" />

    <property name="fieldExtractor">
    <bean
    class="org.springframework.batch.item.file.transfo rm.BeanWrapperFieldExtractor">
    <property name="names"
    value="exchangeFileName,exchangeCode,recordType,fr omDealerCode,transactionNumber,transactionDate,due Date,transactionCode,fromAcNumber,toAcNumber,trans actionFlagDrCrFlag,transactedAmount,transactionAmo unt,shortageAmount,amountPosted,cLGNo,narration,ch equeNo,settlementType,settlementNo,transactionnoof Bank,transactionDescription,lienReasonCode,lienInd icator" />
    </bean>
    </property>


    </bean>
    </property>
    </bean>
Working...
X