Guillaume,

Thanks again for another quick response.

I have to admit that my knowledge is this area is lacking (as if you
couldn't tell :)

I understand that I could put the transfer objects in the container
classloader, but I would prefer not to do that if at all possible.

In terms of serialization, would converting the object to, say, an xstream
source be appropriate?

James


gnodet wrote:
> 
> This is a classic problem wrt to classloaders.
> The same class loaded from two different class loaders
> is considered by the JVM as two different classes.
> Thus you can not cast your object because I guess
> the class has been embedded in two different SUs.
> 
> The only workaround is to serialize it somehow (binary, xml)
> or to put this class in a common classloader.  In this case,
> it would mean the container classloader.
> 
> On 10/28/06, bradtwurst <[EMAIL PROTECTED]> wrote:
>>
>> Hello,
>>
>> This time, I really am confused and I don't even know where to start to
>> solve the problem.
>>
>> Here is my configuration
>>
>> One service assembly containing three service units.
>>
>> Service unit 1 is an http based unit that consumes soap messages and
>> directs
>> the message to service unit 2
>>
>> Service unit 2 is a jsr181 based unit that contains the function call
>> 'update(Information value)' where the object Information is a 'transfer
>> object' that contains basic properties (Strings, Longs, Integers) and has
>> no
>> internal logic.
>>
>> Service unit 2 creates a new jbi message and adds to it the Information
>> object as a property of the message (msg.setProperty("payload", value);).
>>
>> Service unit 2 sends the newly created message with the destination
>> service/endpoint pointing to Service unit 3
>>
>> Service unit 3 is a lightweight based service that is pojo based.  Inside
>> of
>> it is an object that has the onMessageExchange event.
>>
>> Inside the onMessageExchange event, the Information object tries to be
>> extracted
>>           Information values = (Information)
>> message.getProperty("payload");
>> but insteads receives a ClassCastException.
>>
>> Now, the weird part is that before SU2 creates the new message, I sysout
>> the
>> Information object with no problem.
>>
>> For example,
>>       System.out.println(value); returns me
>> "[EMAIL PROTECTED]"
>>
>> and in SU3/onMessageExchange, I can perform the command
>>         System.out.println(message.getProperty("payload")); and I receive
>> the same response.
>>
>> But when I perform
>>       Information value = (Information) message.getProperty("payload");
>> on the very next line, I get the CCE error.
>>
>> Is there any help for me?
>>
>> As a side note, this logic worked great when I was doing unit/integration
>> testing.
>>
>> Thanks for the help,
>> James
>> --
>> View this message in context:
>> http://www.nabble.com/ClassCastException-tf2524368.html#a7041182
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> Cheers,
> Guillaume Nodet
> 
> 

-- 
View this message in context: 
http://www.nabble.com/ClassCastException-tf2524368.html#a7043045
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to