Announcement Announcement Module
Collapse
No announcement yet.
Writer must be open before it can be written to - while split files based on pattern Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Writer must be open before it can be written to - while split files based on pattern

    Hi, I tried to split the files based on the pattern match, but I am getting the below error as
    "org.springframework.batch.item.WriterNotOpenExcep tion: Writer must be open before it can be written to".
    Please let me know where Iam going wrong.

    <job id="writeProductsJob" xmlns="http://www.springframework.org/schema/batch">
    <step id="readWrite">
    <tasklet>
    <chunk reader="productItemReader" writer="productItemWriter" commit-interval="3" />
    </tasklet>
    </step>
    </job>

    <bean id="productItemWriter"
    class="org.springframework.batch.item.support.Clas sifierCompositeItemWriter">
    <property name="classifier">
    <bean class="org.springframework.batch.classify.BackToBa ckPatternClassifier">
    <property name="routerDelegate">
    <bean class="helloworld.GenericRow" />
    </property>
    <property name="matcherMap">
    <map>
    <entry key="*Sampleapple*" value-ref="itemWriter" />
    </map>
    </property>
    </bean>
    </property>
    </bean>

  • #2
    looks like the delegate item writer implement ItemStream, so you should register it as such in the chunk (the ClassifierCompositeItemWriter doesn't do it itself).

    Comment

    Working...
    X