[sip-comm-dev] error while registering service


#1

Hi devs,

I'm trying to register the service i'm working on...and i've got an error
message that I can't figure out.

here is the error ( make target ends with no error) appearing when I execute
the run target:

ERROR: EventDispatcher: Error during dispatch. (java.lang.ClassCastException:
net.java.sip.communicator.impl.spellcheck.SpellCheckServiceImpl cannot be
cast to net.java.sip.communicator.service.protocol.ProtocolProviderService)
java.lang.ClassCastException:
net.java.sip.communicator.impl.spellcheck.SpellCheckServiceImpl cannot be
cast to net.java.sip.communicator.service.protocol.ProtocolProviderService
        at
net.java.sip.communicator.impl.systray.jdic.SystrayServiceJdicImpl.serviceChanged
(SystrayServiceJdicImpl.java:302)
        at
org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback
(EventDispatcher.java:712)
        at
org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(
EventDispatcher.java:570)
        at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(
EventDispatcher.java:502)
        at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java
:2843)
        at org.apache.felix.framework.Felix.access$100(Felix.java:36)
        at org.apache.felix.framework.Felix$1.serviceChanged(Felix.java:242)
        at org.apache.felix.framework.ServiceRegistry.fireServiceChanged(
ServiceRegistry.java:435)
        at org.apache.felix.framework.ServiceRegistry.registerService(
ServiceRegistry.java:71)
        at org.apache.felix.framework.Felix.registerService(Felix.java:2107)
        at org.apache.felix.framework.BundleContextImpl.registerService(
BundleContextImpl.java:252)
        at org.apache.felix.framework.BundleContextImpl.registerService(
BundleContextImpl.java:230)
        at
net.java.sip.communicator.impl.spellcheck.SpellCheckActivator.start(
SpellCheckActivator.java:89)
        at org.apache.felix.framework.util.SecureAction.startActivator(
SecureAction.java:509)
        at org.apache.felix.framework.Felix._startBundle(Felix.java:1260)
        at org.apache.felix.framework.Felix.startBundle(Felix.java:1201)
        at org.apache.felix.framework.Felix.setFrameworkStartLevel(
Felix.java:807)
        at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java
:256)
        at java.lang.Thread.run(Thread.java:619)

but after that the logger finishes to print :

FIN: impl.spellcheck.SpellCheckServiceImpl.start().93 Service Impl:
net.java.sip.communicator.impl.spellcheck.SpellCheckActivator [REGISTERED]

So is the service registered ?
and what could be the reason of the error above ?

thx guys and keep up the good work

Jean-Daniel


#2

Hello JD,

Looks like a copy paste error.

Make sure that when you register your service, you do so using the class name of your own service and not the one of the ProtocolProviderService.

Hope this helps.

Emil

JD wrote:

···

Hi devs,

I'm trying to register the service i'm working on...and i've got an error message that I can't figure out.

here is the error ( make target ends with no error) appearing when I execute the run target:

ERROR: EventDispatcher: Error during dispatch. (java.lang.ClassCastException: net.java.sip.communicator.impl.spellcheck.SpellCheckServiceImpl cannot be cast to net.java.sip.communicator.service.protocol.ProtocolProviderService )
java.lang.ClassCastException: net.java.sip.communicator.impl.spellcheck.SpellCheckServiceImpl cannot be cast to net.java.sip.communicator.service.protocol.ProtocolProviderService
        at net.java.sip.communicator.impl.systray.jdic.SystrayServiceJdicImpl.serviceChanged(SystrayServiceJdicImpl.java:302)
        at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:712)
        at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:570)
        at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent (EventDispatcher.java:502)
        at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:2843)
        at org.apache.felix.framework.Felix.access$100(Felix.java:36)
        at org.apache.felix.framework.Felix$1.serviceChanged(Felix.java:242)
        at org.apache.felix.framework.ServiceRegistry.fireServiceChanged(ServiceRegistry.java:435)
        at org.apache.felix.framework.ServiceRegistry.registerService(ServiceRegistry.java:71)
        at org.apache.felix.framework.Felix.registerService (Felix.java:2107)
        at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:252)
        at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:230)
        at net.java.sip.communicator.impl.spellcheck.SpellCheckActivator.start (SpellCheckActivator.java:89)
        at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:509)
        at org.apache.felix.framework.Felix._startBundle(Felix.java:1260)
        at org.apache.felix.framework.Felix.startBundle (Felix.java:1201)
        at org.apache.felix.framework.Felix.setFrameworkStartLevel(Felix.java:807)
        at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:256)
        at java.lang.Thread.run(Thread.java:619)

