The problem is that the validating component may not be the only component to use the CopyTransformer. The DOM document may be put in the message properties by another component. You could try to explicitely remove the offending property from a derived validating component.
On 11/1/06, Eyji <[EMAIL PROTECTED]> wrote:
Hi! Tried this now, and it doesn't work unfortunately. The If-statement in the method assumes that the message is not of type StringSource which ours is. Upon forcing the method to taking StringSourcel anyways, the new content = sourceTransformer.toDOMSource(content); gives the same error. I would be eternally greatful if you have any more hints... Regards, /Eyji gnodet wrote: > > You could create a custom class derived from the CopyTransformer. > Just replace the call to sourceTransformer.toDOMSource(from) to > sourceTransformer.toDOMSource(content). > Then, you will need to configure it on the validation component > <property name="messageTransformer"> > <bean class="com.company.myNewCopyTransformer" /> > </property> > > It should work. > > On 10/31/06, Eyji <[EMAIL PROTECTED]> wrote: >> >> Thanks for your quick reply yet again! >> We'll fix a JIRA for this, but is there a workaround for this you could >> recommend which we could try in SM? Maybe switching implementations or >> something, surely someone else should have run into this issue before. >> >> /Eyji >> >> >> gnodet wrote: >> > >> > The problems comes from the SourceTransformer class which is >> > used by the CopyTransformer. >> > When asked for a DOM representation of a NormalizedMessage, it >> > stores the parsed DOM node in a property on the message. >> > >> > Could you please raise a JIRA for this issue ? >> > >> > On 10/31/06, Eyji <[EMAIL PROTECTED]> wrote: >> >> >> >> Hope you can help me out here: A validation component of mine is >> >> configured >> >> as follows: >> >> >> >> <sm:activationSpec componentName="validerare" service="foo:validerare" >> >> endpoint="validerare" destinationService="foo:loggare"> >> >> <sm:component> >> >> <bean >> >> class="org.apache.servicemix.components.validation.ValidateComponent"> >> >> <property >> >> name="schemaResource" value="classpath:FOOAnwer.xsd" /> >> >> <property >> >> name="errorHandler" >> >> ref="messageAggregatingErrorHandlerFactory"/> >> >> </bean> >> >> <bean >> >> class="org.apache.servicemix.components.validation.ValidateComponent"> >> >> <property >> >> name="schemaResource" value="classpath:FOOQuestion.xsd" /> >> >> <property >> >> name="errorHandler" >> >> ref="messageAggregatingErrorHandlerFactory"/> >> >> </bean> >> >> </sm:component> >> >> </sm:activationSpec> >> >> >> >> The xml messages are retrieved from a JMS-queue. If the XML file >> >> FOOAnswer.xml is validated first, all is OK. Upon dropping the >> >> FOOAnswer.xml >> >> on the Queue, the Runtime-exception below is thrown. If I try to >> resend >> >> FOOAnswer.xml again, I get the same exception and nothing works until >> I >> >> restart SM. >> >> >> >> Stacktrace of Exception: >> >> --------------------------------- >> >> >> >> WARN - ValidateComponent - Unable to handle error: >> >> java.lang.RuntimeException: javax.xml.transform.dom.DOMSource >> >> java.lang.RuntimeException: javax.xml.transform.dom.DOMSource >> >> at >> >> >> org.apache.activemq.command.ActiveMQObjectMessage.storeContent(ActiveMQObjectMessage.java:102) >> >> at >> >> >> org.apache.activemq.command.ActiveMQObjectMessage.setObject(ActiveMQObjectMessage.java:144) >> >> at >> >> >> org.apache.activemq.ActiveMQSession.createObjectMessage(ActiveMQSession.java:361) >> >> at >> >> >> org.apache.activemq.ra.ManagedSessionProxy.createObjectMessage(ManagedSessionProxy.java:215) >> >> at >> >> >> org.apache.servicemix.jbi.nmr.flow.jca.JCAFlow.sendJmsMessage(JCAFlow.java:703) >> >> at >> >> >> org.apache.servicemix.jbi.nmr.flow.jca.JCAFlow.doRouting(JCAFlow.java:561) >> >> at >> >> >> org.apache.servicemix.jbi.nmr.flow.jca.JCAFlow.doSend(JCAFlow.java:520) >> >> at >> >> >> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.send(AbstractFlow.java:121) >> >> at >> >> >> org.apache.servicemix.jbi.nmr.DefaultBroker.sendExchangePacket(DefaultBroker.java:298) >> >> at >> >> >> org.apache.servicemix.jbi.security.SecuredBroker.sendExchangePacket(SecuredBroker.java:80) >> >> at >> >> >> org.apache.servicemix.jbi.container.JBIContainer.sendExchange(JBIContainer.java:793) >> >> at >> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(DeliveryChannelImpl.java:375) >> >> at >> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(DeliveryChannelImpl.java:411) >> >> at >> >> >> org.apache.servicemix.components.util.PojoSupport.fail(PojoSupport.java:275) >> >> at >> >> >> org.apache.servicemix.components.util.TransformComponentSupport.onMessageExchange(TransformComponentSupport.java:92) >> >> at >> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:624) >> >> at >> >> >> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:169) >> >> at >> >> >> org.apache.servicemix.jbi.nmr.flow.jca.JCAFlow.onMessage(JCAFlow.java:596) >> >> at org.jencks.XAEndpoint.onMessage(XAEndpoint.java:126) >> >> at >> >> >> org.apache.activemq.ra.MessageEndpointProxy$MessageEndpointAlive.onMessage(MessageEndpointProxy.java:120) >> >> at >> >> >> org.apache.activemq.ra.MessageEndpointProxy.onMessage(MessageEndpointProxy.java:60) >> >> at >> >> org.apache.activemq.ActiveMQSession.run(ActiveMQSession.java:692) >> >> at >> >> >> org.apache.activemq.ra.ServerSessionImpl.run(ServerSessionImpl.java:163) >> >> at >> >> >> org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:291) >> >> at >> >> EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown >> >> Source) >> >> at java.lang.Thread.run(Thread.java:595) >> >> Caused by: java.io.NotSerializableException: >> >> javax.xml.transform.dom.DOMSource >> >> at >> >> java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1075) >> >> at >> >> java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:291) >> >> at java.util.HashMap.writeObject(HashMap.java:983) >> >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >> >> at >> >> >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) >> >> at >> >> >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) >> >> at java.lang.reflect.Method.invoke(Method.java:585) >> >> at >> >> >> java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:890) >> >> at >> >> >> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1333) >> >> at >> >> >> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1284) >> >> at >> >> java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1073) >> >> at >> >> java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:291) >> >> at >> >> >> org.apache.servicemix.jbi.messaging.NormalizedMessageImpl.writeExternal(NormalizedMessageImpl.java:305) >> >> at >> >> >> java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1304) >> >> at >> >> >> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1282) >> >> at >> >> java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1073) >> >> at >> >> >> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1369) >> >> at >> >> >> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1341) >> >> at >> >> >> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1284) >> >> at >> >> java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1073) >> >> at >> >> java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:291) >> >> at >> >> >> org.apache.servicemix.jbi.messaging.ExchangePacket.writeExternal(ExchangePacket.java:373) >> >> at >> >> >> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.writeExternal(MessageExchangeImpl.java:562) >> >> at >> >> >> java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1304) >> >> at >> >> >> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1282) >> >> at >> >> java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1073) >> >> at >> >> java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:291) >> >> at >> >> >> org.apache.activemq.command.ActiveMQObjectMessage.storeContent(ActiveMQObjectMessage.java:98) >> >> >> >> Regards, >> >> /Eyji >> >> -- >> >> View this message in context: >> >> http://www.nabble.com/Validation-Exception-tf2545818.html#a7093895 >> >> Sent from the ServiceMix - User mailing list archive at Nabble.com. >> >> >> >> >> > >> > >> > -- >> > Cheers, >> > Guillaume Nodet >> > >> > >> >> -- >> View this message in context: >> http://www.nabble.com/Validation-Exception-tf2545818.html#a7094332 >> Sent from the ServiceMix - User mailing list archive at Nabble.com. >> >> > > > -- > Cheers, > Guillaume Nodet > > -- View this message in context: http://www.nabble.com/Validation-Exception-tf2545818.html#a7114072 Sent from the ServiceMix - User mailing list archive at Nabble.com.
-- Cheers, Guillaume Nodet
