Note that there are some explanatory texts on larger screens.

plurals
  1. POXml Deserilization is not working using Xstream
    primarykey
    data
    text
    <p>I have a following class which is serializing </p> <blockquote> <p>org.springframework.integration.core.Message</p> </blockquote> <p>into file as follows:</p> <p><strong>Sample.java</strong></p> <pre><code>public static void receive(Message&lt;?&gt; message) throws IOException, MessagingException { XStream xStream = new XStream(); File file = new File("c:/temp/temp.xml"); FileOutputStream fileOutputStream = new FileOutputStream(file); xStream.toXML(message,fileOutputStream); } </code></pre> <p><strong>UnMarshall.java</strong></p> <pre><code>public static void main(String[] args) throws IOException, MessagingException, ClassNotFoundException { XStream xStream = new XStream(); File file = new File("c:/temp/temp.xml"); FileInputStream fileOutputStream = new FileInputStream(file); Message message = (Message) xStream.fromXML(fileOutputStream); } </code></pre> <p>If I run UnMarshall.java then I am getting the following exception:</p> <p><strong>Question</strong></p> <ul> <li>Is it possible to do serialize/deserialize Message object with XStream?</li> <li><p>If not what other options I have?</p> <p>Exception in thread "main" com.thoughtworks.xstream.converters.ConversionException: Cannot construct class java.lang.Class ---- Debugging information ---- message : Cannot construct class java.lang.Class cause-exception : java.lang.InstantiationException cause-message : javax.activation.ActivationDataFlavor class : org.springframework.integration.message.GenericMessage required-type : javax.activation.ActivationDataFlavor path : /org.springframework.integration.message.GenericMessage/payload/dh/dataContentHandler/dch/myDF line number : 14 ------------------------------- at com.thoughtworks.xstream.converters.reflection.ExternalizableConverter.unmarshal(ExternalizableConverter.java:110) at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:56) at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:45) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:46) at com.thoughtworks.xstream.annotations.AnnotationReflectionConverter.unmarshallField(AnnotationReflectionConverter.java:66) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:188) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:125) at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:56) at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:45) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:46) at com.thoughtworks.xstream.annotations.AnnotationReflectionConverter.unmarshallField(AnnotationReflectionConverter.java:66) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:188) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:125) at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:56) at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:45) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:46) at com.thoughtworks.xstream.annotations.AnnotationReflectionConverter.unmarshallField(AnnotationReflectionConverter.java:66) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:188) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:125) at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:56) at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:45) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:46) at com.thoughtworks.xstream.annotations.AnnotationReflectionConverter.unmarshallField(AnnotationReflectionConverter.java:66) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:188) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:125) at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:56) at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:45) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:46) at com.thoughtworks.xstream.annotations.AnnotationReflectionConverter.unmarshallField(AnnotationReflectionConverter.java:66) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:188) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:125) at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:56) at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:45) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:46) at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:117) at com.thoughtworks.xstream.core.ReferenceByXPathMarshallingStrategy.unmarshal(ReferenceByXPathMarshallingStrategy.java:29) at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:846) at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:833) at com.thoughtworks.xstream.XStream.fromXML(XStream.java:789) at org.springframework.integration.samples.mail.imapidle.DefaultEmailReceiverUtilService.main(DefaultEmailReceiverUtilService.java:103) Caused by: java.lang.InstantiationException: javax.activation.ActivationDataFlavor at java.lang.Class.newInstance0(Class.java:340) at java.lang.Class.newInstance(Class.java:308) at com.thoughtworks.xstream.converters.reflection.ExternalizableConverter.unmarshal(ExternalizableConverter.java:80) ... 39 more</p></li> </ul>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload