THis is certainly a classloader issue.
Do you have two copies of the object in two different bundles ?
If yes, that would explain the problem.  The solution is to create a
bundle that contain this shared class and import the package from your
two other bundles.

On Wed, Dec 10, 2008 at 12:54 PM, Martin Kuhn <[EMAIL PROTECTED]> wrote:
>
> I'm working with SMX4 and want to send an object from one servicemix-bean to
> another.
>
> Here is my code:
>
> In the sender bean:
> ...
> EntryObject entryObject = ....;
> DataHandler dataHandler = new DataHandler(entryObject,
> "application/octet-stream");
> normalizedMessage.addAttachment(Constants.AUDITLOGENTRY_OBJECT,
> dataHandler);
> ...
>
>
> In the receiver bean:
>
> DataHandler dataHandler=
> message.getAttachment(Constants.AUDITLOGENTRY_OBJECT);
> Object object=dataHandler.getContent();
> System.out.println(object.getClass().getName());
>
> // here I get a class cast exception ->  java.lang.ClassCastException:
> com.xyz.EntryObject cannot be cast to com.xyz.EntryObject
> EntryObject entryObject = (EntryObject)object;
>
>
>
> This is really strange for me. Also debugging shows me that the object
> received is the same as sent.
>
> Could anybody of you give me a hint what's wrong?
>
> TIA
>
> Regards
>
> Martin
> --
> View this message in context: 
> http://www.nabble.com/Strange-ClassCastException-on-sending-an-object-as-attachment-from-one-smx-bean-to-another-tp20933798p20933798.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com

Reply via email to