Announcement Announcement Module
Collapse
No announcement yet.
New to spring having problems with XML reader Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • New to spring having problems with XML reader

    Hi, trying to use a StaxEventReader with XstreamMarshaller and a StaxEvent Wrtier to write (the same xml file elsewhere) its a prototype the fact that it re writes an xml file is not the case. Rather, despite trying to understand through the documentation and user guides provided by spring source I get an error:

    Reader:

    <bean id="itemReader" class="org.springframework.batch.item.xml.StaxEven tItemReader">
    <property name="fragmentRootElementName" value="Person" />
    <property name="resource" value="outfile.xml" />
    <property name="unmarshaller" ref="personMarshaller" />

    </bean>

    Writer:

    <bean id="itemWriter" class="org.springframework.batch.item.xml.StaxEven tItemWriter">
    <property name="resource" ref="outputResource" />
    <property name="marshaller" ref="personMarshaller" />
    <property name="rootTagName" value="Person" />
    <property name="overwriteOutput" value="true" />
    </bean>

    Unmarsheller/Marsheller:

    <bean id="personMarshaller" class="org.springframework.oxm.xstream.XStreamMars haller">
    <property name="aliases">
    <props>
    <prop key="Person">packageName.objects.Person</prop>
    <prop key="id">java.lang.String</prop>
    <prop key="personId">java.lang.String</prop>
    <prop key="msId">java.lang.String</prop>
    <prop key="commonName">java.lang.String</prop>
    </props>
    </property>
    </bean>

    Error:

    8-Jun-2010 10:40:35 org.springframework.batch.core.step.AbstractStep execute
    SEVERE: Encountered an error executing the step
    java.lang.UnsupportedOperationException: XStreamMarshaller does not support unmarshalling using SAX XMLReaders
    at org.springframework.oxm.xstream.XStreamMarshaller. unmarshalSaxReader(XStreamMarshaller.java:467)


    I am very new to spring in general (1 week!) so help would be of great value!

    Thanks.

  • #2
    Check you classpath and make sure you have spring-oxm 1.5.x (not 3.0.x).

    Comment


    • #3
      Many thanks

      Comment

      Working...
      X