You are definitely right. I have change the try/catch in order to catch Throwable and not only RunTimeException, and now I can see the stack trace. The problem is a simple ClassNotFound for the Measure class... I do not understand, because the osgi bundle is importing the package, but I am going to investigate this..
Thank you all,
 Eva

BJ Hargrave escribió:
Put a try/catch around it and print out the stack trace. Perhaps you did not import the package containing the Measure class?
--

*BJ Hargrave*
Senior Technical Staff Member, IBM
OSGi Fellow and CTO of the _OSGi Alliance_ <http://www.osgi.org/>_
__hargr...@us.ibm.com_ <mailto:hargr...@us.ibm.com>       

office: +1 386 848 1781
mobile: +1 386 848 3788




From:   Eva Madrazo <eva.madr...@grpss.ssr.upm.es>
To:     OSGi Developer Mail List <osgi-dev@mail.osgi.org>
Date:   2010/03/16 10:48
Subject:        Re: [osgi-dev] problem while receiving an Event
Sent by:        osgi-dev-boun...@mail.osgi.org


------------------------------------------------------------------------



mmm this is also very strange, I added this code

if (Measure.class == event.getProperty("measure").getClass() ){
               log.logdebug("* equal "  );
           } else {
log.logdebug("* not equal " ); }

And this also throws the error, no one of this logs is shown but
16-03-2010 15:26:35 ERROR - Exception while dispatching event
org.osgi.service.event.Event [topic=topicName] to handler
mypackage.simpleeventhand...@7b037b03




BJ Hargrave escribió:
> I suspect that the event source and event listener are using different
> Measure classes. In the event listener, what does Measure.class ==
> event.getProperty("measure").getClass() equal?
> --
>
> *BJ Hargrave*
> Senior Technical Staff Member, IBM
> OSGi Fellow and CTO of the _OSGi Alliance_ <http://www.osgi.org/>_
> __hargr...@us.ibm.com_ <mailto:hargr...@us.ibm.com> >
> office: +1 386 848 1781
> mobile: +1 386 848 3788
>
>
>
>
> From:                  Eva Madrazo <eva.madr...@grpss.ssr.upm.es>
> To:                  osgi-dev@mail.osgi.org
> Date:                  2010/03/16 07:52
> Subject: Re: [osgi-dev] problem while receiving an Event
> Sent by:                  osgi-dev-boun...@mail.osgi.org
>
>
> ------------------------------------------------------------------------
>
>
>
> Hi Miguel,
> thanks for the quick answer.  In my org.osgi.service.event.Event
> implementation there isn't a constructor (String, Map) for the event
> object, there is a constructor that uses a Dictionary object instead
> .Nevertheless the rest is equivalent to my code.
>
> The events are posted, but it seems that it fails the conversion of
> the object included in the properties object.  When I construct the
> properties I have:
> > props.put("measure", (Measure)measure);
>
> But, when I retrieve this property from the event:
> > Measure measure = (Measure)
> event.getProperty("measure");
>
> The error is launched > ERROR - Exception while dispatching event org.osgi.service.event.Event
> [topic=topicName] to handler mypackage.simpleeventhand...@3e953e95
>
>
> .... any ideas?
> thanks!
>
>
> Date: Tue, 16 Mar 2010 11:31:05 +0100
> From: Miguel <migue...@gmail.com>
> Subject: Re: [osgi-dev] problem while receiving an Event
> To: OSGi Developer Mail List <osgi-dev@mail.osgi.org>
> Message-ID:
> > <6ed2320c1003160331n73f54f20gc53935ade58a4...@mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> try to use event admin this way:
>
> String topic = "here_my_topic_to_be_filtered";
>           Map properties = new Properties();
>
> [...]
>
>           Event ev = new Event(topic, properties);
>
> and post the event this way:
>
> _eventAdmin.postEvent ( ev );
>
>
> where _eventAdmin is the service reference ...
>
>
>
> Miguel
>
>
> On Tue, Mar 16, 2010 at 11:20 AM, Eva Madrazo
> <eva.madr...@grpss.ssr.upm.es>wrote:
>
>
> > > Hi,
> > > maybe this is a very simple problem but I do not achieve to
> resolve it and
> > > I found difficult to find information about it, so sorry if this
> is being
> > > answered before.  First of all I'm executing an equinox eRCP
> platform on a
> > > Windows Mobile 6.1 using J9.
> > >
> > > I have a very strange problem while receiving an Event.  When
> posting the
> > > event I add a propietary object (Measure) to the hashtable props:
> > >
> > >         Hashtable props = new Hashtable();
> > >         props.put("measure", measure);
> > >         eventAdmin.postEvent(new Event(measure.getName(), props));
> > >
> > > When receiving the event I want to extract this Measure object. If
> I do
> > >   Object measure = (Object) event.getProperty("measure");
> > >
> > > no problem occur, but when I try to do:
> > >
> > >   Measure measure = (Measure) event.getProperty("measure");
> > >
> > > I have this error in logs:
> > > ERROR - Exception while dispatching event org.osgi.service.event.Event
> > > [topic=topicName] to handler mypackage.simpleeventhand...@3e953e95
> > >
> > >
> > > I have check that the bundle imports the bundle with the definition of
> > > Measure object.
> > >
> > > I cannot imagine anything to change, please help me  :)
> > >
> > > Thank you very much,
> > >  Eva
> > >
> _______________________________________________
> OSGi Developer Mail List
> osgi-dev@mail.osgi.org
> https://mail.osgi.org/mailman/listinfo/osgi-dev
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> OSGi Developer Mail List
> osgi-dev@mail.osgi.org
> https://mail.osgi.org/mailman/listinfo/osgi-dev

_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

------------------------------------------------------------------------

_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to