You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Gustav Sinder <gu...@ferrologic.se> on 2015/06/17 09:46:18 UTC
Unmarshalling serialization fails with ClassNotFoundException
Hi,
I'm working on converting a flow (consists of 2 camel contexts) to use Amazon SQS instead of ActiveMQ (which worked just fine).
Setup:
File -> Camel context 1 -> AWS SQS -> Camel context 2 -> Databsae
Connectivity isn't an issue but I need to marshal/unmarshal the messages using base64 since SQS only supports text messages.
Additionally I need to marshal the Java Objects using serialization prior to base64 since the base64 marshaller only takes a byte stream.
Camel context 1: (Marshal: serialization, base64), writes a CamelExchange
Camel context 2: (Unmarshal: base64, serialization), reads a CamelExchange
The issue occurs in the second context when I try to unmarshal the bytestream to the Java object and I get a ClassNotFoundException for "MyObject".
"MyMessage" -> "MyObject"
A common bundle exports the objects in question and both contexts imports them.
Camel version 2.12
Thanks
/Gustav
Re: Unmarshalling serialization fails with ClassNotFoundException
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
No its body only. And exchanging data using java objects is a bad
design. You end up being too coupled with java classes and whatnot.
On Tue, Jun 23, 2015 at 9:30 AM, Gustav Sinder
<gu...@ferrologic.se> wrote:
> I forgot to mention that I run Camel from a OSGi container (as part of JBoss Fuse).
> Seems there is a bug related to this for which a fix has been implemented already: https://issues.apache.org/jira/browse/CAMEL-4915
> However, since adding dynamic imports to camel-core solves the issue it seems that the bug is still there(?)
> Exact version of camel-core: 2.12.0.redhat-610379
>
> Moreover, I guess the serialization is done on the message body only and not the exchange since I lose all headers?
> Can I serialize the full message to include all headers?
>
> I do this in the first route:
> <camel:marshal>
> <camel:serialization />
> </camel:marshal>
> <camel:marshal>
> <camel:base64/>
> </camel:marshal>
>
> And the other way around in the second route.
>
> Thanks
> Gustav Sinder
>
> -----Original Message-----
> From: Gustav Sinder [mailto:gustav.sinder@ferrologic.se]
> Sent: den 17 juni 2015 09:46
> To: users@camel.apache.org
> Subject: Unmarshalling serialization fails with ClassNotFoundException
>
> Hi,
>
> I'm working on converting a flow (consists of 2 camel contexts) to use Amazon SQS instead of ActiveMQ (which worked just fine).
> Setup:
> File -> Camel context 1 -> AWS SQS -> Camel context 2 -> Databsae
>
> Connectivity isn't an issue but I need to marshal/unmarshal the messages using base64 since SQS only supports text messages.
> Additionally I need to marshal the Java Objects using serialization prior to base64 since the base64 marshaller only takes a byte stream.
>
> Camel context 1: (Marshal: serialization, base64), writes a CamelExchange Camel context 2: (Unmarshal: base64, serialization), reads a CamelExchange
>
> The issue occurs in the second context when I try to unmarshal the bytestream to the Java object and I get a ClassNotFoundException for "MyObject".
> "MyMessage" -> "MyObject"
>
> A common bundle exports the objects in question and both contexts imports them.
> Camel version 2.12
>
> Thanks
> /Gustav
--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/
RE: Unmarshalling serialization fails with ClassNotFoundException
Posted by Gustav Sinder <gu...@ferrologic.se>.
I forgot to mention that I run Camel from a OSGi container (as part of JBoss Fuse).
Seems there is a bug related to this for which a fix has been implemented already: https://issues.apache.org/jira/browse/CAMEL-4915
However, since adding dynamic imports to camel-core solves the issue it seems that the bug is still there(?)
Exact version of camel-core: 2.12.0.redhat-610379
Moreover, I guess the serialization is done on the message body only and not the exchange since I lose all headers?
Can I serialize the full message to include all headers?
I do this in the first route:
<camel:marshal>
<camel:serialization />
</camel:marshal>
<camel:marshal>
<camel:base64/>
</camel:marshal>
And the other way around in the second route.
Thanks
Gustav Sinder
-----Original Message-----
From: Gustav Sinder [mailto:gustav.sinder@ferrologic.se]
Sent: den 17 juni 2015 09:46
To: users@camel.apache.org
Subject: Unmarshalling serialization fails with ClassNotFoundException
Hi,
I'm working on converting a flow (consists of 2 camel contexts) to use Amazon SQS instead of ActiveMQ (which worked just fine).
Setup:
File -> Camel context 1 -> AWS SQS -> Camel context 2 -> Databsae
Connectivity isn't an issue but I need to marshal/unmarshal the messages using base64 since SQS only supports text messages.
Additionally I need to marshal the Java Objects using serialization prior to base64 since the base64 marshaller only takes a byte stream.
Camel context 1: (Marshal: serialization, base64), writes a CamelExchange Camel context 2: (Unmarshal: base64, serialization), reads a CamelExchange
The issue occurs in the second context when I try to unmarshal the bytestream to the Java object and I get a ClassNotFoundException for "MyObject".
"MyMessage" -> "MyObject"
A common bundle exports the objects in question and both contexts imports them.
Camel version 2.12
Thanks
/Gustav