Hi,
I have tried a bit and it looks like the problem is not really fixed. At least
in the last snapshot was the serializable class not implemented in the
bytearraydatasource, so I added it and got a new error.
Here is my sourcecode snippet for my jms-bytes-marshaler:
public void toNMS(NormalizedMessage normalizedMessage, Message message)
throws JMSException, MessagingException {
addNmsProperties(normalizedMessage, message);
if (message instanceof TextMessage) {
TextMessage textMessage = (TextMessage) message;
Source source = sourceMarshaler.asSource(textMessage.getText());
normalizedMessage.setContent(source);
}
if(message instanceof BytesMessage){
BytesMessage b = (BytesMessage) message;
byte[] bm = new byte[(int)b.getBodyLength()];
b.readBytes(bm);
InputStream in = new ByteArrayInputStream(bm);
DataSource ds = new StreamDataSource(in);
//DataSource ds = new ByteArrayDataSource(bm);
DataHandler handler = new DataHandler(ds);
normalizedMessage.addAttachment("content", handler);
}
// lets add the message to the NMS
// Fix SM-178 : the message exchange is not serializable
//normalizedMessage.setProperty("org.apache.servicemix.jms.message",
message);
}
So this code (with StreamDataSource or ByteArrayDataSource) throws the same
error, which is this:
java.lang.RuntimeException: javax.activation.DataHandler
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:351)
at
org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.doRouting(JMSFlow.java:425)
at
org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.doSend(JMSFlow.java:405)
at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.send(AbstractFlow.java:121)
at
org.apache.servicemix.jbi.nmr.Broker.sendExchangePacket(Broker.java:295)
at
org.apache.servicemix.jbi.container.JBIContainer.sendExchange(JBIContainerjava:683)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(DeliveryChannelImpl.java:450)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(DeliveryChannelImpl.java:490)
at
org.apache.servicemix.components.jms.JmsInBinding.onMessage(JmsInBinding.java:66)
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(MessageEndpointProxyjava:60)
at org.apache.activemq.ActiveMQSession.run(ActiveMQSession.java:664)
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.activation.DataHandler
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1075)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:291)
at java.util.HashMap.writeObject(HashMap.java:985)
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:298)
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.servicemix.jbi.messaging.ExchangePacket.writeExternal(ExchangePacket.java:374)
at
org.apache.servicemix.jbi.messaging.MessageExchangeImpl.writeExternal(MessageExchangeImpl.java:529)
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)
... 18 more
So might the error lay somewhere else or is there something I haven't thought
of?
cya
mike
-----Ursprüngliche Nachricht-----
Von: Guillaume Nodet [mailto:[EMAIL PROTECTED]
Gesendet: Dienstag, 11. April 2006 15:57
An: [email protected]
Betreff: Re: BinaryFileMarshaler
The NotSerializableException should be fixed in latest svn head.
And yes, you have to create your own custom marshaler to handle
non-xml data.
Cheers,
Guillaume Nodet
On 4/11/06, Gerdes, Mike <[EMAIL PROTECTED]> wrote:
>
> hi,
>
> has anyone tried to use the BinaryFileMarshaler? I have tried to use it with
> the file-binding example and as a result I get only empty files. Is this a
> configuration error on my side?
> Oh I was wondering if it is possible to send BytesMessages from a JMS source
> to SM? I was trying it and juggling around with the JMSMarshaller and got a
> problem with the DataHandler and a NotSerializableException.
>
> cya
>
> mike
>
> This mail has originated outside your organization, either from an external
> partner or the Global Internet. Keep this in mind if you answer this message.
>
This mail has originated outside your organization,
either from an external partner or the Global Internet.
Keep this in mind if you answer this message.
This mail has originated outside your organization, either from an external
partner or the Global Internet. Keep this in mind if you answer this message.