diff --git a/activemq-karaf/src/main/resources/features.xml b/activemq-karaf/src/main/resources/features.xml index 8ae4c2de9c..bff5b70797 100644 --- a/activemq-karaf/src/main/resources/features.xml +++ b/activemq-karaf/src/main/resources/features.xml @@ -64,6 +64,7 @@ activemq-blueprint + activemq-spring jetty mvn:org.apache.activemq/activemq-optional/${activemq-version} mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.josql/${josql-version} @@ -73,6 +74,7 @@ mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.xmlbeans/${xmlbeans-bundle-version} mvn:org.apache.httpcomponents/httpcore-osgi/${httpclient-version} mvn:org.apache.httpcomponents/httpclient-osgi/${httpclient-version} + mvn:org.springframework/spring-oxm/${spring-version} diff --git a/activemq-optional/pom.xml b/activemq-optional/pom.xml index 65359225ff..ef7f7c96a4 100755 --- a/activemq-optional/pom.xml +++ b/activemq-optional/pom.xml @@ -162,9 +162,9 @@ test - org.springframework.ws - spring-oxm-tiger - true + org.springframework + spring-oxm + true org.apache.xbean diff --git a/activemq-optional/src/main/java/org/apache/activemq/util/oxm/OXMMessageTransformer.java b/activemq-optional/src/main/java/org/apache/activemq/util/oxm/OXMMessageTransformer.java index 8447851b59..a82241b4c6 100644 --- a/activemq-optional/src/main/java/org/apache/activemq/util/oxm/OXMMessageTransformer.java +++ b/activemq-optional/src/main/java/org/apache/activemq/util/oxm/OXMMessageTransformer.java @@ -17,17 +17,22 @@ package org.apache.activemq.util.oxm; +import java.io.StringReader; +import java.io.StringWriter; import javax.jms.JMSException; import javax.jms.ObjectMessage; import javax.jms.Session; import javax.jms.TextMessage; +import javax.xml.transform.Result; +import javax.xml.transform.Source; +import javax.xml.transform.stream.StreamResult; +import javax.xml.transform.stream.StreamSource; + +import org.springframework.oxm.support.AbstractMarshaller; -import org.springframework.oxm.AbstractMarshaller; -import org.springframework.xml.transform.StringResult; -import org.springframework.xml.transform.StringSource; /** - * Transforms object messages to text messages and vice versa using {@link Spring OXM} + * Transforms object messages to text messages and vice versa using Spring OXM. * */ public class OXMMessageTransformer extends AbstractXMLMessageTransformer { @@ -51,10 +56,12 @@ public class OXMMessageTransformer extends AbstractXMLMessageTransformer { */ protected String marshall(Session session, ObjectMessage objectMessage) throws JMSException { - StringResult result = new StringResult(); try { - marshaller.marshal(objectMessage.getObject(), result); - return result.toString(); + StringWriter writer = new StringWriter(); + Result result = new StreamResult(writer); + marshaller.marshal(objectMessage.getObject(), result); + writer.flush(); + return writer.toString(); } catch (Exception e) { throw new JMSException(e.getMessage()); } @@ -67,7 +74,9 @@ public class OXMMessageTransformer extends AbstractXMLMessageTransformer { protected Object unmarshall(Session session, TextMessage textMessage) throws JMSException { try { - return marshaller.unmarshal(new StringSource(textMessage.getText())); + String text = textMessage.getText(); + Source source = new StreamSource(new StringReader(text)); + return marshaller.unmarshal(source); } catch (Exception e) { throw new JMSException(e.getMessage()); } diff --git a/assembly/pom.xml b/assembly/pom.xml index 9bbf20c348..b956b88c07 100755 --- a/assembly/pom.xml +++ b/assembly/pom.xml @@ -230,8 +230,8 @@ false - org.springframework.ws - spring-oxm-tiger + org.springframework + spring-oxm org.codehaus.jettison diff --git a/assembly/src/main/descriptors/common-bin.xml b/assembly/src/main/descriptors/common-bin.xml index 5abb3215ed..a036554954 100644 --- a/assembly/src/main/descriptors/common-bin.xml +++ b/assembly/src/main/descriptors/common-bin.xml @@ -152,18 +152,18 @@ org.apache.geronimo.specs:geronimo-j2ee-connector_1.5_spec org.apache.xbean:xbean-spring org.springframework:spring-aop - org.springframework:spring-core + org.springframework:spring-asm org.springframework:spring-beans org.springframework:spring-context - org.springframework:spring-tx - org.springframework:spring-jms - org.springframework:spring-asm + org.springframework:spring-core org.springframework:spring-expression + org.springframework:spring-jms + org.springframework:spring-oxm + org.springframework:spring-tx com.thoughtworks.xstream:xstream xpp3:xpp3 org.codehaus.woodstox:woodstox-core-asl org.codehaus.woodstox:stax2-api - org.springframework.ws:spring-oxm-tiger org.codehaus.jettison:jettison org.apache.velocity:velocity org.apache.servicemix.bundles:org.apache.servicemix.bundles.josql diff --git a/pom.xml b/pom.xml index bf30479675..b72b07ddad 100755 --- a/pom.xml +++ b/pom.xml @@ -641,9 +641,9 @@ ${spring-version} - org.springframework.ws - spring-oxm-tiger - ${spring-oxm-version} + org.springframework + spring-oxm + ${spring-version} org.springframework.osgi