You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Garrett Headley <gc...@yahoo.com> on 2007/11/19 15:51:13 UTC

interface problem

I have kind of a strange problem with interfaces that
I implement in my OSGi bundle.  I'm using ActiveMQ and
JMS as well to send messages from one class in a
bundle, which is later handled by another class in the
same bundle.  The host application starts up the
instance of felix, and tells felix to start up the
bundles, similar to the "main()" function in the
extender example on the felix website.

The issue I'm having is that any interfaces that are
implemented in the object that are wrapped in the
createObjectMessage() and then sent thru JMS, then
receiv ed by another of the bundle's classes
onMessage() seem to have lost the interface in the
class heirarchy.  The messages are simple POJOs, such
as

MyMessageObject implements StatusMessageI

and on the other end, when I print out the class, it
does say that it is of type MyMessageObject, but
instanceof StatusMessageI fails, and if I try to cast
it, I get an exception.

Has anyone else had issues similar to this?  I'd be
happy to send source code or post a more concrete
example.

Thanks
Garrett


      ____________________________________________________________________________________
Be a better sports nut!  Let your teams follow you 
with Yahoo Mobile. Try it now.  http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: interface problem

Posted by Karl Pauls <ka...@gmail.com>.
> I have kind of a strange problem with interfaces that
> I implement in my OSGi bundle.  I'm using ActiveMQ and
> JMS as well to send messages from one class in a
> bundle, which is later handled by another class in the
> same bundle.  The host application starts up the
> instance of felix, and tells felix to start up the
> bundles, similar to the "main()" function in the
> extender example on the felix website.
>
> The issue I'm having is that any interfaces that are
> implemented in the object that are wrapped in the
> createObjectMessage() and then sent thru JMS, then
> receiv ed by another of the bundle's classes
> onMessage() seem to have lost the interface in the
> class heirarchy.  The messages are simple POJOs, such
> as
>
> MyMessageObject implements StatusMessageI
>
> and on the other end, when I print out the class, it
> does say that it is of type MyMessageObject, but
> instanceof StatusMessageI fails, and if I try to cast
> it, I get an exception.

Looks like the interface has been loaded by the wrong classloader.
This is something the is somewhat more tricky when done in an OSGi
context. Is it possible for you to set the ThreadContextClassloader
before deserializing?

regards,

Karl

> Has anyone else had issues similar to this?  I'd be
> happy to send source code or post a more concrete
> example.
>
> Thanks
> Garrett
>
>
>       ____________________________________________________________________________________
> Be a better sports nut!  Let your teams follow you
> with Yahoo Mobile. Try it now.  http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>


-- 
Karl Pauls
karlpauls@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org