but after that the logger finishes to print :

FIN: impl.spellcheck.SpellCheckServiceImpl.start().93 Service Impl: net.java.sip.communicator.impl.spellcheck.SpellCheckActivator [REGISTERED]

So is the service registered ?
and what could be the reason of the error above ?

thx guys and keep up the good work

Jean-Daniel

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net


#3

In fact the error what located in
net.java.sip.communicator.impl.systray.jdic.SystrayServiceJdicImpl

method serviceChanged and here is the fix :

    public void serviceChanged(ServiceEvent event)
    {
        Object service = SystrayActivator.bundleContext
                .getService(event.getServiceReference());

        if (! (service instanceof ProtocolProviderService))
            return;

        ProtocolProviderService provider = (ProtocolProviderService)service;

        if (event.getType() == ServiceEvent.REGISTERED){
            protocolProviderTable.put(provider.getAccountID(),provider);
            handleProviderAdded(provider);

        }
        if (event.getType() == ServiceEvent.UNREGISTERING){
           protocolProviderTable.remove(provider.getAccountID());
           handleProviderRemoved(provider);
        }

···

2007/5/21, Emil Ivov <emcho@emcho.com>:

Hello JD,

Looks like a copy paste error.

Make sure that when you register your service, you do so using the class
name of your own service and not the one of the ProtocolProviderService.

Hope this helps.

Emil

JD wrote:
> Hi devs,
>
> I'm trying to register the service i'm working on...and i've got an
> error message that I can't figure out.
>
> here is the error ( make target ends with no error) appearing when I
> execute the run target:
>
> ERROR: EventDispatcher: Error during dispatch.
> (java.lang.ClassCastException:
> net.java.sip.communicator.impl.spellcheck.SpellCheckServiceImpl cannot
> be cast to
> net.java.sip.communicator.service.protocol.ProtocolProviderService )
> java.lang.ClassCastException:
> net.java.sip.communicator.impl.spellcheck.SpellCheckServiceImpl cannot
> be cast to
> net.java.sip.communicator.service.protocol.ProtocolProviderService
> at
>
net.java.sip.communicator.impl.systray.jdic.SystrayServiceJdicImpl.serviceChanged
(SystrayServiceJdicImpl.java:302)
> at
>
org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback
(EventDispatcher.java:712)
> at
> org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(
EventDispatcher.java:570)
> at
> org.apache.felix.framework.util.EventDispatcher.fireServiceEvent
> (EventDispatcher.java:502)
> at
> org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:2843)
> at org.apache.felix.framework.Felix.access$100(Felix.java:36)
> at
> org.apache.felix.framework.Felix$1.serviceChanged(Felix.java:242)
> at
> org.apache.felix.framework.ServiceRegistry.fireServiceChanged(
ServiceRegistry.java:435)
> at
> org.apache.felix.framework.ServiceRegistry.registerService(
ServiceRegistry.java:71)
> at org.apache.felix.framework.Felix.registerService
> (Felix.java:2107)
> at
> org.apache.felix.framework.BundleContextImpl.registerService(
BundleContextImpl.java:252)
> at
> org.apache.felix.framework.BundleContextImpl.registerService(
BundleContextImpl.java:230)
> at
> net.java.sip.communicator.impl.spellcheck.SpellCheckActivator.start
> (SpellCheckActivator.java:89)
> at
> org.apache.felix.framework.util.SecureAction.startActivator(
SecureAction.java:509)
> at org.apache.felix.framework.Felix._startBundle(Felix.java
:1260)
> at org.apache.felix.framework.Felix.startBundle (Felix.java
:1201)
> at
> org.apache.felix.framework.Felix.setFrameworkStartLevel(Felix.java:807)
> at
> org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:256)
> at java.lang.Thread.run(Thread.java:619)
>
> but after that the logger finishes to print :
>
> FIN: impl.spellcheck.SpellCheckServiceImpl.start().93 Service Impl:
> net.java.sip.communicator.impl.spellcheck.SpellCheckActivator[REGISTERED]
>
> So is the service registered ?
> and what could be the reason of the error above ?
>
> thx guys and keep up the good work
>
> Jean-Daniel

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net


#4

Hey JD,

Nice!

I've committed your fix. Let me know if it's working now.

Thanks
Emil

JD wrote:

···

In fact the error what located in net.java.sip.communicator.impl.systray.jdic.SystrayServiceJdicImpl

