Results 1 to 2 of 2

Thread: Jaxb2Marshaller problem

  1. #1
    Join Date
    Jul 2011
    Posts
    2

    Default Jaxb2Marshaller problem

    Hi !

    I have a problem with Jaxb2Marshaller when i want to marshall my class.

    Code:
    <bean id="ItemWriter" class="org.springframework.batch.item.xml.StaxEventItemWriter">
    		<property name="resource" ref="outputResource" />
    		<property name="marshaller" ref="ticketMarshaller" />
    		<property name="rootTagName" value="tickets" />
    		<property name="overwriteOutput" value="true" />
    	</bean>
    	
    	
    <bean id="ticketMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
            <property name="contextPath" value="com.ticket"/>
            <property name="schema" value="classpath:META-INF/data/GT/ticket.xsd"/>
        </bean>
    
    	<bean id="outputResource" class="org.springframework.core.io.FileSystemResource">
    		<constructor-arg value="target/outputTest.xml" />
    	</bean>
    I am encounting this error :

    17:02:12,909 DEBUG main TransactionTemplate:152 - Initiating transaction rollback on application exception
    java.lang.IllegalStateException: Marshaller must support the class of the marshalled object
    at org.springframework.util.Assert.state(Assert.java: 384)
    at org.springframework.batch.item.xml.StaxEventItemWr iter.write(StaxEventItemWriter.java:565)

    I don't understand because i followed this tutorial at chap 14.5.1 Jaxb2Marshaller and i use ticketMarshaller for unmarshalled and it's ok:

    http://static.springsource.org/sprin.../html/oxm.html


    Help me please !

  2. #2

    Default

    Did you try
    org.springframework.oxm.xstream.XStreamMarshaller ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •