Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Cannot Reproduce
-
Affects Version/s: 1.3.1
-
Fix Version/s: None
-
Component/s: Converters
-
Labels:None
-
JDK version and platform:JDK 1.6, Windows
Description
Recently facing an issue with XStream which i'm using with Spring. We have a REST application where we are using XStream for marshalling & unmarshalling XML.
We have configured as shown below,
<bean id="xStreamMarshaller" class="org.springframework.oxm.xstream.XStreamMarshaller">
<property name="annotatedClasses">
<list><value>com.repobjects.OfflineOrderRepresentation</value></list>
</property>
<property name="autodetectAnnotations" value="true" />
</bean>
And this XStreamMarshaller is configured to HttpMessageconverter as shown,
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
<property name="messageConverters">
<util:list>
<bean class="org.springframework.http.converter.xml.MarshallingHttpMessageConverter">
<property name="marshaller" ref="xStreamMarshaller" />
<property name="unmarshaller" ref="xStreamMarshaller" />
</bean>
</util:list>
</property>
</bean>
The issue here is when i post proper XML it should match to it's corresponding XStream annotated class "OfflineOrderRepresentation",
but that is happening randomly, some times i'm getting syntactically incorrect message, and issue is getting fixed randomly if i restart the server.
Below is the error logs i'm getting,
[org.springframework.http.converter.xml.MarshallingHttpMessageConverter@712625b0]
[org.springframework.web.bind.annotation.support.HandlerMethodInvoker]
Reading [com.repobjects.OfflineOrderRepresentation]
[org.springframework.http.converter.xml.MarshallingHttpMessageConverter@712625b0]
[org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerExceptionResolver]
[controllers.OrderController@799a92d1]:
org.springframework.http.converter.HttpMessageNotReadableException: Could not read [class com.repobjects.OfflineOrderRepresentation];
Sorry, none of this classes is delivered by XStream. We have no clue, how Spring is initializing and using XStream, you will have to ask the Spring people.