method serviceChanged and here is the fix :

    public void serviceChanged(ServiceEvent event)
    {
        Object service = SystrayActivator.bundleContext
                .getService( event.getServiceReference());
               if (! (service instanceof ProtocolProviderService))
            return;
               ProtocolProviderService provider = (ProtocolProviderService)service;
               if (event.getType() == ServiceEvent.REGISTERED){
            protocolProviderTable.put(provider.getAccountID(),provider);
            handleProviderAdded(provider);
                   }
        if (event.getType() == ServiceEvent.UNREGISTERING){
           protocolProviderTable.remove(provider.getAccountID());
           handleProviderRemoved(provider);
        }

2007/5/21, Emil Ivov <emcho@emcho.com <mailto:emcho@emcho.com>>:

    Hello JD,

    Looks like a copy paste error.

    Make sure that when you register your service, you do so using the class
    name of your own service and not the one of the ProtocolProviderService.

    Hope this helps.

    Emil

    JD wrote:
     > Hi devs,
     >
     > I'm trying to register the service i'm working on...and i've got an
     > error message that I can't figure out.
     >
     > here is the error ( make target ends with no error) appearing when I
     > execute the run target:
     >
     > ERROR: EventDispatcher: Error during dispatch.
     > (java.lang.ClassCastException:
     > net.java.sip.communicator.impl.spellcheck.SpellCheckServiceImpl
    cannot
     > be cast to
     > net.java.sip.communicator.service.protocol.ProtocolProviderService )
     > java.lang.ClassCastException:
     > net.java.sip.communicator.impl.spellcheck.SpellCheckServiceImpl
    cannot
     > be cast to
     > net.java.sip.communicator.service.protocol.ProtocolProviderService
     > at
     >
    net.java.sip.communicator.impl.systray.jdic.SystrayServiceJdicImpl.serviceChanged(SystrayServiceJdicImpl.java:302)
     > at
     >
    org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:712)
     > at
     >
    org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java
    :570)
     > at
     > org.apache.felix.framework.util.EventDispatcher.fireServiceEvent
     > (EventDispatcher.java:502)
     > at
     > org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:2843)
     > at org.apache.felix.framework.Felix.access$100(Felix.java:36)
     > at
     > org.apache.felix.framework.Felix$1.serviceChanged(Felix.java:242)
     > at
     > org.apache.felix.framework.ServiceRegistry.fireServiceChanged
    (ServiceRegistry.java:435)
     > at
     >
    org.apache.felix.framework.ServiceRegistry.registerService(ServiceRegistry.java:71)
     > at org.apache.felix.framework.Felix.registerService
     > (Felix.java :2107)
     > at
     >
    org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:252)
     > at
     >
    org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java
    :230)
     > at
     > net.java.sip.communicator.impl.spellcheck.SpellCheckActivator.start
     > (SpellCheckActivator.java:89)
     > at
     > org.apache.felix.framework.util.SecureAction.startActivator
    (SecureAction.java:509)
     > at
    org.apache.felix.framework.Felix._startBundle(Felix.java:1260)
     > at org.apache.felix.framework.Felix.startBundle
    (Felix.java:1201)
     > at
     > org.apache.felix.framework.Felix.setFrameworkStartLevel
    (Felix.java:807)
     > at
     >
    org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:256)
     > at java.lang.Thread.run(Thread.java:619)
     >
     > but after that the logger finishes to print :
     >
     > FIN: impl.spellcheck.SpellCheckServiceImpl.start().93 Service Impl:
     > net.java.sip.communicator.impl.spellcheck.SpellCheckActivator
    [REGISTERED]
     >
     > So is the service registered ?
     > and what could be the reason of the error above ?
     >
     > thx guys and keep up the good work
     >
     > Jean-Daniel

    ---------------------------------------------------------------------
    To unsubscribe, e-mail:
    dev-unsubscribe@sip-communicator.dev.java.net
    <mailto:dev-unsubscribe@sip-communicator.dev.java.net>
    For additional commands, e-mail:
    dev-help@sip-communicator.dev.java.net
    <mailto:dev-help@sip-communicator.dev.java.net>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net


#5

Hi,

It seems to work "like a charm" since I don't have this problem anymore.

JD

···

2007/5/21, Emil Ivov <emcho@emcho.com>:

Hey JD,

Nice!

I've committed your fix. Let me know if it's working now.

Thanks
Emil

