You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by edhansen42 <ed...@vsp.com> on 2014/04/01 07:09:05 UTC
Exception unmarshalling XML with jaxb
I am trying to unmarshal XML from a WMQ endpoint and getting the following
exception:
*Error during type conversion from type: java.io.ByteArrayInputStream to the
required type: javax.xml.stream.XMLStreamReader with value
java.io.ByteArrayInputStream@3fb8b912 due Could not instantiate an instance
of: javax.xml.stream.XMLStreamReader*
I have looked through all the posts regarding jaxb and have not found a
similar problem.
Here's the route:
from("wmq:queue:foo")
.unmarshal(new JaxbDataFormat(Client.class.getPackage().getName()))
.beanRef("wmqEndpointLifecycleService", "processMessage(${body})")
;
I've also tried adding the following before the unmarshal, but get the same
result.
.convertBodyTo(String.class)
Here's the Client class:
public class Client implements java.io.Serializable {
private static final long serialVersionUID = 9099389416162309789L;
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
Here's the XML:
<?xml version="1.0" encoding="UTF-8"?>
<java version="1.7.0_09" class="java.beans.XMLDecoder">
<object class="com.foo.Client">
<void property="name">
<string>Hello World!!</string>
</void>
<object>
</java>
I created the the XML using XMLEncoder
--
View this message in context: http://camel.465427.n5.nabble.com/Exception-unmarshalling-XML-with-jaxb-tp5749592.html
Sent from the Camel - Users mailing list archive at Nabble.com.