Announcement Announcement Module
Collapse
No announcement yet.
Jaxb2Marshaller problem Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    Did you try
    org.springframework.oxm.xstream.XStreamMarshaller ?

    Comment

    Working...
    X