JD wrote:
> In fact the error what located in
> net.java.sip.communicator.impl.systray.jdic.SystrayServiceJdicImpl
>
> method serviceChanged and here is the fix :
>
> public void serviceChanged(ServiceEvent event)
> {
> Object service = SystrayActivator.bundleContext
> .getService( event.getServiceReference());
>
> if (! (service instanceof ProtocolProviderService))
> return;
>
> ProtocolProviderService provider =
> (ProtocolProviderService)service;
>
> if (event.getType() == ServiceEvent.REGISTERED){
> protocolProviderTable.put(provider.getAccountID(),provider);
> handleProviderAdded(provider);
>
> }
> if (event.getType() == ServiceEvent.UNREGISTERING){
> protocolProviderTable.remove(provider.getAccountID());
> handleProviderRemoved(provider);
> }
>
> 2007/5/21, Emil Ivov <emcho@emcho.com <mailto:emcho@emcho.com>>:
>
> Hello JD,
>
> Looks like a copy paste error.
>
> Make sure that when you register your service, you do so using the
class
> name of your own service and not the one of the
ProtocolProviderService.
>
> Hope this helps.
>
> Emil
>
> JD wrote:
> > Hi devs,
> >
> > I'm trying to register the service i'm working on...and i've got
an
> > error message that I can't figure out.
> >
> > here is the error ( make target ends with no error) appearing
when I
> > execute the run target:
> >
> > ERROR: EventDispatcher: Error during dispatch.
> > (java.lang.ClassCastException:
> > net.java.sip.communicator.impl.spellcheck.SpellCheckServiceImpl
> cannot
> > be cast to
> >
net.java.sip.communicator.service.protocol.ProtocolProviderService )
> > java.lang.ClassCastException:
> > net.java.sip.communicator.impl.spellcheck.SpellCheckServiceImpl
> cannot
> > be cast to
> >
net.java.sip.communicator.service.protocol.ProtocolProviderService
> > at
> >
>
net.java.sip.communicator.impl.systray.jdic.SystrayServiceJdicImpl.serviceChanged
(SystrayServiceJdicImpl.java:302)
> > at
> >
>
org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback
(EventDispatcher.java:712)
> > at
> >
> org.apache.felix.framework.util.EventDispatcher.fireEventImmediately
(EventDispatcher.java
> :570)
> > at
> > org.apache.felix.framework.util.EventDispatcher.fireServiceEvent
> > (EventDispatcher.java:502)
> > at
> > org.apache.felix.framework.Felix.fireServiceEvent(Felix.java
:2843)
> > at org.apache.felix.framework.Felix.access$100(Felix.java
:36)
> > at
> > org.apache.felix.framework.Felix$1.serviceChanged(Felix.java:242)
> > at
> > org.apache.felix.framework.ServiceRegistry.fireServiceChanged
> (ServiceRegistry.java:435)
> > at
> >
> org.apache.felix.framework.ServiceRegistry.registerService(
ServiceRegistry.java:71)
> > at org.apache.felix.framework.Felix.registerService
> > (Felix.java :2107)
> > at
> >
> org.apache.felix.framework.BundleContextImpl.registerService(
BundleContextImpl.java:252)
> > at
> >
> org.apache.felix.framework.BundleContextImpl.registerService(
BundleContextImpl.java
> :230)
> > at
> >
net.java.sip.communicator.impl.spellcheck.SpellCheckActivator.start
> > (SpellCheckActivator.java:89)
> > at
> > org.apache.felix.framework.util.SecureAction.startActivator
> (SecureAction.java:509)
> > at
> org.apache.felix.framework.Felix._startBundle(Felix.java:1260)
> > at org.apache.felix.framework.Felix.startBundle
> (Felix.java:1201)
> > at
> > org.apache.felix.framework.Felix.setFrameworkStartLevel
> (Felix.java:807)
> > at
> >
> org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java
:256)
> > at java.lang.Thread.run(Thread.java:619)
> >
> > but after that the logger finishes to print :
> >
> > FIN: impl.spellcheck.SpellCheckServiceImpl.start().93 Service
Impl:
> > net.java.sip.communicator.impl.spellcheck.SpellCheckActivator
> [REGISTERED]
> >
> > So is the service registered ?
> > and what could be the reason of the error above ?
> >
> > thx guys and keep up the good work
> >
> > Jean-Daniel
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> dev-unsubscribe@sip-communicator.dev.java.net
> <mailto:dev-unsubscribe@sip-communicator.dev.java.net>
> For additional commands, e-mail:
> dev-help@sip-communicator.dev.java.net
> <mailto:dev-help@sip-communicator.dev.java.net>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net